KiCad PCB EDA Suite
SEXPR Namespace Reference

Classes

struct  _IN_STRING
 
struct  _OUT_STRING
 
class  INVALID_TYPE_EXCEPTION
 
class  ISEXPRABLE
 
class  PARSE_EXCEPTION
 
class  PARSER
 
class  SEXPR
 
class  SEXPR_CHILDREN_ARG
 
struct  SEXPR_DOUBLE
 
struct  SEXPR_INTEGER
 
class  SEXPR_LIST
 
class  SEXPR_SCAN_ARG
 
struct  SEXPR_STRING
 
struct  SEXPR_SYMBOL
 

Typedefs

typedef std::vector< class SEXPR * > SEXPR_VECTOR
 

Enumerations

enum  SEXPR_TYPE : char {
  SEXPR_TYPE::SEXPR_TYPE_LIST, SEXPR_TYPE::SEXPR_TYPE_ATOM_INTEGER, SEXPR_TYPE::SEXPR_TYPE_ATOM_DOUBLE, SEXPR_TYPE::SEXPR_TYPE_ATOM_STRING,
  SEXPR_TYPE::SEXPR_TYPE_ATOM_SYMBOL
}
 

Functions

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

Typedef Documentation

◆ SEXPR_VECTOR

typedef std::vector< class SEXPR * > SEXPR::SEXPR_VECTOR

Definition at line 42 of file sexpr.h.

Enumeration Type Documentation

◆ SEXPR_TYPE

enum SEXPR::SEXPR_TYPE : char
strong
Enumerator
SEXPR_TYPE_LIST 
SEXPR_TYPE_ATOM_INTEGER 
SEXPR_TYPE_ATOM_DOUBLE 
SEXPR_TYPE_ATOM_STRING 
SEXPR_TYPE_ATOM_SYMBOL 

Definition at line 33 of file sexpr.h.

Function Documentation

◆ AsString() [1/2]

_OUT_STRING SEXPR::AsString ( const std::string &  aString)
inline

Definition at line 130 of file sexpr.h.

131  {
132  struct _OUT_STRING ret = { false, aString };
133  return ret;
134  }

◆ AsString() [2/2]

_IN_STRING SEXPR::AsString ( std::string &  aString)
inline

Definition at line 148 of file sexpr.h.

149  {
150  struct _IN_STRING ret = { false, aString };
151  return ret;
152  }

◆ AsSymbol() [1/2]

_OUT_STRING SEXPR::AsSymbol ( const std::string &  aString)
inline

Definition at line 124 of file sexpr.h.

125  {
126  struct _OUT_STRING ret = { true, aString };
127  return ret;
128  }

◆ AsSymbol() [2/2]

_IN_STRING SEXPR::AsSymbol ( std::string &  aString)
inline

Definition at line 142 of file sexpr.h.

143  {
144  struct _IN_STRING ret = { true, aString };
145  return ret;
146  }

◆ operator<<() [1/9]

SEXPR_LIST& SEXPR::operator<< ( SEXPR_LIST list,
const ISEXPRABLE obj 
)

Definition at line 215 of file sexpr.cpp.

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

References SEXPR::SEXPR::AddChild(), and SEXPR::ISEXPRABLE::SerializeSEXPR().

◆ operator<<() [2/9]

SEXPR_LIST& SEXPR::operator<< ( SEXPR_LIST list,
int64_t  value 
)

Definition at line 223 of file sexpr.cpp.

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

References SEXPR::SEXPR::AddChild().

◆ operator<<() [3/9]

SEXPR_LIST& SEXPR::operator<< ( SEXPR_LIST list,
int32_t  value 
)

Definition at line 229 of file sexpr.cpp.

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

References SEXPR::SEXPR::AddChild().

◆ operator<<() [4/9]

SEXPR_LIST& SEXPR::operator<< ( SEXPR_LIST list,
float  value 
)

Definition at line 235 of file sexpr.cpp.

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

References SEXPR::SEXPR::AddChild().

◆ operator<<() [5/9]

SEXPR_LIST& SEXPR::operator<< ( SEXPR_LIST list,
double  value 
)

Definition at line 241 of file sexpr.cpp.

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

References SEXPR::SEXPR::AddChild().

◆ operator<<() [6/9]

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

Definition at line 247 of file sexpr.cpp.

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

References SEXPR::SEXPR::AddChild().

◆ operator<<() [7/9]

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

Definition at line 253 of file sexpr.cpp.

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

References SEXPR::SEXPR::AddChild().

◆ operator<<() [8/9]

SEXPR_LIST& SEXPR::operator<< ( SEXPR_LIST list,
const _OUT_STRING  setting 
)

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  }

References SEXPR::_OUT_STRING::_String, SEXPR::_OUT_STRING::_Symbol, and SEXPR::SEXPR::AddChild().

◆ operator<<() [9/9]

SEXPR_LIST& SEXPR::operator<< ( SEXPR_LIST list,
SEXPR_LIST list2 
)

Definition at line 400 of file sexpr.cpp.

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

References SEXPR::SEXPR::AddChild().

◆ operator>>() [1/7]

SEXPR_LIST& SEXPR::operator>> ( SEXPR_LIST input,
ISEXPRABLE obj 
)

Definition at line 277 of file sexpr.cpp.

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

References SEXPR::ISEXPRABLE::DeserializeSEXPR().

◆ operator>>() [2/7]

SEXPR_LIST& SEXPR::operator>> ( SEXPR_LIST input,
int32_t &  inte 
)

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  }

References SEXPR::SEXPR::GetChild(), and SEXPR::SEXPR_LIST::m_inStreamChild.

◆ operator>>() [3/7]

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

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  }

References SEXPR::SEXPR::GetChild(), and SEXPR::SEXPR_LIST::m_inStreamChild.

◆ operator>>() [4/7]

SEXPR_LIST& SEXPR::operator>> ( SEXPR_LIST input,
int64_t &  lint 
)

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  }

References SEXPR::SEXPR::GetChild(), and SEXPR::SEXPR_LIST::m_inStreamChild.

◆ operator>>() [5/7]

SEXPR_LIST& SEXPR::operator>> ( SEXPR_LIST input,
float &  fl 
)

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  }

References SEXPR::SEXPR::GetChild(), and SEXPR::SEXPR_LIST::m_inStreamChild.

◆ operator>>() [6/7]

SEXPR_LIST& SEXPR::operator>> ( SEXPR_LIST input,
double &  dbl 
)

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  }

References SEXPR::SEXPR::GetChild(), and SEXPR::SEXPR_LIST::m_inStreamChild.

◆ operator>>() [7/7]

SEXPR_LIST& SEXPR::operator>> ( SEXPR_LIST input,
const _IN_STRING  is 
)

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  }

References SEXPR::_IN_STRING::_String, SEXPR::_IN_STRING::_Symbol, SEXPR::SEXPR::GetChild(), and SEXPR::SEXPR_LIST::m_inStreamChild.