47 return &
static_cast< SEXPR_LIST const *
>(
this)->m_children;
57 return static_cast< SEXPR_LIST const *
>(
this)->m_children[aIndex];
79 return static_cast< SEXPR_LIST const *
>(
this)->m_children.size();
89 return static_cast< SEXPR_STRING const *
>(
this)->m_value;
113 return static_cast< SEXPR_DOUBLE const *
>(
this)->m_value;
127 return static_cast< float >(
GetDouble() );
134 std::string err_msg(
"GetSymbol(): SEXPR is not a symbol type! error line ");
139 return static_cast< SEXPR_SYMBOL const *
>(
this)->m_value;
164 result.append( aLevel * 2,
' ' );
170 for( std::vector<SEXPR *>::const_iterator it = list->begin(); it != list->end(); ++it )
172 result += (*it)->AsString( aLevel );
174 if( it != list->end() - 1 )
193 std::stringstream out;
204 out = fmt::format(
"{:.10g}",
GetDouble() );
207 if( out.find(
"e") != std::string::npos )
209 out = fmt::format(
"{:.10f}",
GetDouble() );
212 while( !out.empty() && out[out.size() - 1] ==
'0' )
216 if( out.size() > 1 && out[out.size() - 1] ==
'.' )
293 list.AddChild(
res );
309 if( child->IsInteger() )
311 inte = child->GetInteger();
316 throw std::invalid_argument(
"SEXPR is not a integer type!" );
326 if( child->IsString() || child->IsSymbol() )
328 str = child->GetString();
333 throw std::invalid_argument(
"SEXPR is not a string type!" );
343 if( child->IsInteger() )
345 lint = child->GetLongInteger();
350 throw std::invalid_argument(
"SEXPR is not a long integer type!");
359 if( child->IsDouble() )
361 fl = child->GetFloat();
366 throw std::invalid_argument(
"SEXPR is not a float type!" );
376 if( child->IsDouble() )
378 dbl = child->GetDouble();
383 throw std::invalid_argument(
"SEXPR is not a double type!" );
395 if( child->IsSymbol() )
397 is.
_String = child->GetSymbol();
402 throw std::invalid_argument(
"operator>>: SEXPR is not a symbol type!" );
407 if( child->IsString() )
409 is.
_String = child->GetString();
414 throw std::invalid_argument(
"SEXPR is not a string type!" );
432 for( i = 0; i < num_args; i++ )
449 if( child->IsSymbol() )
453 else if( child->IsString() )
476 if( child->IsSymbol() )
478 if( child->GetSymbol() != arg.
str_value )
483 else if( child->IsString() )
485 if( child->GetString() != arg.
str_value )
493 throw std::invalid_argument(
"unsupported argument type, this shouldn't have happened" );
509 for( i = 0; i < num_args; i++ )
546 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::@140153117255347061025000322060345331135151360226 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::@066014047110022234005207275010144102035233327174 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(SEXPR_TYPE aType, size_t aLineNumber)
SEXPR * GetChild(size_t aIndex) const
size_t GetLineNumber() const
SEXPR_LIST & operator>>(SEXPR_LIST &input, ISEXPRABLE &obj)
SEXPR_LIST & operator<<(SEXPR_LIST &list, const ISEXPRABLE &obj)
std::vector< class SEXPR * > SEXPR_VECTOR
@ SEXPR_TYPE_ATOM_INTEGER
const std::string & _String
wxString result
Test unit parsing edge cases and error handling.