Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
2.7 KiB

  1. //===================== Copyright (c) Valve Corporation. All Rights Reserved. ======================
  2. //
  3. //
  4. //==================================================================================================
  5. #ifndef GENERATORDEFINITION_H
  6. #define GENERATORDEFINITION_H
  7. #ifdef _WIN32
  8. #pragma once
  9. #endif
  10. struct PropertyName_t
  11. {
  12. int m_nPropertyId;
  13. const char *m_pPrefixName;
  14. const char *m_pPropertyName;
  15. };
  16. enum configKeyword_e
  17. {
  18. KEYWORD_UNKNOWN = -1,
  19. KEYWORD_GENERAL,
  20. KEYWORD_DEBUGGING,
  21. KEYWORD_COMPILER,
  22. KEYWORD_PS3_SNCCOMPILER,
  23. KEYWORD_PS3_GCCCOMPILER,
  24. KEYWORD_LIBRARIAN,
  25. KEYWORD_LINKER,
  26. KEYWORD_PS3_SNCLINKER,
  27. KEYWORD_PS3_GCCLINKER,
  28. KEYWORD_MANIFEST,
  29. KEYWORD_XMLDOCGEN,
  30. KEYWORD_BROWSEINFO,
  31. KEYWORD_RESOURCES,
  32. KEYWORD_PREBUILDEVENT,
  33. KEYWORD_PRELINKEVENT,
  34. KEYWORD_POSTBUILDEVENT,
  35. KEYWORD_CUSTOMBUILDSTEP,
  36. KEYWORD_XBOXIMAGE,
  37. KEYWORD_XBOXDEPLOYMENT,
  38. KEYWORD_MAX,
  39. };
  40. enum PropertyType_e
  41. {
  42. PT_UNKNOWN = 0,
  43. PT_BOOLEAN,
  44. PT_STRING,
  45. PT_INTEGER,
  46. PT_LIST,
  47. PT_IGNORE,
  48. PT_DEPRECATED,
  49. };
  50. struct PropertyOrdinal_t
  51. {
  52. CUtlString m_ParseString;
  53. CUtlString m_ValueString;
  54. };
  55. struct ToolProperty_t
  56. {
  57. ToolProperty_t()
  58. {
  59. m_nPropertyId = -1;
  60. m_nType = PT_UNKNOWN;
  61. m_bFixSlashes = false;
  62. m_bEmitAsGlobalProperty = false;
  63. m_bInvertOutput = false;
  64. m_bAppendSlash = false;
  65. m_bPreferSemicolonNoComma = false;
  66. m_bPreferSemicolonNoSpace = false;
  67. }
  68. CUtlString m_ParseString;
  69. CUtlString m_AliasString;
  70. CUtlString m_LegacyString;
  71. CUtlString m_OutputString;
  72. CUtlVector< PropertyOrdinal_t > m_Ordinals;
  73. int m_nPropertyId;
  74. PropertyType_e m_nType;
  75. bool m_bFixSlashes;
  76. bool m_bEmitAsGlobalProperty;
  77. bool m_bInvertOutput;
  78. bool m_bAppendSlash;
  79. bool m_bPreferSemicolonNoComma;
  80. bool m_bPreferSemicolonNoSpace;
  81. };
  82. struct GeneratorTool_t
  83. {
  84. GeneratorTool_t()
  85. {
  86. m_nKeyword = KEYWORD_UNKNOWN;
  87. }
  88. CUtlString m_ParseString;
  89. CUtlVector< ToolProperty_t > m_Properties;
  90. configKeyword_e m_nKeyword;
  91. };
  92. class CGeneratorDefinition
  93. {
  94. public:
  95. CGeneratorDefinition();
  96. void LoadDefinition( const char *pDefinitionName, PropertyName_t *pPropertyNames );
  97. ToolProperty_t *GetProperty( configKeyword_e keyword, const char *pPropertyName );
  98. const char *GetScriptName( CRC32_t *pCRC );
  99. private:
  100. void AssignIdentifiers();
  101. void IterateToolKey( KeyValues *pToolKV );
  102. void IteratePropertyKey( GeneratorTool_t *pTool, KeyValues *pPropertyKV );
  103. void IterateAttributesKey( ToolProperty_t *pProperty, KeyValues *pAttributesKV );
  104. void Clear();
  105. PropertyName_t *m_pPropertyNames;
  106. CUtlString m_ScriptName;
  107. CUtlString m_NameString;
  108. CUtlString m_VersionString;
  109. CUtlVector< GeneratorTool_t > m_Tools;
  110. CRC32_t m_ScriptCRC;
  111. };
  112. #endif // GENERATORDEFINITION_H