KiCad PCB EDA Suite
SEXPR::SEXPR_LIST Class Reference

#include <sexpr.h>

Inheritance diagram for SEXPR::SEXPR_LIST:
SEXPR::SEXPR

Public Member Functions

 SEXPR_LIST ()
 
 SEXPR_LIST (int aLineNumber)
 
template<typename... Args>
 SEXPR_LIST (const Args &... args)
 
template<typename... Args>
size_t Scan (const Args &... args)
 
template<typename... Args>
void AddChildren (const Args &... args)
 
virtual ~SEXPR_LIST ()
 
bool IsList () const
 
bool IsSymbol () const
 
bool IsString () const
 
bool IsDouble () const
 
bool IsInteger () const
 
void AddChild (SEXPR *aChild)
 
SEXPR_VECTOR const * GetChildren () const
 
SEXPRGetChild (size_t aIndex) const
 
size_t GetNumberOfChildren () const
 
int64_t GetLongInteger () const
 
int32_t GetInteger () const
 
float GetFloat () const
 
double GetDouble () const
 
std::string const & GetString () const
 
std::string const & GetSymbol () const
 
SEXPR_LISTGetList ()
 
std::string AsString (size_t aLevel=0) const
 
size_t GetLineNumber () const
 

Public Attributes

SEXPR_VECTOR m_children
 

Protected Attributes

SEXPR_TYPE m_type
 
size_t m_lineNumber
 

Private Member Functions

size_t doScan (const SEXPR_SCAN_ARG *args, size_t num_args)
 
void doAddChildren (const SEXPR_CHILDREN_ARG *args, size_t num_args)
 

Private Attributes

int m_inStreamChild
 

Friends

SEXPR_LISToperator<< (SEXPR_LIST &list, double value)
 
SEXPR_LISToperator<< (SEXPR_LIST &list, float value)
 
SEXPR_LISToperator<< (SEXPR_LIST &list, int64_t value)
 
SEXPR_LISToperator<< (SEXPR_LIST &list, int32_t value)
 
SEXPR_LISToperator<< (SEXPR_LIST &list, std::string value)
 
SEXPR_LISToperator<< (SEXPR_LIST &list, const _OUT_STRING setting)
 
SEXPR_LISToperator<< (SEXPR_LIST &list, const ISEXPRABLE &obj)
 
SEXPR_LISToperator<< (SEXPR_LIST &list, SEXPR_LIST *list2)
 
SEXPR_LISToperator<< (SEXPR_LIST &list, SEXPR *obj)
 
SEXPR_LISToperator>> (SEXPR_LIST &input, ISEXPRABLE &obj)
 
SEXPR_LISToperator>> (SEXPR_LIST &input, std::string &str)
 
SEXPR_LISToperator>> (SEXPR_LIST &input, int32_t &inte)
 
SEXPR_LISToperator>> (SEXPR_LIST &input, int64_t &inte)
 
SEXPR_LISToperator>> (SEXPR_LIST &input, float &inte)
 
SEXPR_LISToperator>> (SEXPR_LIST &input, double &inte)
 
SEXPR_LISToperator>> (SEXPR_LIST &input, const _IN_STRING is)
 

Detailed Description

Definition at line 242 of file sexpr.h.

Constructor & Destructor Documentation

◆ SEXPR_LIST() [1/3]

SEXPR::SEXPR_LIST::SEXPR_LIST ( )
inline

Definition at line 245 of file sexpr.h.

SEXPR(SEXPR_TYPE aType, size_t aLineNumber)
Definition: sexpr.cpp:28
int m_inStreamChild
Definition: sexpr.h:293

◆ SEXPR_LIST() [2/3]

SEXPR::SEXPR_LIST::SEXPR_LIST ( int  aLineNumber)
inline

Definition at line 247 of file sexpr.h.

247  :
248  SEXPR( SEXPR_TYPE::SEXPR_TYPE_LIST, aLineNumber), m_inStreamChild( 0 ) {};
SEXPR(SEXPR_TYPE aType, size_t aLineNumber)
Definition: sexpr.cpp:28
int m_inStreamChild
Definition: sexpr.h:293

◆ SEXPR_LIST() [3/3]

