29 m_type( aType ), m_lineNumber( aLineNumber )
34 m_type( aType ), m_lineNumber( 1 )
45 return &
static_cast< SEXPR_LIST const *
>(
this)->m_children;
55 return static_cast< SEXPR_LIST const *
>(
this)->m_children[aIndex];
77 return static_cast< SEXPR_LIST const *
>(
this)->m_children.size();
87 return static_cast< SEXPR_STRING const *
>(
this)->m_value;
92 return static_cast< int >( GetLongInteger() );
111 return static_cast< SEXPR_DOUBLE const *
>(
this)->m_value;
125 return static_cast< float >( GetDouble() );
132 std::string err_msg(
"GetSymbol(): SEXPR is not a symbol type! error line ");
133 err_msg += std::to_string( GetLineNumber() );
137 return static_cast< SEXPR_SYMBOL const *
>(
this)->m_value;
162 result.append( aLevel * 2,
' ' );
168 for( std::vector<SEXPR *>::const_iterator it = list->begin(); it != list->end(); ++it )
170 result += (*it)->AsString( aLevel );
172 if( it != list->end() - 1 )
181 else if( IsString() )
183 result +=
"\"" + GetString() +
"\"";
185 else if( IsSymbol() )
187 result += GetSymbol();
189 else if( IsInteger() )
191 std::stringstream out;
195 else if( IsDouble() )
197 std::stringstream out;
198 out << std::setprecision( 16 ) << GetDouble();
288 if( child->IsInteger() )
295 throw std::invalid_argument(
"SEXPR is not a integer type!" );
305 if( child->IsString() || child->IsSymbol() )
312 throw std::invalid_argument(
"SEXPR is not a string type!" );
322 if( child->IsInteger() )
329 throw std::invalid_argument(
"SEXPR is not a long integer type!");
338 if( child->IsDouble() )
345 throw std::invalid_argument(
"SEXPR is not a float type!" );
355 if( child->IsDouble() )
362 throw std::invalid_argument(
"SEXPR is not a double type!" );
374 if( child->IsSymbol() )
376 is.
_String = child->GetSymbol();
381 throw std::invalid_argument(
"operator>>: SEXPR is not a symbol type!" );
386 if( child->IsString() )
388 is.
_String = child->GetString();
393 throw std::invalid_argument(
"SEXPR is not a string type!" );
411 for( i = 0; i < num_args; i++ )
428 if( child->IsSymbol() )
432 else if( child->IsString() )
455 if( child->IsSymbol() )
457 if( child->GetSymbol() != arg.
str_value )
462 else if( child->IsString() )
464 if( child->GetString() != arg.
str_value )
472 throw std::invalid_argument(
"unsupported argument type, this shouldn't have happened" );
488 for( i = 0; i < num_args; i++ )
525 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