neverlosecc / source2gen

Source2 games SDK generator
http://s2gen.com
Apache License 2.0
240 stars 36 forks source link

Forward declaration functionality minor fix #64

Closed qbibubi closed 3 weeks ago

qbibubi commented 1 month ago

Fixed functionality which previously declared all forward declarations as struct. New functionality distinguishes classes from structures by checking passed objects name for occurence of C as the first character.

// Forward declaration for stucture
namespace source2sdk::entity2
{
    struct EntComponentInfo_t;
};

// Example forward declarations for different names of classes
namespace source2sdk::client
{
    class C_BaseModelEntity;
};

namespace source2sdk::soundsystem_voicecontainers
{
    class CVoiceContainerAnalysisBase;
};

namespace source2sdk::server
{
    class CCSPlayerPawn;
};
qbibubi commented 1 month ago

On a side note: wouldn't std::string_view be better choice in code generation header as argument passed to the function instead of const std::string&?

es3n1n commented 1 month ago

On a side note: wouldn't std::string_view be better choice in code generation header as argument passed to the function instead of const std::string&?

Doesn't matter much IMO, but I guess it would remove some overhead of creating std::strings for const char*s. Other than that I don't see much benefits. Feel free to open a PR for this although it will be merged only after #62

es3n1n commented 3 weeks ago

Thanks!