|
Porytiles
|
Represents a single member (constant) within a C enum declaration. More...
#include <enum_member.hpp>
Public Member Functions | |
| EnumMember (std::string name, std::int64_t value, SourcePosition position) | |
| Constructs an EnumMember with an implicit (counter-based) value. | |
| EnumMember (std::string name, std::int64_t value, bool has_explicit_value, SourcePosition position) | |
| Constructs an EnumMember with explicit value flag. | |
| const std::string & | name () const |
| Returns the member name. | |
| std::int64_t | int_value () const |
| Returns the resolved integer value. | |
| bool | has_explicit_value () const |
| Checks if this member had an explicit value assignment. | |
| const SourcePosition & | position () const |
| Returns the source position of the member. | |
Represents a single member (constant) within a C enum declaration.
EnumMember captures the name and resolved value of an enum constant. Values may be explicitly assigned (e.g., FOO = 10) or implicitly assigned via counter (sequential from 0 or previous value + 1). The original source position is preserved for error reporting.
Example members this class can represent:
Definition at line 27 of file enum_member.hpp.
|
inline |
Constructs an EnumMember with an implicit (counter-based) value.
| name | The member name |
| value | The resolved integer value |
| position | The source position of the member |
Definition at line 36 of file enum_member.hpp.
|
inline |
Constructs an EnumMember with explicit value flag.
| name | The member name |
| value | The resolved integer value |
| has_explicit_value | True if value was explicitly assigned with = |
| position | The source position of the member |
Definition at line 49 of file enum_member.hpp.
|
inline |
Checks if this member had an explicit value assignment.
= Definition at line 79 of file enum_member.hpp.
|
inline |
Returns the resolved integer value.
Definition at line 69 of file enum_member.hpp.
|
inline |
Returns the member name.
Definition at line 59 of file enum_member.hpp.
|
inline |
Returns the source position of the member.
Definition at line 89 of file enum_member.hpp.