template<typename... Args>
SEXPR::SEXPR_LIST::SEXPR_LIST ( const Args &...  args)
inline

Definition at line 251 of file sexpr.h.

251  :
253  {
254  AddChildren(args...);
255  };
SEXPR(SEXPR_TYPE aType, size_t aLineNumber)
Definition: sexpr.cpp:28
int m_inStreamChild
Definition: sexpr.h:293
void AddChildren(const Args &... args)
Definition: sexpr.h:267

References AddChildren().

◆ ~SEXPR_LIST()

SEXPR::SEXPR_LIST::~SEXPR_LIST ( )
virtual

Definition at line 205 of file sexpr.cpp.

206  {
207  for( auto child : m_children )
208  {
209  delete child;
210  }
211 
212  m_children.clear();
213  }
SEXPR_VECTOR m_children
Definition: sexpr.h:255

References m_children.

Member Function Documentation

◆ AddChild()

void SEXPR::SEXPR::AddChild ( SEXPR aChild)
inherited

Definition at line 58 of file sexpr.cpp.

59  {
61  {
62  throw INVALID_TYPE_EXCEPTION("SEXPR is not a list type!");
63  }
64 
65  SEXPR_LIST* list = static_cast< SEXPR_LIST * >( this );
66 
67  list->m_children.push_back( aChild );
68  }
SEXPR_TYPE m_type
Definition: sexpr.h:69

References m_children, and SEXPR::SEXPR_TYPE_LIST.

Referenced by BOOST_AUTO_TEST_CASE(), doAddChildren(), and SEXPR::operator<<().

◆ AddChildren()

template<typename... Args>
void SEXPR::SEXPR_LIST::AddChildren ( const Args &...  args)
inline

Definition at line 267 of file sexpr.h.

268  {
269  SEXPR_CHILDREN_ARG arg_array[] = { args... };
270  doAddChildren( arg_array, sizeof...( Args ) );
271  }
void doAddChildren(const SEXPR_CHILDREN_ARG *args, size_t num_args)
Definition: sexpr.cpp:484

References doAddChildren().

Referenced by SEXPR_LIST().

◆ AsString()

std::string SEXPR::SEXPR::AsString ( size_t  aLevel = 0) const
inherited

Definition at line 151 of file sexpr.cpp.

152  {
153  std::string result;
154 
155  if( IsList() )
156  {
157  if( aLevel != 0 )
158  {
159  result = "\n";
160  }
161 
162  result.append( aLevel * 2, ' ' );
163  aLevel++;
164  result += "(";
165 
166  SEXPR_VECTOR const* list = GetChildren();
167 
168  for( std::vector<SEXPR *>::const_iterator it = list->begin(); it != list->end(); ++it )
169  {
170  result += (*it)->AsString( aLevel );
171 
172  if( it != list->end() - 1 )
173  {
174  result += " ";
175  }
176  }
177  result += ")";
178 
179  aLevel--;
180  }
181  else if( IsString() )
182  {
183  result += "\"" + GetString() + "\"";
184  }
185  else if( IsSymbol() )
186  {
187  result += GetSymbol();
188  }
189  else if( IsInteger() )
190  {
191  std::stringstream out;
192  out << GetInteger();
193  result += out.str();
194  }
195  else if( IsDouble() )
196  {
197  std::stringstream out;
198  out << std::setprecision( 16 ) << GetDouble();
199  result += out.str();
200  }
201 
202  return result;
203  }
std::vector< class SEXPR * > SEXPR_VECTOR
Definition: sexpr.h:43
bool IsString() const
Definition: sexpr.h:51
std::string const & GetString() const
Definition: sexpr.cpp:80
bool IsSymbol() const
Definition: sexpr.h:50
bool IsList() const
Definition: sexpr.h:49
bool IsDouble() const
Definition: sexpr.h:52
int32_t GetInteger() const
Definition: sexpr.cpp:90
double GetDouble() const
Definition: sexpr.cpp:105
std::string const & GetSymbol() const
Definition: sexpr.cpp:128
SEXPR_VECTOR const * GetChildren() const
Definition: sexpr.cpp:38
bool IsInteger() const
Definition: sexpr.h:53

