30 m_type( aType ), m_lineNumber( aLineNumber )
35 m_type( aType ), m_lineNumber( 1 )
46 return &
static_cast< SEXPR_LIST const *
>(
this)->m_children;
56 return static_cast< SEXPR_LIST const *
>(
this)->m_children[aIndex];
78 return static_cast< SEXPR_LIST const *
>(
this)->m_children.size();
88 return static_cast< SEXPR_STRING const *
>(
this)->m_value;
93 return static_cast< int >( GetLongInteger() );
112 return static_cast< SEXPR_DOUBLE const *
>(
this)->m_value;
126 return static_cast< float >( GetDouble() );
133 std::string err_msg(
"GetSymbol(): SEXPR is not a symbol type! error line ");
134 err_msg += std::to_string( GetLineNumber() );
138 return static_cast< SEXPR_SYMBOL const *
>(
this)->m_value;
163 result.append( aLevel * 2,
' ' );
169 for( std::vector<SEXPR *>::const_iterator it = list->begin(); it != list->end(); ++it )
171 result += (*it)->AsString( aLevel );
173 if( it != list->end() - 1 )
182 else if( IsString() )
184 result +=
"\"" + GetString() +
"\"";
186 else if( IsSymbol() )
188 result += GetSymbol();
190 else if( IsInteger() )
192 std::stringstream out;
196 else if( IsDouble() )
198 std::stringstream out;
199 out << std::setprecision( 16 ) << GetDouble();
289 if( child->IsInteger() )
296 throw std::invalid_argument(
"SEXPR is not a integer type!" );
306 if( child->IsString() || child->IsSymbol() )
313 throw std::invalid_argument(
"SEXPR is not a string type!" );
323 if( child->IsInteger() )
330 throw std::invalid_argument(
"SEXPR is not a long integer type!");
339 if( child->IsDouble() )
346 throw std::invalid_argument(
"SEXPR is not a float type!" );
356 if( child->IsDouble() )
363 throw std::invalid_argument(
"SEXPR is not a double type!" );
375 if( child->IsSymbol() )
377 is.
_String = child->GetSymbol();
382 throw std::invalid_argument(
"operator>>: SEXPR is not a symbol type!" );
387 if( child->IsString() )
389 is.
_String = child->GetString();
394 throw std::invalid_argument(
"SEXPR is not a string type!" );
412 for( i = 0; i < num_args; i++ )
429 if( child->IsSymbol() )
433 else if( child->IsString() )
456 if( child->IsSymbol() )
458 if( child->GetSymbol() != arg.
str_value )
463 else if( child->IsString() )
465 if( child->GetString() != arg.
str_value )
473 throw std::invalid_argument(
"unsupported argument type, this shouldn't have happened" );
489 for( i = 0; i < num_args; i++ )
526 throw std::invalid_argument(
"unexpected argument type, this shouldn't have happened" );
virtual void DeserializeSEXPR(SEXPR &sexp)
virtual SEXPR * SerializeSEXPR() const
union SEXPR::SEXPR_CHILDREN_ARG::@43 u
void doAddChildren(const SEXPR_CHILDREN_ARG *args, size_t num_args)
size_t doScan(const SEXPR_SCAN_ARG *args, size_t num_args)
union SEXPR::SEXPR_SCAN_ARG::@42 u
SEXPR_VECTOR const * GetChildren() const
void AddChild(SEXPR *aChild)
std::string const & GetSymbol() const
std::string AsString(size_t aLevel=0) const
int32_t GetInteger() const
size_t GetNumberOfChildren() const
int64_t GetLongInteger() const
std::string const & GetString() const
SEXPR * GetChild(size_t aIndex) const
SEXPR_LIST & operator>>(SEXPR_LIST &input, ISEXPRABLE &obj)
std::vector< class SEXPR * > SEXPR_VECTOR
@ SEXPR_TYPE_ATOM_INTEGER
const std::string & _String