Elaztek Developer Hub
Blamite Game Engine - Guerilla (Library)  00390.07.02.23.1947.blamite
The tag editor for the Blamite Game Engine.
BlamPluginField_Block Class Reference

Class representing a block plugin field. More...

#include <block.h>

+ Inheritance diagram for BlamPluginField_Block:
+ Collaboration diagram for BlamPluginField_Block:

Public Member Functions

 BlamPluginField_Block (BlamPluginField *base_field)
 Constructs a new block plugin field from an existing generic plugin field. More...
 
 ~BlamPluginField_Block ()
 
BlamPluginFieldGetField (std::string id)
 Locates a field within the entry template with a specified ID. More...
 
BlamPluginFieldGetField (std::string id, BlamTagFieldType type)
 Locates a field within the entry template with a specified ID and type. More...
 
void UpdateOffsetData (int new_offset) override
 Updates any offsets or lengths for the given field. More...
 
std::string GenerateXMLString () override
 Generates a string representing this plugin field. More...
 
std::string GenerateCppStructString (std::string line_prefix="", bool generate_doxygen_comments=true) override
 Generates a string containing C++ code representing this plugin field. More...
 
std::string GenerateCppStructString (std::string line_prefix="", bool include_comments=true, bool generate_doxygen_comments=true, bool include_comment_descriptions=true)
 
std::string GenerateCppClassString (std::string line_prefix="") override
 Generates a string containing C++ code representing this plugin field. More...
 
bool ParseXMLData (rapidxml::xml_node<> *field_node) override
 Populates data within the plugin field from an XML node. More...
 
BlamTagFieldGenerateTagField (BlamTag *tag, void *address) override
 Generates a new tag field from this plugin field. More...
 
BlamTagFieldGenerateTagField (BlamTag *tag) override
 Generates a new tag field from this plugin field. More...
 
- Public Member Functions inherited from BlamPluginField
 BlamPluginField (BlamPlugin *_plugin, BlamTagFieldType _type)
 Constructs a new plugin field. More...
 
 BlamPluginField (BlamPluginField *_old_field)
 Constructs a new plugin field. More...
 
BlamTagFieldType GetType ()
 Retrieves the type of this field. More...
 
BlamPluginGetPlugin ()
 Retrieves the plugin this field is associated with. More...
 
virtual BlamTagFieldGenerateTagField (BlamTagField *existing_tag_field)
 Generates a new tag field from this plugin field. More...
 
void ChangeType (BlamTagFieldType new_type)
 Changes the type of a plugin field. More...
 

Public Attributes

int entry_size = 0
 The size of a each block entry. More...
 
std::vector< BlamPluginField * > fields
 The list of fields within the tag block. More...
 
int c_entry_count = 0
 The entry count. Used in tag decompilation. More...
 
int c_entry_offset = 0
 The offset of the entry data. Used in tag decompilation. More...
 
int max_entry_count = -1
 The maximum number of entries this block can contain. More...
 
- Public Attributes inherited from BlamPluginField
int offset = 0x0
 The offset of the field data. More...
 
int length = 0x0
 The length of the field data. More...
 
bool visible = true
 Whether or not the field is visible. More...
 
std::string display_name = ""
 The display name of the field. More...
 
std::string description = ""
 An optional description of the field. More...
 
std::string field_id = ""
 The ID of the field. More...
 
std::string input_hint = ""
 An additional piece of short text that can be used to suggest valid input for a field. More...
 
bool require_unused_visible = false
 If enabled, this field will only be visible when "Show Unused Fields" is enabled. More...
 
std::string default_value = ""
 The default text value for the field. More...
 

Detailed Description

Class representing a block plugin field.

Tag blocks act as a container for other tag fields. Each block can contain a series of "entries". Each entry will always have the same fields available (and thus be the same size), but the values of each field within an entry can differ.

Plugin block fields store the list of valid fields for any entries, as well as the size of each entry.

Constructor & Destructor Documentation

◆ BlamPluginField_Block()

BlamPluginField_Block::BlamPluginField_Block ( BlamPluginField base_field)

Constructs a new block plugin field from an existing generic plugin field.

Parameters
base_field- The base plugin data to use for this field.

◆ ~BlamPluginField_Block()

BlamPluginField_Block::~BlamPluginField_Block ( )

Member Function Documentation

◆ GenerateCppClassString()

std::string BlamPluginField_Block::GenerateCppClassString ( std::string  line_prefix = "")
overridevirtual

Generates a string containing C++ code representing this plugin field.

This method will generate a string containing C++ code that is intended for use within the BlamTagClass class. This class is used by the game engine to store a tag class layout, allowing for in-engine tools to present a tag data editing UI among other things.