Referenced by BOOST_TEST_PRINT_NAMESPACE_OPEN::print_log_value< SEXPR::SEXPR >::operator()(), and KI_TEST::SexprConvertsToString().

◆ doAddChildren()

void SEXPR::SEXPR_LIST::doAddChildren ( const SEXPR_CHILDREN_ARG args,
size_t  num_args 
)
private

Definition at line 484 of file sexpr.cpp.

485  {
486  size_t i = 0;
487 
488  for( i = 0; i < num_args; i++ )
489  {
490  const SEXPR_CHILDREN_ARG& arg = args[i];
491 
492  if( arg.type == SEXPR_CHILDREN_ARG::Type::DOUBLE )
493  {
494  AddChild( new SEXPR_DOUBLE( arg.u.dbl_value ) );
495  }
496  else if( arg.type == SEXPR_CHILDREN_ARG::Type::INT )
497  {
498  AddChild( new SEXPR_INTEGER( arg.u.int_value ) );
499  }
500  else if( arg.type == SEXPR_CHILDREN_ARG::Type::LONGINT )
501  {
502  AddChild( new SEXPR_INTEGER( arg.u.lint_value ) );
503  }
504  else if( arg.type == SEXPR_CHILDREN_ARG::Type::STRING )
505  {
506  AddChild( new SEXPR_STRING( arg.str_value ) );
507  }
508  else if( arg.type == SEXPR_CHILDREN_ARG::Type::SEXPR_ATOM )
509  {
510  AddChild( arg.u.sexpr_ptr );
511  }
512  else if( arg.type == SEXPR_CHILDREN_ARG::Type::SEXPR_STRING )
513  {
514  if( arg.u.symbol )
515  {
516  AddChild( new SEXPR_SYMBOL( arg.str_value ) );
517  }
518  else
519  {
520  AddChild( new SEXPR_STRING( arg.str_value ) );
521  }
522  }
523  else
524  {
525  throw std::invalid_argument( "unexpected argument type, this shouldn't have happened" );
526  }
527  }
528  }
void AddChild(SEXPR *aChild)
Definition: sexpr.cpp:58

References SEXPR::SEXPR::AddChild(), SEXPR::SEXPR_CHILDREN_ARG::dbl_value, SEXPR::SEXPR_CHILDREN_ARG::DOUBLE, SEXPR::SEXPR_CHILDREN_ARG::INT, SEXPR::SEXPR_CHILDREN_ARG::int_value, SEXPR::SEXPR_CHILDREN_ARG::lint_value, SEXPR::SEXPR_CHILDREN_ARG::LONGINT, SEXPR::SEXPR_CHILDREN_ARG::SEXPR_ATOM, SEXPR::SEXPR_CHILDREN_ARG::sexpr_ptr, SEXPR::SEXPR_CHILDREN_ARG::SEXPR_STRING, SEXPR::SEXPR_CHILDREN_ARG::str_value, SEXPR::SEXPR_CHILDREN_ARG::STRING, SEXPR::SEXPR_CHILDREN_ARG::symbol, SEXPR::SEXPR_CHILDREN_ARG::type, and SEXPR::SEXPR_CHILDREN_ARG::u.

Referenced by AddChildren().

◆ doScan()

size_t SEXPR::SEXPR_LIST::doScan ( const SEXPR_SCAN_ARG args,
size_t  num_args 
)
private

Definition at line 407 of file sexpr.cpp.

