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

Class representing a plugin enum field. More...

#include <enum.h>

+ Inheritance diagram for BlamPluginField_Enum:
+ Collaboration diagram for BlamPluginField_Enum:

Public Member Functions

 BlamPluginField_Enum (BlamPluginField *base_field)
 Constructs a new block plugin field from an existing generic plugin 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 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...
 
BlamPluginFieldCopy (BlamPlugin *new_plugin) override
 Creates a copy of this plugin field. More...
 
std::string GenerateCppGlobalEnumString (std::string line_prefix="", bool generate_doxygen_comments=true)
 
std::string GetGlobalEnumName ()
 
- 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...
 
virtual void UpdateOffsetData (int new_offset)
 Updates any offsets or lengths for the given field. More...
 
void ChangeType (BlamTagFieldType new_type)
 Changes the type of a plugin field. More...
 

Public Attributes

std::vector< BlamEnumFieldOptionoptions
 The list of options within the enum. More...
 
bool define_in_global_scope = false
 Whether or not this enum is defined in the global C++ scope. More...
 
std::string global_enum_name = ""
 The name of this enum in the global C++ scope. More...
 
bool bound_to_global_enum = false
 Whether or not this enum is bound to an existing global enum. More...
 
std::string bound_enum_id = ""
 The ID of the global enum field this enum is bound to. More...
 
BlamPluginField_Enumbound_enum = nullptr
 Pointer to the global enum field this enum is bound to. 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 plugin enum field.

Enum fields allow for the selection of one of any number of preset values.

Plugin enum fields store all possible options within the enum. Additionally, plugin enum fields allow for enums to be defined in the global C++ scope (ie, when exporting a plugin to C++ source code), and stores settings controlling which enums are global, and which enums are bound to other global enums.

Global enums are ideal in situations where multiple enums throughout a plugin need to have identical options. By defining this enum in the global scope, any code which uses a tag class can be made cleaner and easier to read. Additionally, by using a global enum, the user can avoid having to re-type enum options over and over again. By extension, it also means that if options need to be removed or modified, those changes will be applied to all "bound" enums - which will inherit the options from the original.

Global enums use a separate name for their enum in C++ code, which is also stored by these plugin fields.

Constructor & Destructor Documentation

◆ BlamPluginField_Enum()

BlamPluginField_Enum::BlamPluginField_Enum ( 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.
+ Here is the caller graph for this function:

Member Function Documentation

◆ Copy()

BlamPluginField * BlamPluginField_Enum::Copy ( BlamPlugin new_plugin)
overridevirtual

Creates a copy of this plugin field.

This method will create a duplicate of this plugin field, as well as any child field data. Note that the copied field memory must be managed and freed by the calling code.

Parameters
new_plugin- The new plugin to associate with the copied field. If set to nullptr, then the plugin from the original field is used.
Returns
Pointer to the copied field data.

Reimplemented from BlamPluginField.

+ Here is the call graph for this function:

◆ GenerateCppClassString()

std::string BlamPluginField_Enum::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.

+ Here is the call graph for this function:

◆ GenerateCppGlobalEnumString()

std::string BlamPluginField_Enum::GenerateCppGlobalEnumString ( std::string  line_prefix = "",
bool  generate_doxygen_comments = true 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GenerateCppStructString()

std::string BlamPluginField_Enum::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.

+ Here is the call graph for this function:

◆ GenerateTagField() [1/2]

BlamTagField * BlamPluginField_Enum::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.

+ Here is the call graph for this function:

◆ GenerateTagField() [2/2]

BlamTagField * BlamPluginField_Enum::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.

+ Here is the call graph for this function:

◆ GenerateXMLString()

std::string BlamPluginField_Enum::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:

◆ GetGlobalEnumName()

std::string BlamPluginField_Enum::GetGlobalEnumName ( )
+ Here is the caller graph for this function:

◆ ParseXMLData()

bool BlamPluginField_Enum::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:

Member Data Documentation

◆ bound_enum

BlamPluginField_Enum* BlamPluginField_Enum::bound_enum = nullptr

Pointer to the global enum field this enum is bound to.

◆ bound_enum_id

std::string BlamPluginField_Enum::bound_enum_id = ""

The ID of the global enum field this enum is bound to.

◆ bound_to_global_enum

bool BlamPluginField_Enum::bound_to_global_enum = false

Whether or not this enum is bound to an existing global enum.

◆ define_in_global_scope

bool BlamPluginField_Enum::define_in_global_scope = false

Whether or not this enum is defined in the global C++ scope.

◆ global_enum_name

std::string BlamPluginField_Enum::global_enum_name = ""

The name of this enum in the global C++ scope.

◆ options

std::vector<BlamEnumFieldOption> BlamPluginField_Enum::options

The list of options within the enum.


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