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 class  SEXPR_TYPE : char {
  SEXPR_TYPE_LIST , SEXPR_TYPE_ATOM_INTEGER , SEXPR_TYPE_ATOM_DOUBLE , SEXPR_TYPE_ATOM_STRING ,
  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 43 of file sexpr.h.

Enumeration Type Documentation

◆ SEXPR_TYPE

enum class 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 34 of file sexpr.h.

Function Documentation

◆ AsString() [1/2]

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

Definition at line 131 of file sexpr.h.

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

Referenced by SCH_SHEET_PATH::IsContainedWithin().

◆ AsString() [2/2]

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

Definition at line 149 of file sexpr.h.

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

◆ AsSymbol() [1/2]

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

Definition at line 125 of file sexpr.h.

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

◆ AsSymbol() [2/2]

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

Definition at line 143 of file sexpr.h.

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

◆ operator<<() [1/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 }
void AddChild(SEXPR *aChild)
Definition: sexpr.cpp:58
const std::string & _String
Definition: sexpr.h:122

◆ operator<<() [2/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 }
virtual SEXPR * SerializeSEXPR() const
Definition: isexprable.h:32

◆ operator<<() [3/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 }

◆ 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 }

◆ operator<<() [5/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 }

◆ operator<<() [6/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 }

◆ 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 }

◆ operator<<() [8/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 }

◆ operator<<() [9/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 }

◆ operator>>() [1/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 }
int m_inStreamChild
Definition: sexpr.h:293
std::string const & GetSymbol() const
Definition: sexpr.cpp:128
bool IsString() const
Definition: sexpr.h:51
bool IsSymbol() const
Definition: sexpr.h:50
std::string const & GetString() const
Definition: sexpr.cpp:80
SEXPR * GetChild(size_t aIndex) const
Definition: sexpr.cpp:48
std::string & _String
Definition: sexpr.h:140

◆ operator>>() [2/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 }
bool IsDouble() const
Definition: sexpr.h:52
double GetDouble() const
Definition: sexpr.cpp:105

◆ operator>>() [3/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 }
float GetFloat() const
Definition: sexpr.cpp:123

◆ operator>>() [4/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 }
bool IsInteger() const
Definition: sexpr.h:53
int32_t GetInteger() const
Definition: sexpr.cpp:90

◆ operator>>() [5/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 }
int64_t GetLongInteger() const
Definition: sexpr.cpp:95

◆ operator>>() [6/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 }
virtual void DeserializeSEXPR(SEXPR &sexp)
Definition: isexprable.h:33

◆ operator>>() [7/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 }