408  {
409  size_t i = 0;
410 
411  for( i = 0; i < num_args; i++ )
412  {
413  SEXPR* child = GetChild( i );
414  const SEXPR_SCAN_ARG& arg = args[i];
415 
416  try
417  {
418  if( arg.type == SEXPR_SCAN_ARG::Type::DOUBLE )
419  {
420  *arg.u.dbl_value = child->GetDouble();
421  }
422  else if( arg.type == SEXPR_SCAN_ARG::Type::INT )
423  {
424  *arg.u.dbl_value = child->GetInteger();
425  }
426  else if( arg.type == SEXPR_SCAN_ARG::Type::STRING )
427  {
428  if( child->IsSymbol() )
429  {
430  *arg.u.str_value = child->GetSymbol();
431  }
432  else if( child->IsString() )
433  {
434  *arg.u.str_value = child->GetString();
435  }
436  }
437  else if( arg.type == SEXPR_SCAN_ARG::Type::LONGINT )
438  {
439  *arg.u.lint_value = child->GetLongInteger();
440  }
441  else if( arg.type == SEXPR_SCAN_ARG::Type::SEXPR_STRING )
442  {
443  if( arg.u.sexpr_str->_Symbol )
444  {
445  arg.u.sexpr_str->_String = child->GetSymbol();
446  }
447  else
448  {
449  arg.u.sexpr_str->_String = child->GetString();
450  }
451 
452  }
453  else if( arg.type == SEXPR_SCAN_ARG::Type::STRING_COMP )
454  {
455  if( child->IsSymbol() )
456  {
457  if( child->GetSymbol() != arg.str_value )
458  {
459  return i;
460  }
461  }
462  else if( child->IsString() )
463  {
464  if( child->GetString() != arg.str_value )
465  {
466  return i;
467  }
468  }
469  }
470  else
471  {
472  throw std::invalid_argument( "unsupported argument type, this shouldn't have happened" );
473  }
474  }
475  catch( const INVALID_TYPE_EXCEPTION& )
476  {
477  return i;
478  }
479  }
480 
481  return i;
482  }
SEXPR * GetChild(size_t aIndex) const
Definition: sexpr.cpp:48

References SEXPR::_IN_STRING::_String, SEXPR::_IN_STRING::_Symbol, SEXPR::SEXPR_SCAN_ARG::dbl_value, SEXPR::SEXPR_SCAN_ARG::DOUBLE, SEXPR::SEXPR::GetChild(), SEXPR::SEXPR_SCAN_ARG::INT, SEXPR::SEXPR_SCAN_ARG::lint_value, SEXPR::SEXPR_SCAN_ARG::LONGINT, SEXPR::SEXPR_SCAN_ARG::sexpr_str, SEXPR::SEXPR_SCAN_ARG::SEXPR_STRING, SEXPR::SEXPR_SCAN_ARG::str_value, SEXPR::SEXPR_SCAN_ARG::STRING, SEXPR::SEXPR_SCAN_ARG::STRING_COMP, SEXPR::SEXPR_SCAN_ARG::type, and SEXPR::SEXPR_SCAN_ARG::u.

Referenced by Scan().

◆ GetChild()

SEXPR * SEXPR::SEXPR::GetChild ( size_t  aIndex) const
inherited

Definition at line 48 of file sexpr.cpp.

49  {
51  {
52  throw INVALID_TYPE_EXCEPTION("SEXPR is not a list type!");
53  }
54 
55  return static_cast< SEXPR_LIST const * >(this)->m_children[aIndex];
56  }
SEXPR_TYPE m_type
Definition: sexpr.h:69

References SEXPR::SEXPR_TYPE_LIST.

Referenced by BOOST_AUTO_TEST_CASE(), doScan(), SEXPR::operator>>(), and traverseSEXPR().

◆ GetChildren()

SEXPR_VECTOR const * SEXPR::SEXPR::GetChildren ( ) const
inherited

Definition at line 38 of file sexpr.cpp.

39  {
41  {
42  throw INVALID_TYPE_EXCEPTION("SEXPR is not a list type!");
43  }
44 
45  return &static_cast< SEXPR_LIST const * >(this)->m_children;
46  }
SEXPR_TYPE m_type
Definition: sexpr.h:69

References SEXPR::SEXPR_TYPE_LIST.

◆ GetDouble()

double SEXPR::SEXPR::GetDouble ( ) const
inherited

Definition at line 105 of file sexpr.cpp.

106  {
107  // we may end up parsing "intended" floats/doubles as ints
108  // so here we allow silent casting back to doubles
110  {
111  return static_cast< SEXPR_DOUBLE const * >(this)->m_value;
112  }
114  {
115  return static_cast< SEXPR_INTEGER const * >(this)->m_value;
116  }
117  else
118  {
119  throw INVALID_TYPE_EXCEPTION("SEXPR is not a double type!");
120  }
121  }
SEXPR_TYPE m_type
Definition: sexpr.h:69

References SEXPR::SEXPR_TYPE_ATOM_DOUBLE, and SEXPR::SEXPR_TYPE_ATOM_INTEGER.

