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. | |
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. | |
OPTIONAL_XML_ATTRIBUTE< T > & | operator= (T aData) |
Assign to an object of the base type containing the data. | |
bool | operator== (const T &aOther) const |
void | Set (const wxString &aString) |
Attempt to convert a string to the base type. | |
T & | Get () |
Return a reference to the value of the attribute assuming it is available. | |
const T & | CGet () const |
Return a constant reference to the value of the attribute assuming it is available. | |
T & | operator* () |
Return a reference to the value of the attribute assuming it is available. | |
const T & | operator* () const |
Return a constant reference to the value of the attribute assuming it is available. | |
T * | operator-> () |
Return a pointer to the value of the attribute assuming it is available. | |
const T * | operator-> () const |
Return a constant pointer to the value of the attribute assuming it is available. | |
Private Attributes | |
bool | m_isAvailable |
A boolean indicating if the data is present or not. | |
T | m_data |
The actual data if m_isAvailable is true; otherwise, garbage. | |
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 201 of file eagle_parser.h.
|
inline |
Construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available.
Definition at line 214 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 224 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 238 of file eagle_parser.h.
|
inline |
Return a constant reference to the value of the attribute assuming it is available.
Definition at line 316 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_data, and OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable.
Referenced by ETEXT::ConvertSize(), 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 305 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_data, and OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable.
Referenced by PCB_IO_EAGLE::loadPolygon(), OPTIONAL_XML_ATTRIBUTE< T >::operator*(), and OPTIONAL_XML_ATTRIBUTE< T >::operator->().
|
inline |
Definition at line 246 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 327 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 337 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 347 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 357 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 257 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 273 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 284 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 294 of file eagle_parser.h.
References OPTIONAL_XML_ATTRIBUTE< T >::m_data, and OPTIONAL_XML_ATTRIBUTE< T >::m_isAvailable.
Referenced by EDEVICE::EDEVICE(), 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 208 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 205 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().