SRD parser - Access value as a RW reference

This commit is contained in:
Emmanuel BENOîT 2017-11-17 15:44:49 +01:00
parent 1ce16d63cb
commit 5db261909a
2 changed files with 26 additions and 6 deletions

View file

@ -129,7 +129,8 @@ struct T_SRDParserPrivate_
uint32_t eid );
// Get the data at the top of the execution stack
T_Variant const& getExecStackTop( ) const;
T_Variant const& getExecStackTop( ) const noexcept;
T_Variant& getExecStackTop( ) noexcept;
// Public methods
void start( T_SRDErrors & errors );
@ -434,7 +435,14 @@ bool T_SRDParserPrivate_::checkRuleEnd( T_SRDErrors& errors , T_SRDToken const&
/*----------------------------------------------------------------------------*/
inline T_Variant const& T_SRDParserPrivate_::getExecStackTop( ) const
inline T_Variant const& T_SRDParserPrivate_::getExecStackTop( ) const noexcept
{
assert( execStack_.size( ) != 0 );
const auto stackLast( execStack_.size( ) - 1 );
return execStack_[ stackLast ];
}
inline T_Variant& T_SRDParserPrivate_::getExecStackTop( ) noexcept
{
assert( execStack_.size( ) != 0 );
const auto stackLast( execStack_.size( ) - 1 );
@ -680,7 +688,12 @@ bool T_SRDParser::handleFlushToken( ) const noexcept
/*----------------------------------------------------------------------------*/
T_Variant const& T_SRDParser::getExecStackTop( ) const
T_Variant const& T_SRDParser::getExecStackTop( ) const noexcept
{
return p< T_SRDParserPrivate_ >( ).getExecStackTop( );
}
T_Variant& T_SRDParser::getExecStackTop( ) noexcept
{
return p< T_SRDParserPrivate_ >( ).getExecStackTop( );
}