Referenced by KI_TEST::SexprIsDoubleWithValue().

◆ GetFloat()

float SEXPR::SEXPR::GetFloat ( ) const
inherited

Definition at line 123 of file sexpr.cpp.

124  {
125  return static_cast< float >( GetDouble() );
126  }
double GetDouble() const
Definition: sexpr.cpp:105

◆ GetInteger()

int32_t SEXPR::SEXPR::GetInteger ( ) const
inherited

Definition at line 90 of file sexpr.cpp.

91  {
92  return static_cast< int >( GetLongInteger() );
93  }
int64_t GetLongInteger() const
Definition: sexpr.cpp:95

◆ GetLineNumber()

size_t SEXPR::SEXPR::GetLineNumber ( ) const
inlineinherited

Definition at line 66 of file sexpr.h.

66 { return m_lineNumber; }
size_t m_lineNumber
Definition: sexpr.h:72

◆ GetList()

SEXPR_LIST * SEXPR::SEXPR::GetList ( )
inherited

Definition at line 141 of file sexpr.cpp.

142  {
144  {
145  throw INVALID_TYPE_EXCEPTION("SEXPR is not a list type!");
146  }
147 
148  return static_cast< SEXPR_LIST* >(this);
149  }
SEXPR_TYPE m_type
Definition: sexpr.h:69

References SEXPR::SEXPR_TYPE_LIST.

◆ GetLongInteger()

int64_t SEXPR::SEXPR::GetLongInteger ( ) const
inherited

Definition at line 95 of file sexpr.cpp.

96  {
98  {
99  throw INVALID_TYPE_EXCEPTION("SEXPR is not a integer type!");
100  }
101 
102  return static_cast< SEXPR_INTEGER const * >(this)->m_value;
103  }
SEXPR_TYPE m_type
Definition: sexpr.h:69

References SEXPR::SEXPR_TYPE_ATOM_INTEGER.

Referenced by KI_TEST::SexprIsIntegerWithValue().

◆ GetNumberOfChildren()

size_t SEXPR::SEXPR::GetNumberOfChildren ( ) const
inherited

Definition at line 70 of file sexpr.cpp.

71  {
73  {
74  throw INVALID_TYPE_EXCEPTION("SEXPR is not a list type!");
75  }
76 
77  return static_cast< SEXPR_LIST const * >(this)->m_children.size();
78  }
SEXPR_TYPE m_type
Definition: sexpr.h:69

References SEXPR::SEXPR_TYPE_LIST.

Referenced by KI_TEST::SexprIsListOfLength(), and traverseSEXPR().

◆ GetString()

std::string const & SEXPR::SEXPR::GetString ( ) const
inherited

Definition at line 80 of file sexpr.cpp.

81  {
83  {
84  throw INVALID_TYPE_EXCEPTION("SEXPR is not a string type!");
85  }
86 
87  return static_cast< SEXPR_STRING const * >(this)->m_value;
88  }
SEXPR_TYPE m_type
Definition: sexpr.h:69

References SEXPR::SEXPR_TYPE_ATOM_STRING.

Referenced by KI_TEST::SexprIsStringWithValue().

◆ GetSymbol()

std::string const & SEXPR::SEXPR::GetSymbol ( ) const
inherited

Definition at line 128 of file sexpr.cpp.

129  {
131  {
132  std::string err_msg( "GetSymbol(): SEXPR is not a symbol type! error line ");
133  err_msg += std::to_string( GetLineNumber() );
134  throw INVALID_TYPE_EXCEPTION( err_msg );
135  }
136 
137  return static_cast< SEXPR_SYMBOL const * >(this)->m_value;
138  }
size_t GetLineNumber() const
Definition: sexpr.h:66
SEXPR_TYPE m_type
Definition: sexpr.h:69

References SEXPR::SEXPR_TYPE_ATOM_SYMBOL.

Referenced by KI_TEST::SexprIsSymbolWithValue().

◆ IsDouble()

bool SEXPR::SEXPR::IsDouble ( ) const
inlineinherited

◆ IsInteger()

bool SEXPR::SEXPR::IsInteger ( ) const
inlineinherited

◆ IsList()