Parameters
line_prefix- A string that should be placed before each line, such as a certain amount of indentation spaces.
Returns
A string containing C++ code representing the field and its data.

Reimplemented from BlamPluginField.

◆ GenerateCppStructString() [1/2]

std::string BlamPluginField_Block::GenerateCppStructString ( std::string  line_prefix = "",
bool  generate_doxygen_comments = true 
)
overridevirtual

Generates a string containing C++ code representing this plugin field.

This method will generate a string containing C++ code that is intended for use within the tag class data structure. This is intended to be used when exporting a tag class to C++ code.

Parameters
line_prefix- A string that should be placed before each line, such as a certain amount of indentation spaces.
Returns
A string containing C++ code representing the field and its data.

Reimplemented from BlamPluginField.

◆ GenerateCppStructString() [2/2]

std::string BlamPluginField_Block::GenerateCppStructString ( std::string  line_prefix = "",
bool  include_comments = true,
bool  generate_doxygen_comments = true,
bool  include_comment_descriptions = true 
)
+ Here is the call graph for this function:

◆ GenerateTagField() [1/2]

BlamTagField * BlamPluginField_Block::GenerateTagField ( BlamTag tag)
overridevirtual

Generates a new tag field from this plugin field.

With this overload, a brand new tag field is created with no value.

Parameters
tag- The tag the new field should belong to.
Returns
Pointer to the new tag field.

Reimplemented from BlamPluginField.

◆ GenerateTagField() [2/2]

BlamTagField * BlamPluginField_Block::GenerateTagField ( BlamTag tag,
void *  address 
)
overridevirtual

Generates a new tag field from this plugin field.

With this overload, a new field is created and its value(s) are read from the tag data. This should only be used when reading binary (compiled) tag files.

Parameters
tag- The tag the new field should belong to.
address- The address of the field value.
Returns
Pointer to the new tag field.

Reimplemented from BlamPluginField.

◆ GenerateXMLString()

std::string BlamPluginField_Block::GenerateXMLString ( )
overridevirtual

Generates a string representing this plugin field.

Returns
An XML string containing the field ID and other attributes.

Reimplemented from BlamPluginField.

+ Here is the call graph for this function:

◆ GetField() [1/2]

BlamPluginField * BlamPluginField_Block::GetField ( std::string  id)

Locates a field within the entry template with a specified ID.

Parameters
field_id- The ID of the desired field.
Returns
A pointer to the field within the entry template if it exists. If no field matching the specified ID was found, then this will return nullptr.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetField() [2/2]

BlamPluginField * BlamPluginField_Block::GetField ( std::string  id,
BlamTagFieldType  type 
)

Locates a field within the entry template with a specified ID and type.

Parameters
field_id- The ID of the desired field.
field_type- The type of the desired field.
Returns
A pointer to the field within the entry template if it exists. If no field matching the specified ID and type was found, then this will return nullptr.
+ Here is the call graph for this function:

◆ ParseXMLData()

bool BlamPluginField_Block::ParseXMLData ( rapidxml::xml_node<> *  field_node)
overridevirtual

Populates data within the plugin field from an XML node.

This is intended for use when loading a plugin from an XML document.

Parameters
field_node- Pointer to the XML node to parse plugin field data from.
Returns
true if all required field data was parsed, otherwise returns false. If this returns false, this field should be deleted and should NOT be added to the plugin - as this indicates an issue with the original plugin file.

Reimplemented from BlamPluginField.

+ Here is the call graph for this function:

◆ UpdateOffsetData()

void BlamPluginField_Block::UpdateOffsetData ( int  new_offset)
overridevirtual

Updates any offsets or lengths for the given field.

In most cases, this simply updates the offset field to the new value. However, in some cases, additional steps may need to be performed, such as recalculating the entry size of a block. This method will also perform these operations as needed, depending on the plugin field type.

Parameters
new_offset- The new offset for the plugin field.

Reimplemented from BlamPluginField.

+ Here is the call graph for this function:

Member Data Documentation

◆ c_entry_count

int BlamPluginField_Block::c_entry_count = 0

The entry count. Used in tag decompilation.

◆ c_entry_offset

int BlamPluginField_Block::c_entry_offset = 0

The offset of the entry data. Used in tag decompilation.

◆ entry_size

int BlamPluginField_Block::entry_size = 0

The size of a each block entry.

◆ fields

std::vector<BlamPluginField*> BlamPluginField_Block::fields

The list of fields within the tag block.

◆ max_entry_count

int BlamPluginField_Block::max_entry_count = -1

The maximum number of entries this block can contain.


The documentation for this class was generated from the following files: