Elaztek Developer Hub
Blamite Game Engine - Guerilla (Library)  00446.11.02.25.0036.blamite
The tag editor for the Blamite Game Engine.
fields.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 #include <blam/api/v1/types/tags.h>
6 #include <Strings/components/3rdparty/rapidxml/rapidxml.hpp>
7 
8 #ifndef GUERILLA_LIB_INTERNAL
9 #define GUERILLA_LIB_INTERNAL
10 #endif
11 
12 #ifdef GUERILLA_LIB_EXPORTS
13 #define GUERILLA_LIB_API __declspec(dllexport)
14 #else
15 #define GUERILLA_LIB_API __declspec(dllimport)
16 #endif
17 
18 class BlamTag;
19 class BlamPlugin;
20 
27 {
28  bool include_comments = true;
30 
44 
46 };
47 
58 {
59  ASM,
60  BASH,
61  C,
62  CPP,
63  CMK,
64  CS,
65  CSS,
66  GO,
67  HSC,
68  HTML,
69  INI,
70  JS,
71  JAVA,
72  JSON,
73  LUA,
74  MAKE,
75  PHP,
76  PY,
77  QML,
78  RUST,
79  SQL,
80  TEXT,
81  TS,
82  V,
83  VEX,
84  XML,
85  YAML,
86  NONE
87 };
88 
89 class BlamTagField;
90 
99 {
100 private:
101  BlamTagFieldType type = BlamTagFieldType::Unspecified;
102  BlamPlugin* plugin = nullptr;
103 
104 public:
105  int offset = 0x0;
106  int length = 0x0;
107  bool visible = true;
108  std::string display_name = "";
109  std::string description = "";
110  std::string field_id = "";
111  std::string input_hint = "";
112  bool require_unused_visible = false;
113  std::string default_value = "";
114 
121  BlamPluginField(BlamPlugin* _plugin, BlamTagFieldType _type);
122 
128  BlamPluginField(BlamPluginField* _old_field);
129 
135  BlamTagFieldType GetType();
136 
143 
153  virtual BlamTagField* GenerateTagField(BlamTag* tag);
154 
164  virtual BlamTagField* GenerateTagField(BlamTagField* existing_tag_field);
165 
177  virtual BlamTagField* GenerateTagField(BlamTag* tag, void* address);
178 
184  virtual std::string GenerateXMLString();
185 
195  virtual void UpdateOffsetData(int new_offset);
196 
208  virtual std::string GenerateCppStructString(std::string line_prefix = "", BlamPluginExportOptions options = BlamPluginExportOptions());
209 
221  virtual std::string GenerateCppClassString(std::string line_prefix = "");
222 
233  virtual bool ParseXMLData(rapidxml::xml_node<>* field_node);
234 
246  virtual BlamPluginField* Copy(BlamPlugin* new_plugin);
247 
263  void ChangeType(BlamTagFieldType new_type);
264 };
265 
273 {
274 private:
275  BlamTagFieldType type = BlamTagFieldType::Unspecified;
276  BlamTag* tag = nullptr;
277 
278 public:
279  int c_entry_index = 0;
280  int c_entry_size = 0;
281  int c_file_offset = 0;
282 
283  BlamPluginField* plugin_field = nullptr;
284  std::string field_id = "";
285 
292  BlamTagField(BlamTag* _tag, BlamTagFieldType _type);
293 
299  virtual std::string GenerateXMLString();
300 
306  virtual std::vector<char> GetValueAsBytes();
307 
313  BlamTagFieldType GetType();
314 
320  BlamTag* GetTag();
321 
327  BlamPluginField* GetPluginField();
328 
334  bool HasPluginField();
335 };
336 
341 {
349  GUERILLA_LIB_API int GetStandardFieldLength(BlamTagFieldType type);
350 
358  GUERILLA_LIB_API BlamTagFieldType DetermineFieldType(std::string node_name);
359 
367  GUERILLA_LIB_API std::string GetFieldTypeName(BlamTagFieldType type);
368 
382  GUERILLA_LIB_API BlamPluginField* ConfigurePluginField(BlamPluginField* field, BlamTagFieldType field_type, bool* configured = nullptr);
383 
392 
402 
403  GUERILLA_LIB_API std::vector<BlamDatarefValueHintType> GetDatarefValueHintTypeList();
404  GUERILLA_LIB_API std::vector<BlamPluginField*> GetGlobalEnums(std::vector<BlamPluginField*> field_list, bool get_global_parents);
405 }
BlamTagField
Class representing a tag field.
Definition: fields.h:272
comment.h
BlamDatarefValueHintType::YAML
@ YAML
YAML Configuration.
BlamDatarefValueHintType::C
@ C
C Code.
block.h
BlamDatarefValueHintType
BlamDatarefValueHintType
Enumerator listing all supported dataref value hint types.
Definition: fields.h:57
BlamPluginExportOptions::generate_doxygen_comments
bool generate_doxygen_comments
Whether or not to include doxygen-compatible comments when generating the tag struct.
Definition: fields.h:29
BlamDatarefValueHintType::CMK
@ CMK
CMake Script.
bitfield.h
BlamPluginField_Tagref
Class representing an tagref plugin field.
Definition: tagref.h:20
BlamDatarefValueHintType::RUST
@ RUST
Rust Code.
Guerilla::Tags::Fields
Namespace containing functions relating to tag fields.
Definition: fields.h:340
boolean.h
BlamPluginField_Enum
Class representing a plugin enum field.
Definition: enum.h:41
verify_tag_field_name_map
void verify_tag_field_name_map()
Verifies that the tag field name map has the appropriate data.
Definition: fields.cpp:81
Guerilla::Tags::Fields::GetDatarefValueHintString
GUERILLA_LIB_API std::string GetDatarefValueHintString(BlamDatarefValueHintType value_hint)
Generates a string from a given dataref value hint type.
Definition: fields.cpp:316
dataref_value_hint_map
BlamMap< BlamDatarefValueHintType, std::string > dataref_value_hint_map
A map containing a collection of dataref value hint types.
Definition: fields.cpp:26
BlamDatarefValueHintType::CS
@ CS
C# Code.
BlamDatarefValueHintType::BASH
@ BASH
Bash Script.
BlamDatarefValueHintType::GO
@ GO
Go (Golang) Code.
BlamDatarefValueHintType::ASM
@ ASM
Assembly Code.
BlamPluginExportOptions::include_comments
bool include_comments
Whether or not to include comment fields when generating the tag data structure.
Definition: fields.h:28
BlamDatarefValueHintType::VEX
@ VEX
Vex Code.
BlamPluginField_Vector
Class representing a vector plugin field.
Definition: vector.h:18
BlamDatarefValueHintType::TEXT
@ TEXT
Plain Text.
verify_dataref_value_hint_map
void verify_dataref_value_hint_map()
Verifies that the dataref value hint map has the appropriate data.
Definition: fields.cpp:40
BlamDatarefValueHintType::JSON
@ JSON
JSON Data.
BlamDatarefValueHintType::HTML
@ HTML
HTML Markup.
BlamDatarefValueHintType::JAVA
@ JAVA
Java Code.
Guerilla::Tags::GetPlugin
GUERILLA_LIB_API BlamPlugin * GetPlugin(std::string class_name)
Retrieves a plugin based on its name.
Definition: plugins.cpp:137
BlamPluginField_Int
Class representing an integer plugin field.
Definition: int.h:16
BlamPluginField_Block
Class representing a block plugin field.
Definition: block.h:68
BlamPluginField_Enum::define_in_global_scope
bool define_in_global_scope
Whether or not this enum is defined in the global C++ scope.
Definition: enum.h:46
dataref.h
Guerilla::Tags::Fields::GetFieldTypeName
GUERILLA_LIB_API std::string GetFieldTypeName(BlamTagFieldType type)
Generates a string name based on the provided tag field type.
Definition: fields.cpp:230
tagref.h
BlamPluginField_Color
Class representing a color plugin field.
Definition: color.h:17
BlamPluginField
Class representing a plugin field.
Definition: fields.h:98
BlamPluginField_Comment
Class representing a comment plugin field.
Definition: comment.h:30
BlamTag
Class representing a Tag.
Definition: tags.h:306
BlamDatarefValueHintType::CPP
@ CPP
C++ Code.
Guerilla::Tags::Fields::GetDatarefValueHintTypeList
GUERILLA_LIB_API std::vector< BlamDatarefValueHintType > GetDatarefValueHintTypeList()
Definition: fields.cpp:340
BlamDatarefValueHintType::PY
@ PY
Python Code.
BlamDatarefValueHintType::NONE
@ NONE
No value hint, no special treatment will be given to the data.
fieldref.h
BlamPluginField_Dataref
Class representing a dataref plugin field.
Definition: dataref.h:17
BlamDatarefValueHintType::INI
@ INI
INI Configuration.
BlamDatarefValueHintType::LUA
@ LUA
Lua Script.
BlamPluginExportOptions::export_comment_descriptions
bool export_comment_descriptions
Whether or not to include descriptions when exporting comment fields.
Definition: fields.h:45
BlamDatarefValueHintType::SQL
@ SQL
SQL Statements.
BlamDatarefValueHintType::CSS
@ CSS
CSS Stylesheet.
BlamDatarefValueHintType::TS
@ TS
TypeScript Code.
Guerilla::Tags::Fields::DetermineFieldType
GUERILLA_LIB_API BlamTagFieldType DetermineFieldType(std::string node_name)
Determines the field type from a string, used to determine the field type when parsing XML tags and p...
Definition: fields.cpp:217
Guerilla::Tags::Fields::GetGlobalEnums
GUERILLA_LIB_API std::vector< BlamPluginField * > GetGlobalEnums(std::vector< BlamPluginField * > field_list, bool get_global_parents)
Definition: fields.cpp:377
BlamPlugin
Class representing a Plugin.
Definition: tags.h:80
fields.h
BlamPluginField_Fieldref
Class representing a fieldref plugin field.
Definition: fieldref.h:21
BlamPluginField_Bitfield
Clas representing a bitfield plugin field.
Definition: bitfield.h:39
Guerilla::Tags::Fields::ParseDatarefValueHint
GUERILLA_LIB_API BlamDatarefValueHintType ParseDatarefValueHint(std::string value_hint_str)
Determines a dataref value hint type from a string representation.
Definition: fields.cpp:327
BlamDatarefValueHintType::PHP
@ PHP
PHP Code.
BlamPluginField_Block::fields
std::vector< BlamPluginField * > fields
The list of fields within the tag block.
Definition: block.h:72
tag_field_name_map
BlamMap< std::string, BlamTagFieldType > tag_field_name_map
A map containing a collection of tag field type/name mappings.
Definition: fields.cpp:33
float32.h
Guerilla::Tags::Fields::GetStandardFieldLength
GUERILLA_LIB_API int GetStandardFieldLength(BlamTagFieldType type)
Retrieves the length of a tag field.
Definition: fields.cpp:122
vector.h
BlamPluginField_Float32
Class representing a real (float32) plugin field.
Definition: float32.h:16
BlamDatarefValueHintType::JS
@ JS
JavaScript Code.
BlamDatarefValueHintType::QML
@ QML
QML Markup.
BlamPluginExportOptions::export_legacy_bitfields
bool export_legacy_bitfields
Whether or not to export bitfields using the legacy output method.
Definition: fields.h:43
BlamPluginExportOptions
Data structure containing plugin export options.
Definition: fields.h:26
BlamPluginField_Boolean
Class representing a boolean plugin field.
Definition: boolean.h:18
color.h
BlamDatarefValueHintType::V
@ V
V Code.
Guerilla::Tags::Fields::ConfigurePluginField
GUERILLA_LIB_API BlamPluginField * ConfigurePluginField(BlamPluginField *field, BlamTagFieldType field_type, bool *configured=nullptr)
Configures a specialized plugin field based on a base plugin field, and the desired type.
Definition: fields.cpp:243
BlamPluginField_Enum::bound_to_global_enum
bool bound_to_global_enum
Whether or not this enum is bound to an existing global enum.
Definition: enum.h:49
BlamDatarefValueHintType::MAKE
@ MAKE
Make Script.
GUERILLA_LIB_API
#define GUERILLA_LIB_API
Definition: fields.h:15
int.h
BlamDatarefValueHintType::XML
@ XML
XML Markup.
BlamDatarefValueHintType::HSC
@ HSC
BlamScript/HaloScript Script.
enum.h