bool SEXPR::SEXPR::IsList ( ) const
inlineinherited

Definition at line 49 of file sexpr.h.

References SEXPR::SEXPR_TYPE_LIST.

Referenced by KI_TEST::getType(), and traverseSEXPR().

◆ IsString()

bool SEXPR::SEXPR::IsString ( ) const
inlineinherited

◆ IsSymbol()

bool SEXPR::SEXPR::IsSymbol ( ) const
inlineinherited

◆ Scan()

template<typename... Args>
size_t SEXPR::SEXPR_LIST::Scan ( const Args &...  args)
inline

Definition at line 260 of file sexpr.h.

261  {
262  SEXPR_SCAN_ARG arg_array[] = { args... };
263  return doScan( arg_array, sizeof...( Args ) );
264  }
size_t doScan(const SEXPR_SCAN_ARG *args, size_t num_args)
Definition: sexpr.cpp:407

References doScan().

Friends And Related Function Documentation

◆ operator<< [1/9]

SEXPR_LIST& operator<< ( SEXPR_LIST list,
double  value 
)
friend

Definition at line 241 of file sexpr.cpp.

242  {
243  list.AddChild( new SEXPR_DOUBLE( value ) );
244  return list;
245  }

◆ operator<< [2/9]

SEXPR_LIST& operator<< ( SEXPR_LIST list,
float  value 
)
friend

Definition at line 235 of file sexpr.cpp.

236  {
237  list.AddChild( new SEXPR_DOUBLE( value ) );
238  return list;
239  }

◆ operator<< [3/9]

SEXPR_LIST& operator<< ( SEXPR_LIST list,
int64_t  value 
)
friend

Definition at line 223 of file sexpr.cpp.

224  {
225  list.AddChild( new SEXPR_INTEGER( value ) );
226  return list;
227  }

◆ operator<< [4/9]

SEXPR_LIST& operator<< ( SEXPR_LIST list,
int32_t  value 
)
friend

Definition at line 229 of file sexpr.cpp.

230  {
231  list.AddChild( new SEXPR_INTEGER( value ) );
232  return list;
233  }

◆ operator<< [5/9]

SEXPR_LIST& operator<< ( SEXPR_LIST list,
std::string  value 
)
friend

Definition at line 247 of file sexpr.cpp.

248  {
249  list.AddChild( new SEXPR_STRING( value ) );
250  return list;
251  }

◆ operator<< [6/9]

SEXPR_LIST& operator<< ( SEXPR_LIST list,
const _OUT_STRING  setting 
)
friend

Definition at line 259 of file sexpr.cpp.

260  {
261  SEXPR *res;
262 
263  if( setting._Symbol )
264  {
265  res = new SEXPR_SYMBOL( setting._String );
266  }
267  else
268  {
269  res = new SEXPR_STRING( setting._String );
270  }
271 
272  list.AddChild( res );
273 
274  return list;
275  }

◆ operator<< [7/9]

SEXPR_LIST& operator<< ( SEXPR_LIST list,
const ISEXPRABLE obj 
)
friend

Definition at line 215 of file sexpr.cpp.

216  {
217  SEXPR* sobj = obj.SerializeSEXPR();
218  list.AddChild( sobj );
219 
220  return list;
221  }

◆ operator<< [8/9]

SEXPR_LIST& operator<< ( SEXPR_LIST list,
SEXPR_LIST list2 
)
friend

Definition at line 400 of file sexpr.cpp.

401  {
402  list.AddChild( list2 );
403 
404  return list;
405  }

◆ operator<< [9/9]

SEXPR_LIST& operator<< ( SEXPR_LIST list,
SEXPR obj 
)
friend

Definition at line 253 of file sexpr.cpp.

254  {
255  list.AddChild( obj );
256  return list;
257  }

◆ operator>> [1/7]

SEXPR_LIST& operator>> ( SEXPR_LIST input,
ISEXPRABLE obj 
)
friend

Definition at line 277 of file sexpr.cpp.

278  {
279  obj.DeserializeSEXPR( input );
280 
281  return input;
282  }

◆ operator>> [2/7]

SEXPR_LIST& operator>> ( SEXPR_LIST input,
std::string &  str 
)
friend

