Elaztek Developer Hub
Blamite Game Engine - Guerilla (Library)  00421.06.29.24.2305.blamite
The tag editor for the Blamite Game Engine.
bitfield.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
5 #include "../fields.h"
6 
7 #ifdef GUERILLA_LIB_EXPORTS
8 #define GUERILLA_LIB_API __declspec(dllexport)
9 #else
10 #define GUERILLA_LIB_API __declspec(dllimport)
11 #endif
12 
19 {
20  std::string id;
21  std::string name;
22  int index;
23 };
24 
29 {
30  std::string id;
31  bool value;
32 };
33 
40 {
41 public:
42  std::vector<BlamBitfieldBitInfo> bits;
43 
50 
51  std::string GenerateXMLString() override;
52  std::string GenerateCppStructString(std::string line_prefix = "", bool generate_doxygen_comments = true) override;
53  std::string GenerateCppClassString(std::string line_prefix = "") override;
54  bool ParseXMLData(rapidxml::xml_node<>* field_node) override;
55  BlamTagField* GenerateTagField(BlamTag* tag, void* address) override;
56  BlamTagField* GenerateTagField(BlamTag* tag) override;
57  BlamPluginField* Copy(BlamPlugin* new_plugin) override;
58 };
59 
66 {
67 public:
68  std::vector<BlamBitfieldBitData> bits;
69 
76  BlamTagField_Bitfield(BlamTag* _tag, BlamTagFieldType _type);
77 
78  std::string GenerateXMLString();
79  std::vector<char> GetValueAsBytes();
80 
88  bool HasBit(std::string flag_id);
89 
97  bool GetBitValue(std::string flag_id);
98 
107  bool SetBit(std::string flag_id, bool value);
108 };
BlamTagField
Class representing a tag field.
Definition: fields.h:244
block.h
BlamTag::GetTagPath
std::string GetTagPath()
Generates the tag path, relative to its project.
Definition: BlamTag.cpp:754
BlamTagField::GetType
BlamTagFieldType GetType()
Retrieves the type of this field.
Definition: BlamTagField.cpp:19
BlamPluginField::GenerateTagField
virtual BlamTagField * GenerateTagField(BlamTag *tag)
Generates a new tag field from this plugin field.
Definition: BlamPluginField.cpp:41
Guerilla::Tags::VerifyPluginIDs
GUERILLA_LIB_API bool VerifyPluginIDs(std::vector< BlamPluginField * > field_list, std::string scope_name)
Verifies all field IDs within a list of plugin fields.
Definition: plugin_verification.cpp:217
BlamDatarefValueHintType
BlamDatarefValueHintType
Enumerator listing all supported dataref value hint types.
Definition: fields.h:30
BlamPluginField_Enum::options
std::vector< BlamEnumFieldOption > options
The list of options within the enum.
Definition: enum.h:44
BlamTag::ReleaseFieldData
void ReleaseFieldData()
Releases all items in fields.
Definition: BlamTag.cpp:445
bitfield.h
next_new_tag_number
int next_new_tag_number
The number to use for the next newly created tag.
Definition: BlamPlugin.cpp:15
BlamPlugin::fieldset_version
int fieldset_version
The fieldset version of the tag.
Definition: tags.h:112
boolean.h
BlamPluginField_Enum
Class representing a plugin enum field.
Definition: enum.h:41
BlamTag::project
BlamProject * project
The project that this tag belongs to.
Definition: tags.h:325
BlamPlugin::class_name_short
std::string class_name_short
The short class name. Ex: scnr. Must be 4 characters or fewer.
Definition: tags.h:109
GUERILLA_LIB_API
#define GUERILLA_LIB_API
Definition: bitfield.h:10
BlamProject::GetTagsRoot
std::string GetTagsRoot()
Definition: BlamProject.cpp:161
BlamTagField_Bitfield::bits
std::vector< BlamBitfieldBitData > bits
The list of bits within this bitfield.
Definition: bitfield.h:68
BlamPlugin::description
std::string description
An optional long description of the plugin.
Definition: tags.h:117
tags.h
ENGINE_VERSION
#define ENGINE_VERSION
BlamPluginField::GenerateXMLString
virtual std::string GenerateXMLString()
Generates a string representing this plugin field.
Definition: BlamPluginField.cpp:61
BlamPlugin::~BlamPlugin
~BlamPlugin()
Destroys the plugin data and releases all field data.
Definition: BlamPlugin.cpp:153
BlamTagField_Dataref::SetText
void SetText(std::string text_value)
Sets the dataref's stored value to a given string.
Definition: BlamTagField_Dataref.cpp:78
BlamPlugin::ParseField
BlamPluginField * ParseField(rapidxml::xml_node<> *field_node)
Attempts to parse an XML node as a plugin field.
Definition: BlamPlugin.cpp:69
BlamTagField_Block::entries
std::vector< BlamTagBlockEntry * > entries
The list of entries within this block.
Definition: block.h:131
BlamRevision::description
std::string description
The description of the revision.
Definition: tags.h:70
Guerilla::Tags::PluginExistsMatchOrNewer
GUERILLA_LIB_API bool PluginExistsMatchOrNewer(std::string class_name, int min_version)
Checks whether or not a plugin exists.
Definition: plugins.cpp:212
BlamPlugin::VerifyIDs
bool VerifyIDs()
Verifies that all field IDs within the plugin are valid.
Definition: BlamPlugin.cpp:761
BlamRevision::author
std::string author
The revision author.
Definition: tags.h:68
BlamTagField_Dataref::value_hint
BlamDatarefValueHintType value_hint
A string that can be checked against to determine the type of data being stored.
Definition: dataref.h:56
BlamTag::revisions
std::vector< BlamRevision > revisions
The list of revisions within the tag.
Definition: tags.h:320
BlamTagField::field_id
std::string field_id
The ID of this field.
Definition: fields.h:256
BlamTagField_Vector::value
BlamVector4 value
The value of the field, represented as a 4D vector.
Definition: vector.h:41
BlamPlugin::IsBuiltIn
bool IsBuiltIn()
Checks if the plugin is a built-in plugin.
Definition: BlamPlugin.cpp:532
BlamPluginField::GetType
BlamTagFieldType GetType()
Retrieves the type of this field.
Definition: BlamPluginField.cpp:31
BlamPlugin::GenerateCppSourceFile
std::string GenerateCppSourceFile(bool include_comments=true, bool generate_doxygen_comments=true)
Generates C++ file source code containing the necessary information about the plugin file.
Definition: BlamPlugin.cpp:716
BlamTagField_Block::GenerateXMLString
std::string GenerateXMLString(bool keep_unused, bool keep_invalid)
Generates a string with the field ID and value, ready to be written to an XML file.
Definition: BlamTagField_Block.cpp:133
BlamTagBlockEntry
Data structure representing a tag block entry.
Definition: block.h:17
BlamTag::upgrade_policy
BlamTagUpgradePolicy upgrade_policy
The tag's upgrade policy.
Definition: tags.h:337
Guerilla::Tags::GetPlugin
GUERILLA_LIB_API BlamPlugin * GetPlugin(std::string class_name)
Retrieves a plugin based on its name.
Definition: plugins.cpp:137
BlamBitfieldBitData::id
std::string id
The ID of the bit.
Definition: bitfield.h:30
BlamTagField_Color::value
BlamColor value
The value of the field, represented as a color.
Definition: color.h:39
BlamPlugin::GenerateCppHeaderFile
std::string GenerateCppHeaderFile(bool include_comments=true, bool generate_doxygen_comments=true)
Generates C++ header source code containing the necessary information about the plugin file.
Definition: BlamPlugin.cpp:615
BlamPlugin::short_description
std::string short_description
An optional short description of the plugin.
Definition: tags.h:116
BlamPlugin::revisions
std::vector< BlamRevision > revisions
The list of revisions contained within this plugin.
Definition: tags.h:119
BlamTagField_Float32
Class representing a real (float32) tag field.
Definition: float32.h:33
BlamBitfieldBitInfo::index
int index
The bit's index.
Definition: bitfield.h:22
BlamPlugin::valid
bool valid
Whether or not the plugin was able to be loaded.
Definition: tags.h:123
BlamPlugin::fields
std::vector< BlamPluginField * > fields
The list of fields contained within this plugin.
Definition: tags.h:120
Guerilla::Tags::PluginExists
GUERILLA_LIB_API bool PluginExists(std::string class_name)
Checks whether or not a plugin exists.
Definition: plugins.cpp:192
BlamPlugin::RecalculateFieldData
void RecalculateFieldData()
Recalculates all offsets and lengths for the plugin.
Definition: BlamPlugin.cpp:450
BlamRevision
Structure representing a tag or plugin revision.
Definition: tags.h:66
BlamTagField_Tagref::referenced_tag_class
std::string referenced_tag_class
Definition: tagref.h:49
BlamTagUpgradePolicy
BlamTagUpgradePolicy
Enumerator representing the tag upgrade policy.
Definition: tags.h:25
dataref.h
BlamTagField::GenerateXMLString
virtual std::string GenerateXMLString()
Generates a string with the field ID and value, ready to be written to an XML file.
Definition: BlamTagField.cpp:9
tagref.h
BlamPlugin::file_path
std::string file_path
The path to the plugin file.
Definition: tags.h:122
BlamTag::fields
std::vector< BlamTagField * > fields
The list of fields within the tag.
Definition: tags.h:321
BlamTag::LoadFromDisk
BlamResult LoadFromDisk()
Loads the tag as an XML document from disk.
Definition: BlamTag.cpp:474
BlamPlugin::GetVersion
int GetVersion()
Retrieves the current revision of the plugin.
Definition: BlamPlugin.cpp:351
BlamPlugin::ExportPluginToCpp
bool ExportPluginToCpp(std::string export_directory="", bool include_comments=true, bool generate_doxygen_comments=true)
Exports the plugin file to the appropriate C++ source and header files.
Definition: BlamPlugin.cpp:537
BlamTag::plugin
BlamPlugin * plugin
Pointer to the plugin associated with this tag.
Definition: tags.h:318
BlamTagField_Tagref
Class representing an tagref tag field.
Definition: tagref.h:42
BlamPluginField_Enum::GetGlobalEnumName
std::string GetGlobalEnumName()
Definition: BlamPluginField_Enum.cpp:356
BlamBitfieldBitInfo::id
std::string id
The ID of the bit.
Definition: bitfield.h:20
BlamTagField_Bitfield
Clas representing a bitfield tag field.
Definition: bitfield.h:65
BlamTagField_Block
Class representing a block tag field.
Definition: block.h:128
BlamPluginField
Class representing a plugin field.
Definition: fields.h:71
BlamTagField_Dataref
Class representing a dataref tag field.
Definition: dataref.h:45
BlamTag
Class representing a Tag.
Definition: tags.h:296
BlamPlugin::SavePlugin
bool SavePlugin(bool recalculate_field_data=true)
Saves the plugin file back to disk.
Definition: BlamPlugin.cpp:465
BlamTag::GetVersion
int GetVersion()
Retrieves the current revision of the tag.
Definition: BlamTag.cpp:780
BlamTagBlockEntry::GetFieldFromRelativeAddress
BlamTagField * GetFieldFromRelativeAddress(std::string address)
Definition: BlamTagBlockEntry.cpp:71
BlamTag::GetField
BlamTagField * GetField(std::string field_id)
Locates a tag field with a specific ID.
Definition: BlamTag.cpp:722
BlamBitfieldBitData::value
bool value
The bit's value.
Definition: bitfield.h:31
Guerilla::Tags::GetPluginMatchOrNewer
GUERILLA_LIB_API BlamPlugin * GetPluginMatchOrNewer(std::string class_name, int min_version)
Retrieves a plugin based on its name and version.
Definition: plugins.cpp:172
BlamTag::GetFieldFromAddress
BlamTagField * GetFieldFromAddress(std::string address)
Looks up a field from its address.
Definition: BlamTag.cpp:795
BlamDatarefValueHintType::NONE
@ NONE
No value hint, no special treatment will be given to the data.
BlamTagField_Enum::current_option
std::string current_option
The ID of the currently selected option.
Definition: enum.h:83
fieldref.h
BlamPluginField::Copy
virtual BlamPluginField * Copy(BlamPlugin *new_plugin)
Creates a copy of this plugin field.
Definition: BlamPluginField.cpp:229
BlamTagField::HasPluginField
bool HasPluginField()
Checks whether the field has plugin data available.
Definition: BlamTagField.cpp:34
BlamPluginField::ParseXMLData
virtual bool ParseXMLData(rapidxml::xml_node<> *field_node)
Populates data within the plugin field from an XML node.
Definition: BlamPluginField.cpp:106
BlamTagField_Dataref::data_size
int data_size
The size of the referenced data.
Definition: dataref.h:49
BlamTagBlockEntry::fields
std::vector< BlamTagField * > fields
The list of fields within the entry.
Definition: block.h:21
BlamPluginField_Enum::GenerateCppGlobalEnumString
std::string GenerateCppGlobalEnumString(std::string line_prefix="", bool generate_doxygen_comments=true)
Definition: BlamPluginField_Enum.cpp:320
BlamTagField_Enum
Class representing a tag enum field.
Definition: enum.h:80
BlamBitfieldBitInfo::name
std::string name
The display name of the bit.
Definition: bitfield.h:21
BlamPlugin::Copy
BlamPlugin * Copy()
Creates a unique, deep copy of this plugin.
Definition: BlamPlugin.cpp:766
BlamRevision::version
int version
The revision version.
Definition: tags.h:69
BlamPluginField_Enum::bound_enum
BlamPluginField_Enum * bound_enum
Pointer to the global enum field this enum is bound to.
Definition: enum.h:51
BlamTagField_Float32::value
float value
The value of the field.
Definition: float32.h:38
BlamTag::SaveToDisk
void SaveToDisk(std::string _file_path)
Saves any modifications to the XML tag back to disk.
Definition: BlamTag.cpp:568
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
BlamPluginField::field_id
std::string field_id
The ID of the field.
Definition: fields.h:83
BlamTagField_Int
Class representing an integer tag field.
Definition: int.h:33
BlamPlugin::base_size
int base_size
The base size of the tag.
Definition: tags.h:111
BlamTagField_Vector
Class representing a vector tag field.
Definition: vector.h:36
BlamTag::BlamTag
BlamTag(std::string _file_path, BlamTagUpgradePolicy _upgrade_policy)
Prepares a new tag to be loaded.
Definition: BlamTag.cpp:461
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
BlamPlugin::project_name
std::string project_name
The game/project that this plugin was created for.
Definition: tags.h:114
BlamPluginField::ChangeType
void ChangeType(BlamTagFieldType new_type)
Changes the type of a plugin field.
Definition: BlamPluginField.cpp:224
BlamTag::LocatePlugin
bool LocatePlugin()
Attempts to locate a compatiable plugin for a given tag.
Definition: BlamTag.cpp:689
BlamPlugin::BlamPlugin
BlamPlugin(std::string _file_path)
Prepares a new plugin for load.
Definition: BlamPlugin.cpp:143
BlamTagField_Dataref::data_address
void * data_address
The address of the referenced data.
Definition: dataref.h:48
BlamTagUpgradePolicy::IGNORE_VERSION
@ IGNORE_VERSION
Instructs the tag to allow the use of any plugin, either newer or older.
float32.h
Guerilla::Tags::Fields::GetStandardFieldLength
GUERILLA_LIB_API int GetStandardFieldLength(BlamTagFieldType type)
Retrieves the length of a tag field.
Definition: fields.cpp:122
BlamPlugin::engine_version
std::string engine_version
The game engine version that generated this plugin, if applicable.
Definition: tags.h:115
BlamTagUpgradePolicy::UPGRADE_IF_NEWER
@ UPGRADE_IF_NEWER
Instructs the tag to allow the use of equal or newer plugin versions.
vector.h
BlamPlugin::LoadFromDisk
BlamResult LoadFromDisk()
Loads the plugin XML document from disk.
Definition: BlamPlugin.cpp:158
BlamPlugin::class_name_long
std::string class_name_long
The long class name. Ex: scenario. Can be any length.
Definition: tags.h:108
BlamTagField_Boolean
Class representing a boolean tag field.
Definition: boolean.h:35
BlamTag::file_path
std::string file_path
The path to the tag file.
Definition: tags.h:323
projects.h
BlamTag::class_name
std::string class_name
The class name as specified in the tag file. Used in the event a plugin could not be found.
Definition: tags.h:334
BlamTagField_Boolean::value
bool value
The value of the field.
Definition: boolean.h:40
BlamTagField_Fieldref
Class representing a fieldref tag field.
Definition: fieldref.h:38
BlamPluginField_Bitfield::bits
std::vector< BlamBitfieldBitInfo > bits
The list of bits within this bitfield.
Definition: bitfield.h:42
config.h
color.h
TAG_FIELDSET_VERSION
#define TAG_FIELDSET_VERSION
BlamTagField_Fieldref::field_location_address
std::string field_location_address
Definition: fieldref.h:44
BlamPlugin::CreateNewTag
BlamTag * CreateNewTag()
Creates a new tag using the plugin.
Definition: BlamPlugin.cpp:366
BlamPlugin::GetField
BlamPluginField * GetField(std::string id)
Attempts to locate a field with a given ID.
Definition: BlamPlugin.cpp:410
BlamTagBlockEntry::name
std::string name
The name of the entry.
Definition: block.h:20
BlamBitfieldBitData
Data structure containing data for a bitfield bit.
Definition: bitfield.h:28
BlamPluginField_Enum::bound_enum_id
std::string bound_enum_id
The ID of the global enum field this enum is bound to.
Definition: enum.h:50
BlamTagField_Int::value
int64_t value
The value of the field, represented as a 32-bit integer.
Definition: int.h:38
BlamPluginField::GenerateCppClassString
virtual std::string GenerateCppClassString(std::string line_prefix="")
Generates a string containing C++ code representing this plugin field.
Definition: BlamPluginField.cpp:101
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
BlamTagUpgradePolicy::EXACT_VERSION
@ EXACT_VERSION
Instructs the tag to require an exactly matching plugin version.
BlamTag::class_version
int class_version
The class/plugin version of the tag.
Definition: tags.h:333
BlamPluginField::GenerateCppStructString
virtual std::string GenerateCppStructString(std::string line_prefix="", bool generate_doxygen_comments=true)
Generates a string containing C++ code representing this plugin field.
Definition: BlamPluginField.cpp:96
int.h
BlamTagField::GetValueAsBytes
virtual std::vector< char > GetValueAsBytes()
Retrieves the field value as a list of bytes.
Definition: BlamTagField.cpp:14
BlamTagField_Tagref::referenced_tag_path
std::string referenced_tag_path
Definition: tagref.h:48
BlamTag::~BlamTag
~BlamTag()
Releases any data used by the tag by calling ReleaseFieldData.
Definition: BlamTag.cpp:469
Guerilla::Projects::GetCurrentProject
GUERILLA_LIB_API BlamProject * GetCurrentProject()
Definition: projects.cpp:13
BlamBitfieldBitInfo
Data structure containing extra data for a bitfield bit.
Definition: bitfield.h:18
enum.h
BlamTagField_Color
Class representing a color tag field.
Definition: color.h:34