KiCad PCB EDA Suite
|
Model an optional XML attribute. More...
#include <eagle_parser.h>
Public Member Functions | |
OPTIONAL_XML_ATTRIBUTE () | |
Construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available. More... | |
OPTIONAL_XML_ATTRIBUTE (const wxString &aData) | |
template<typename V = T> | |
OPTIONAL_XML_ATTRIBUTE (T aData) | |
operator bool () const | |
OPTIONAL_XML_ATTRIBUTE< T > & | operator= (const wxString &aData) |
Assign to a string (optionally) containing the data. More... | |
OPTIONAL_XML_ATTRIBUTE< T > & | operator= (T aData) |
Assign to an object of the base type containing the data. More... | |
bool | operator== (const T &aOther) const |
void | Set (const wxString &aString) |
Attempt to convert a string to the base type. More... | |
T & | Get () |
Return a reference to the value of the attribute assuming it is available. More... | |
const T & | CGet () const |
Return a constant reference to the value of the attribute assuming it is available. More... | |
T & | operator* () |
Return a reference to the value of the attribute assuming it is available. More... | |
const T & | operator* () const |
Return a constant reference to the value of the attribute assuming it is available. More... | |
T * | operator-> () |
Return a pointer to the value of the attribute assuming it is available. More... | |
const T * | operator-> () const |
Return a constant pointer to the value of the attribute assuming it is available. More... | |
Private Attributes | |
bool | m_isAvailable |
A boolean indicating if the data is present or not. More... | |
T | m_data |
The actual data if m_isAvailable is true; otherwise, garbage. More... | |
Model an optional XML attribute.
This was implemented as an alternative to std::optional. This class should be replaced with a simple typedef per type using std::optional when C++17 is published.
Definition at line 193 of file eagle_parser.h.
|
inline |
Construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available.
Definition at line 206 of file eagle_parser.h.
|
inline |
aData | is a wxString containing the value that should be converted to type T. If aData is empty, the attribute is understood as unavailable; otherwise, the conversion to T is tried. |
Definition at line 216 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_data, OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable, and OPTIONAL_XML_ATTRIBUTE< T >::Set().
|
inline |
aData | is the value of the XML attribute. If this constructor is called, the attribute is available. |
Definition at line 230 of file eagle_parser.h.
|
inline |
Return a constant reference to the value of the attribute assuming it is available.
Definition at line 308 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_data, and OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable.
Referenced by ETEXT::ConvertSize(), SCH_EAGLE_PLUGIN::loadTextAttributes(), OPTIONAL_XML_ATTRIBUTE< T >::operator*(), and OPTIONAL_XML_ATTRIBUTE< T >::operator->().
|
inline |
Return a reference to the value of the attribute assuming it is available.
Definition at line 297 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_data, and OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable.
Referenced by SCH_EAGLE_PLUGIN::loadInstance(), SCH_EAGLE_PLUGIN::loadLibrary(), SCH_EAGLE_PLUGIN::loadPin(), EAGLE_PLUGIN::loadPolygon(), OPTIONAL_XML_ATTRIBUTE< T >::operator*(), and OPTIONAL_XML_ATTRIBUTE< T >::operator->().
|
inline |
Definition at line 238 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable.
|
inline |
Return a reference to the value of the attribute assuming it is available.
Definition at line 319 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::Get().
|
inline |
Return a constant reference to the value of the attribute assuming it is available.
Definition at line 329 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::CGet().
|
inline |
Return a pointer to the value of the attribute assuming it is available.
Definition at line 339 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::Get().
|
inline |
Return a constant pointer to the value of the attribute assuming it is available.
Definition at line 349 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::CGet().
|
inline |
Assign to a string (optionally) containing the data.
aData | is a wxString that should be converted to T. If the string is empty, the attribute is set to unavailable. |
Definition at line 249 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable, and OPTIONAL_XML_ATTRIBUTE< T >::Set().
|
inline |
Assign to an object of the base type containing the data.
aData | is the actual value of the attribute. Calling this assignment, the attribute is automatically made available. |
Definition at line 265 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_data, and OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable.
|
inline |
aOther | is the object of the base type that should be compared with this one. |
Definition at line 276 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_data, and OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable.
|
inline |
Attempt to convert a string to the base type.
aString | is the string that will be converted to the base type. |
Definition at line 286 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_data, and OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable.
Referenced by OPTIONAL_XML_ATTRIBUTE< T >::operator=(), and OPTIONAL_XML_ATTRIBUTE< T >::OPTIONAL_XML_ATTRIBUTE().
|
private |
The actual data if m_isAvailable is true; otherwise, garbage.
Definition at line 200 of file eagle_parser.h.
Referenced by OPTIONAL_XML_ATTRIBUTE< T >::CGet(), OPTIONAL_XML_ATTRIBUTE< T >::Get(), OPTIONAL_XML_ATTRIBUTE< T >::operator=(), OPTIONAL_XML_ATTRIBUTE< T >::operator==(), OPTIONAL_XML_ATTRIBUTE< T >::OPTIONAL_XML_ATTRIBUTE(), and OPTIONAL_XML_ATTRIBUTE< T >::Set().
|
private |
A boolean indicating if the data is present or not.
Definition at line 197 of file eagle_parser.h.
Referenced by OPTIONAL_XML_ATTRIBUTE< T >::CGet(), OPTIONAL_XML_ATTRIBUTE< T >::Get(), OPTIONAL_XML_ATTRIBUTE< T >::operator bool(), OPTIONAL_XML_ATTRIBUTE< T >::operator=(), OPTIONAL_XML_ATTRIBUTE< T >::operator==(), OPTIONAL_XML_ATTRIBUTE< T >::OPTIONAL_XML_ATTRIBUTE(), and OPTIONAL_XML_ATTRIBUTE< T >::Set().