Elaztek Developer Hub
Blamite Game Engine - Guerilla (Library)  00386.06.16.23.0646.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 
24 enum class BlamTagFieldType
25 {
26  Ascii,
27  StringId,
28  Int8,
29  Int16,
30  Int32,
31  Int64,
32  Real,
33  Bitfield8,
34  Bitfield16,
35  Bitfield32,
36  Enum8,
37  Enum16,
38  Enum32,
39  Block,
40  Dataref,
41  Tagref,
42  Comment,
43  Color,
44  Vector2,
45  Vector3,
46  Vector4,
47 
49 };
50 
51 class BlamTagField;
52 
61 {
62 private:
64  BlamPlugin* plugin = nullptr;
65 
66 public:
67  int offset = 0x0;
68  int length = 0x0;
69  bool visible = true;
70  std::string display_name = "";
71  std::string description = "";
72  std::string field_id = "";
73  std::string input_hint = "";
74  bool require_unused_visible = false;
75 
83 
89  BlamPluginField(BlamPluginField* _old_field);
90 
96  BlamTagFieldType GetType();
97 
104 
114  virtual BlamTagField* GenerateTagField(BlamTag* tag);
115 
125  virtual BlamTagField* GenerateTagField(BlamTagField* existing_tag_field);
126 
138  virtual BlamTagField* GenerateTagField(BlamTag* tag, void* address);
139 
145  virtual std::string GenerateXMLString();
146 
156  virtual void UpdateOffsetData(int new_offset);
157 
168  virtual std::string GenerateCppStructString(std::string line_prefix = "");
169 
181  virtual std::string GenerateCppClassString(std::string line_prefix = "");
182 
193  virtual bool ParseXMLData(rapidxml::xml_node<>* field_node);
194 };
195 
203 {
204 private:
206  BlamTag* tag = nullptr;
207 
208 public:
209  int c_entry_index = 0;
210  int c_entry_size = 0;
211 
212  BlamPluginField* plugin_field = nullptr;
213  std::string field_id = "";
214 
221  BlamTagField(BlamTag* _tag, BlamTagFieldType _type);
222 
228  virtual std::string GenerateXMLString();
229 
235  virtual std::vector<char> GetValueAsBytes();
236 
242  BlamTagFieldType GetType();
243 
249  BlamTag* GetTag();
250 
256  BlamPluginField* GetPluginField();
257 
263  bool HasPluginField();
264 };
265 
270 {
279 
288 
297 }
BlamTagField
Class representing a tag field.
Definition: fields.h:202
BlamTagFieldType::Int16
@ Int16
Indicates that the field is a 16-bit integer.
BlamTagFieldType::Real
@ Real
Indicates that the field is a Float32.
BlamTagFieldType::Int32
@ Int32
Indicates that the field is a 32-bit integer.
Guerilla::Tags::Fields
Namespace containing functions relating to tag fields.
Definition: fields.h:269
BlamTagFieldType::Enum8
@ Enum8
Indicates that the field is an Enum8.
BlamTagFieldType::Vector4
@ Vector4
Indicates that the field is a vector4.
BlamTagFieldType::Block
@ Block
Indicates that the field is a tag block.
BlamTagFieldType::Ascii
@ Ascii
Indicates that the field is a string of text.
BlamTagFieldType::Dataref
@ Dataref
Indicates that the field is a data reference.
BlamTagFieldType::Enum16
@ Enum16
Indicates that the field is an Enum16.
BlamTagFieldType::Bitfield16
@ Bitfield16
Indicates that the field is a Bitfield16.
BlamTagFieldType
BlamTagFieldType
Enumerator containing all possible tag field types.
Definition: fields.h:24
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.
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.
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:190
BlamPluginField
Class representing a plugin field.
Definition: fields.h:60
BlamTag
Class representing a Tag.
Definition: tags.h:232
BlamTagFieldType::Int64
@ Int64
Indicates that the field is a 32-bit integer.
BlamTagFieldType::Tagref
@ Tagref
Indicates that the field is a tag reference.
BlamTagFieldType::Vector3
@ Vector3
Indicates that the field is a vector3.
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:98
BlamPlugin
Class representing a Plugin.
Definition: tags.h:79
fields.h
BlamTagFieldType::Bitfield8
@ Bitfield8
Indicates that the field is a Bitfield8.
Guerilla::Tags::Fields::GetStandardFieldLength
GUERILLA_LIB_API int GetStandardFieldLength(BlamTagFieldType type)
Retrieves the length of a tag field.
Definition: fields.cpp:7
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.
BlamTagFieldType::Bitfield32
@ Bitfield32
Indicates that the field is a Bitfield32.
BlamTagFieldType::Vector2
@ Vector2
Indicates that the field is a vector2.
GUERILLA_LIB_API
#define GUERILLA_LIB_API
Definition: fields.h:15
BlamTagFieldType::Enum32
@ Enum32
Indicates that the field is an Enum32.