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

Represents a parsed C pointer array declaration. More...

#include <array_declaration.hpp>

Public Member Functions

 ArrayDeclaration (std::string name, std::vector< std::string > elements, SourcePosition position)
 Constructs an ArrayDeclaration.
 
const std::string & name () const
 Returns the array variable name.
 
const std::vector< std::string > & elements () const
 Returns the initializer list elements.
 
const SourcePositionposition () const
 Returns the source position of the array name.
 

Detailed Description

Represents a parsed C pointer array declaration.

ArrayDeclaration captures the structure of C pointer array declarations like:

const u16 *const gTilesetAnims_General_Flower[] = {
gTilesetAnims_General_Flower_Frame0,
gTilesetAnims_General_Flower_Frame1,
gTilesetAnims_General_Flower_Frame2
};

The parser extracts the array name and all identifier elements from the initializer list. This is used by AnimCodeParser to extract animation frame sequences from tileset animation code.

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

Definition at line 29 of file array_declaration.hpp.

Constructor & Destructor Documentation

◆ ArrayDeclaration()

porytiles::ArrayDeclaration::ArrayDeclaration ( std::string  name,
std::vector< std::string >  elements,
SourcePosition  position 
)
inline

Constructs an ArrayDeclaration.

Parameters
nameThe array variable name
elementsThe identifier elements from the initializer list
positionThe source position of the array name

Definition at line 38 of file array_declaration.hpp.

Member Function Documentation

◆ elements()

const std::vector< std::string > & porytiles::ArrayDeclaration::elements ( ) const
inline

Returns the initializer list elements.

Returns the identifiers from the array initializer in declaration order. For frame arrays, these are typically frame pointer names like "gTilesetAnims_General_Flower_Frame0".

Returns
A const reference to the element vector

Definition at line 62 of file array_declaration.hpp.

◆ name()

const std::string & porytiles::ArrayDeclaration::name ( ) const
inline

Returns the array variable name.

Returns
A const reference to the name

Definition at line 48 of file array_declaration.hpp.

◆ position()

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

Returns the source position of the array name.

Returns
A const reference to the source position

Definition at line 72 of file array_declaration.hpp.


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