Porytiles
Loading...
Searching...
No Matches
porytiles::StructVariableDeclaration Class Reference

Represents a parsed C struct variable declaration. More...

#include <struct_variable_declaration.hpp>

Public Member Functions

 StructVariableDeclaration (std::string struct_type, std::string variable_name, SourcePosition position)
 Constructs a StructVariableDeclaration.
 
const std::string & struct_type () const
 Returns the struct type name.
 
const std::string & variable_name () const
 Returns the variable name.
 
const SourcePositionposition () const
 Returns the source position of the variable name.
 

Detailed Description

Represents a parsed C struct variable declaration.

StructVariableDeclaration captures the structure of C struct variable declarations like:

const struct Tileset gTileset_General = {
.isCompressed = TRUE,
.isSecondary = FALSE,
.tiles = gTilesetTiles_General,
...
};
A complete tileset containing both Porytiles and Porymap components.
Definition tileset.hpp:14

The parser extracts the struct type name and variable name. The initializer body contents are not captured as only the variable name is needed for tileset discovery. This is used by ProjectTilesetMetadataProvider to extract tileset names from headers.h files.

Invariant
struct_type_ is never empty
variable_name_ is never empty
position_ contains valid 1-based line and column numbers

Definition at line 31 of file struct_variable_declaration.hpp.

Constructor & Destructor Documentation

◆ StructVariableDeclaration()

porytiles::StructVariableDeclaration::StructVariableDeclaration ( std::string  struct_type,
std::string  variable_name,
SourcePosition  position 
)
inline

Constructs a StructVariableDeclaration.

Parameters
struct_typeThe struct type name (e.g., "Tileset")
variable_nameThe variable name (e.g., "gTileset_General")
positionThe source position of the variable name

Definition at line 40 of file struct_variable_declaration.hpp.

Member Function Documentation

◆ position()

const SourcePosition & porytiles::StructVariableDeclaration::position ( ) const
inline

Returns the source position of the variable name.

Returns
A const reference to the source position

Definition at line 70 of file struct_variable_declaration.hpp.

◆ struct_type()

const std::string & porytiles::StructVariableDeclaration::struct_type ( ) const
inline

Returns the struct type name.

Returns
A const reference to the struct type name (e.g., "Tileset")

Definition at line 50 of file struct_variable_declaration.hpp.

◆ variable_name()

const std::string & porytiles::StructVariableDeclaration::variable_name ( ) const
inline

Returns the variable name.

Returns
A const reference to the variable name (e.g., "gTileset_General")

Definition at line 60 of file struct_variable_declaration.hpp.


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