Definition at line 301 of file sexpr.cpp.

302  {
303  SEXPR* child = input.GetChild( input.m_inStreamChild );
304 
305  if( child->IsString() || child->IsSymbol() )
306  {
307  str = child->GetString();
308  input.m_inStreamChild++;
309  }
310  else
311  {
312  throw std::invalid_argument( "SEXPR is not a string type!" );
313  }
314 
315  return input;
316  }

◆ operator>> [3/7]

SEXPR_LIST& operator>> ( SEXPR_LIST input,
int32_t &  inte 
)
friend

Definition at line 284 of file sexpr.cpp.

285  {
286  SEXPR* child = input.GetChild( input.m_inStreamChild );
287 
288  if( child->IsInteger() )
289  {
290  inte = child->GetInteger();
291  input.m_inStreamChild++;
292  }
293  else
294  {
295  throw std::invalid_argument( "SEXPR is not a integer type!" );
296  }
297 
298  return input;
299  }

◆ operator>> [4/7]

SEXPR_LIST& operator>> ( SEXPR_LIST input,
int64_t &  inte 
)
friend

Definition at line 318 of file sexpr.cpp.

319  {
320  SEXPR* child = input.GetChild( input.m_inStreamChild );
321 
322  if( child->IsInteger() )
323  {
324  lint = child->GetLongInteger();
325  input.m_inStreamChild++;
326  }
327  else
328  {
329  throw std::invalid_argument("SEXPR is not a long integer type!");
330  }
331 
332  return input;
333  }

◆ operator>> [5/7]

SEXPR_LIST& operator>> ( SEXPR_LIST input,
float &  inte 
)
friend

Definition at line 335 of file sexpr.cpp.

336  {
337  SEXPR* child = input.GetChild( input.m_inStreamChild );
338  if( child->IsDouble() )
339  {
340  fl = child->GetFloat();
341  input.m_inStreamChild++;
342  }
343  else
344  {
345  throw std::invalid_argument( "SEXPR is not a float type!" );
346  }
347 
348  return input;
349  }

◆ operator>> [6/7]

SEXPR_LIST& operator>> ( SEXPR_LIST input,
double &  inte 
)
friend

Definition at line 351 of file sexpr.cpp.

352  {
353  SEXPR* child = input.GetChild( input.m_inStreamChild );
354 
355  if( child->IsDouble() )
356  {
357  dbl = child->GetDouble();
358  input.m_inStreamChild++;
359  }
360  else
361  {
362  throw std::invalid_argument( "SEXPR is not a double type!" );
363  }
364 
365  return input;
366  }

◆ operator>> [7/7]

SEXPR_LIST& operator>> ( SEXPR_LIST input,
const _IN_STRING  is 
)
friend

Definition at line 368 of file sexpr.cpp.

369  {
370  SEXPR* child = input.GetChild( input.m_inStreamChild );
371 
372  if( is._Symbol )
373  {
374  if( child->IsSymbol() )
375  {
376  is._String = child->GetSymbol();
377  input.m_inStreamChild++;
378  }
379  else
380  {
381  throw std::invalid_argument( "operator>>: SEXPR is not a symbol type!" );
382  }
383  }
384  else
385  {
386  if( child->IsString() )
387  {
388  is._String = child->GetString();
389  input.m_inStreamChild++;
390  }
391  else
392  {
393  throw std::invalid_argument( "SEXPR is not a string type!" );
394  }
395  }
396 
397  return input;
398  }

Member Data Documentation

◆ m_children

SEXPR_VECTOR SEXPR::SEXPR_LIST::m_children

Definition at line 255 of file sexpr.h.

Referenced by SEXPR::SEXPR::AddChild(), and ~SEXPR_LIST().

◆ m_inStreamChild

int SEXPR::SEXPR_LIST::m_inStreamChild
private

Definition at line 293 of file sexpr.h.

Referenced by SEXPR::operator>>().

◆ m_lineNumber

size_t SEXPR::SEXPR::m_lineNumber
protectedinherited

Definition at line 72 of file sexpr.h.

◆ m_type

SEXPR_TYPE SEXPR::SEXPR::m_type
protectedinherited

Definition at line 69 of file sexpr.h.


The documentation for this class was generated from the following files: