Elaztek Developer Hub
Blamite Game Engine - Guerilla (Library)  00390.07.02.23.1947.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 
31 {
32  ASM,
33  BASH,
34  C,
35  CPP,
36  CMK,
37  CS,
38  CSS,
39  GO,
40  HSC,
41  HTML,
42  INI,
43  JS,
44  JAVA,
45  JSON,
46  LUA,
47  MAKE,
48  PHP,
49  PY,
50  QML,
51  RUST,
52  SQL,
53  TEXT,
54  TS,
55  V,
56  VEX,
57  XML,
58  YAML,
59  NONE
60 };
61 
65 enum class BlamTagFieldType
66 {
67  Ascii,
68  StringId,
69  Int8,
70  Int16,
71  Int32,
72  Int64,
73  Real,
74  Bitfield8,
75  Bitfield16,
76  Bitfield32,
77  Enum8,
78  Enum16,
79  Enum32,
80  Block,
81  Dataref,
82  Tagref,
83  Comment,
84  Color,
85  Vector2,
86  Vector3,
87  Vector4,
88 
90 };
91 
92 class BlamTagField;
93 
102 {
103 private:
105  BlamPlugin* plugin = nullptr;
106 
107 public:
108  int offset = 0x0;
109  int length = 0x0;
110  bool visible = true;
111  std::string display_name = "";
112  std::string description = "";
113  std::string field_id = "";
114  std::string input_hint = "";
115  bool require_unused_visible = false;
116  std::string default_value = "";
117 
125 
131  BlamPluginField(BlamPluginField* _old_field);
132 
138  BlamTagFieldType GetType();
139 
146 
156  virtual BlamTagField* GenerateTagField(BlamTag* tag);
157 
167  virtual BlamTagField* GenerateTagField(BlamTagField* existing_tag_field);
168 
180  virtual BlamTagField* GenerateTagField(BlamTag* tag, void* address);
181 
187  virtual std::string GenerateXMLString();
188 
198  virtual void UpdateOffsetData(int new_offset);
199 
210  virtual std::string GenerateCppStructString(std::string line_prefix = "", bool generate_doxygen_comments = true);
211 
223  virtual std::string GenerateCppClassString(std::string line_prefix = "");
224 
235  virtual bool ParseXMLData(rapidxml::xml_node<>* field_node);
236 
252  void ChangeType(BlamTagFieldType new_type);
253 };
254 
262 {
263 private:
265  BlamTag* tag = nullptr;
266 
267 public:
268  int c_entry_index = 0;
269  int c_entry_size = 0;
270 
271  BlamPluginField* plugin_field = nullptr;
272  std::string field_id = "";
273 
280  BlamTagField(BlamTag* _tag, BlamTagFieldType _type);
281 
287  virtual std::string GenerateXMLString();
288 
294  virtual std::vector<char> GetValueAsBytes();
295 
301  BlamTagFieldType GetType();
302 
308  BlamTag* GetTag();
309 
315  BlamPluginField* GetPluginField();
316 
322  bool HasPluginField();
323 };
324 
329 {
338 
347 
356 
370  GUERILLA_LIB_API BlamPluginField* ConfigurePluginField(BlamPluginField* field, BlamTagFieldType field_type, bool* configured = nullptr);
371 
380 
390 
391  GUERILLA_LIB_API std::vector<BlamDatarefValueHintType> GetDatarefValueHintTypeList();
392 }
BlamTagField
Class representing a tag field.
Definition: fields.h:261
comment.h
BlamTagFieldType::Int16
@ Int16
Indicates that the field is a 16-bit integer.
BlamDatarefValueHintType::YAML
@ YAML
YAML Configuration.
BlamDatarefValueHintType::C
@ C
C Code.
block.h
BlamTagFieldType::Real
@ Real
Indicates that the field is a Float32.
BlamDatarefValueHintType
BlamDatarefValueHintType
Enumerator listing all supported dataref value hint types.
Definition: fields.h:30
BlamTagFieldType::Int32
@ Int32
Indicates that the field is a 32-bit integer.
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:328
BlamTagFieldType::Enum8
@ Enum8
Indicates that the field is an Enum8.
BlamPluginField_Enum
Class representing a plugin enum field.
Definition: enum.h:31
BlamTagFieldType::Vector4
@ Vector4
Indicates that the field is a vector4.
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:80
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:299
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:25
BlamDatarefValueHintType::CS
@ CS
C# Code.
BlamDatarefValueHintType::BASH
@ BASH
Bash Script.
BlamDatarefValueHintType::GO
@ GO
Go (Golang) Code.
BlamTagFieldType::Block
@ Block
Indicates that the field is a tag block.
BlamDatarefValueHintType::ASM
@ ASM
Assembly Code.
BlamTagFieldType::Ascii
@ Ascii
Indicates that the field is a string of text.
BlamDatarefValueHintType::VEX
@ VEX
Vex Code.
BlamPluginField_Vector
Class representing a vector plugin field.
Definition: vector.h:18
BlamDatarefValueHintType::TEXT
@ TEXT
Plain Text.
BlamTagFieldType::Dataref
@ Dataref
Indicates that the field is a data reference.
BlamTagFieldType::Enum16
@ Enum16
Indicates that the field is an Enum16.
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:39
BlamDatarefValueHintType::JSON
@ JSON
JSON Data.
BlamDatarefValueHintType::HTML
@ HTML
HTML Markup.
BlamDatarefValueHintType::JAVA
@ JAVA
Java Code.
BlamTagFieldType::Bitfield16
@ Bitfield16
Indicates that the field is a Bitfield16.
BlamTagFieldType
BlamTagFieldType
Enumerator containing all possible tag field types.
Definition: fields.h:65
Guerilla::Tags::GetPlugin
GUERILLA_LIB_API BlamPlugin * GetPlugin(std::string class_name)
Retrieves a plugin based on its name.
Definition: plugins.cpp:137
BlamTagFieldType::Int8
@ Int8
Indicates that the field is an 8-bit integer.
BlamPluginField_Int
Class representing an integer plugin field.
Definition: int.h:16
BlamPluginField_Block
Class representing a block plugin field.
Definition: block.h:66
BlamTagFieldType::Color
@ Color
Indicates that the field is a color.
BlamTagFieldType::Comment
@ Comment
Indicates that the field is a comment. These do not store any tag data.
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:222
tagref.h
BlamPluginField_Color
Class representing a color plugin field.
Definition: color.h:17
BlamPluginField
Class representing a plugin field.
Definition: fields.h:101
BlamPluginField_Comment
Class representing a comment plugin field.
Definition: comment.h:30
BlamTag
Class representing a Tag.
Definition: tags.h:277
BlamDatarefValueHintType::CPP
@ CPP
C++ Code.
Guerilla::Tags::Fields::GetDatarefValueHintTypeList
GUERILLA_LIB_API std::vector< BlamDatarefValueHintType > GetDatarefValueHintTypeList()
Definition: fields.cpp:377
BlamDatarefValueHintType::PY
@ PY
Python Code.
BlamDatarefValueHintType::NONE
@ NONE
No value hint, no special treatment will be given to the data.
BlamTagFieldType::Int64
@ Int64
Indicates that the field is a 32-bit integer.
BlamTagFieldType::Tagref
@ Tagref
Indicates that the field is a tag reference.
BlamPluginField_Dataref
Class representing a dataref plugin field.
Definition: dataref.h:17
BlamTagFieldType::Vector3
@ Vector3
Indicates that the field is a vector3.
BlamDatarefValueHintType::INI
@ INI
INI Configuration.
BlamDatarefValueHintType::LUA
@ LUA
Lua Script.
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:209
BlamPlugin
Class representing a Plugin.
Definition: tags.h:79
fields.h
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:364
BlamTagFieldType::Bitfield8
@ Bitfield8
Indicates that the field is a Bitfield8.
BlamDatarefValueHintType::PHP
@ PHP
PHP Code.
BlamPluginField_Ascii
Class representing an ascii plugin field.
Definition: ascii.h:18
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:32
float32.h
Guerilla::Tags::Fields::GetStandardFieldLength
GUERILLA_LIB_API int GetStandardFieldLength(BlamTagFieldType type)
Retrieves the length of a tag field.
Definition: fields.cpp:118
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.
BlamTagFieldType::Unspecified
@ Unspecified
Indicates that the field's type is not specified. Fields with this type should be considered invalid.
BlamTagFieldType::StringId
@ StringId
Indicates that the field is a String ID.
color.h
BlamDatarefValueHintType::V
@ V
V Code.
BlamTagFieldType::Bitfield32
@ Bitfield32
Indicates that the field is a Bitfield32.
BlamTagFieldType::Vector2
@ Vector2
Indicates that the field is a vector2.
ascii.h
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:235
BlamDatarefValueHintType::MAKE
@ MAKE
Make Script.
GUERILLA_LIB_API
#define GUERILLA_LIB_API
Definition: fields.h:15
int.h
BlamTagFieldType::Enum32
@ Enum32
Indicates that the field is an Enum32.
BlamDatarefValueHintType::XML
@ XML
XML Markup.
BlamDatarefValueHintType::HSC
@ HSC
BlamScript/HaloScript Script.
enum.h