Mantid
|
A base-class for the a class that is able to return unit labels in different representations. More...
#include <UnitLabel.h>
Public Types | |
using | AsciiString = std::string |
Type that contains a plain-text string. More... | |
using | Utf8String = std::wstring |
Type that can hold a unicode string. More... | |
Public Member Functions | |
const AsciiString & | ascii () const |
Return an ascii label for unit. More... | |
const AsciiString & | latex () const |
Return an ascii latex compatible label for unit. More... | |
operator std::string () const | |
Implicit conversion to std::string. More... | |
bool | operator!= (const char *rhs) const |
Inequality operator with c-style string. More... | |
bool | operator!= (const std::string &rhs) const |
Inequality operator with std::string. More... | |
bool | operator!= (const std::wstring &rhs) const |
Inequality operator with std::wstring. More... | |
bool | operator!= (const UnitLabel &rhs) const |
Inqquality operator with other label. More... | |
bool | operator== (const char *rhs) const |
Equality operator with c-style string. More... | |
bool | operator== (const std::string &rhs) const |
Equality operator with std::string. More... | |
bool | operator== (const std::wstring &rhs) const |
Equality operator with std::wstring. More... | |
bool | operator== (const UnitLabel &rhs) const |
Equality operator with other label. More... | |
UnitLabel ()=delete | |
UnitLabel (AsciiString ascii, Utf8String unicode, AsciiString latex) | |
Constructor giving labels as ascii, unicode, and latex respectively. More... | |
UnitLabel (const AsciiString &ascii) | |
Constructor creating all labels from the ascii string. More... | |
UnitLabel (const char *ascii) | |
Constructor creating all labels using a C-style string. More... | |
const Utf8String & | utf8 () const |
Return a utf-8 encoded label for unit. More... | |
Private Attributes | |
std::string | m_ascii |
Value of plain-text label. More... | |
std::string | m_latex |
Value of latex label. More... | |
std::wstring | m_utf8 |
Value of utf-8 encoded string. More... | |
A base-class for the a class that is able to return unit labels in different representations.
Definition at line 20 of file UnitLabel.h.
using Mantid::Kernel::UnitLabel::AsciiString = std::string |
Type that contains a plain-text string.
Definition at line 25 of file UnitLabel.h.
using Mantid::Kernel::UnitLabel::Utf8String = std::wstring |
Type that can hold a unicode string.
This may vary per-platform depending on the width of the the built-in std::wstring
Definition at line 29 of file UnitLabel.h.
|
delete |
Mantid::Kernel::UnitLabel::UnitLabel | ( | AsciiString | ascii, |
Utf8String | unicode, | ||
AsciiString | latex | ||
) |
Constructor giving labels as ascii, unicode, and latex respectively.
ascii | A plain-text label containing only ascii characters |
unicode | A label that can contain unicode characters |
latex | A text label containg the ascii characters with latex formatting |
Definition at line 20 of file UnitLabel.cpp.
Mantid::Kernel::UnitLabel::UnitLabel | ( | const AsciiString & | ascii | ) |
Constructor creating all labels from the ascii string.
Use an ASCII string for the unicode variant too.
ascii | A plain-text label containing only ascii characters |
Definition at line 27 of file UnitLabel.cpp.
Mantid::Kernel::UnitLabel::UnitLabel | ( | const char * | ascii | ) |
Constructor creating all labels using a C-style string.
Use an ASCII string for the unicode variant too, given as a C-style string.
ascii | A plain-text label |
Definition at line 36 of file UnitLabel.cpp.
const UnitLabel::AsciiString & Mantid::Kernel::UnitLabel::ascii | ( | ) | const |
Return an ascii label for unit.
Definition at line 105 of file UnitLabel.cpp.
References m_ascii.
Referenced by Mantid::Kernel::ReciprocalLatticeUnitFactory::canInterpret(), Mantid::Geometry::MDHistoDimensionBuilder::createRaw(), export_UnitLabel(), Mantid::Kernel::LabelUnit::isQUnit(), Mantid::Kernel::ReciprocalLatticeUnit::isSpecialRLUUnitLabel(), and operator==().
const UnitLabel::AsciiString & Mantid::Kernel::UnitLabel::latex | ( | ) | const |
Return an ascii latex compatible label for unit.
Definition at line 115 of file UnitLabel.cpp.
References m_latex.
Referenced by export_UnitLabel().
Mantid::Kernel::UnitLabel::operator std::string | ( | ) | const |
Implicit conversion to std::string.
Returns the results of the ascii() method.
Definition at line 120 of file UnitLabel.cpp.
bool Mantid::Kernel::UnitLabel::operator!= | ( | const char * | rhs | ) | const |
Inequality operator with c-style string.
Test if this object is not considered equal to another c-style string It compares to result of ascii()
rhs | A string to compare |
Definition at line 92 of file UnitLabel.cpp.
References rhs.
bool Mantid::Kernel::UnitLabel::operator!= | ( | const std::string & | rhs | ) | const |
Inequality operator with std::string.
Test if this object is not considered equal to another std::string.
It compares to result of ascii()
rhs | A string to compare |
Definition at line 84 of file UnitLabel.cpp.
References rhs.
bool Mantid::Kernel::UnitLabel::operator!= | ( | const std::wstring & | rhs | ) | const |
Inequality operator with std::wstring.
Test if this object is not considered equal to another std::wstring.
It compares to result of utf8()
rhs | A string to compare |
Definition at line 100 of file UnitLabel.cpp.
References rhs.
bool Mantid::Kernel::UnitLabel::operator!= | ( | const UnitLabel & | rhs | ) | const |
Inqquality operator with other label.
Test if two objects are not considered equal.
rhs | A second label object |
Definition at line 76 of file UnitLabel.cpp.
References rhs.
bool Mantid::Kernel::UnitLabel::operator== | ( | const char * | rhs | ) | const |
Equality operator with c-style string.
Test if this object is considered equal to another c-style string.
It compares to result of ascii()
rhs | A string to compare |
Definition at line 61 of file UnitLabel.cpp.
bool Mantid::Kernel::UnitLabel::operator== | ( | const std::string & | rhs | ) | const |
Equality operator with std::string.
Test if this object is considered equal to another std::string.
It compares to result of ascii()
rhs | A string to compare |
Definition at line 53 of file UnitLabel.cpp.
References ascii().
bool Mantid::Kernel::UnitLabel::operator== | ( | const std::wstring & | rhs | ) | const |
Equality operator with std::wstring.
Test if this object is considered equal to another std::wstring.
It compares to result of utf8()
rhs | A string to compare |
Definition at line 69 of file UnitLabel.cpp.
References utf8().
bool Mantid::Kernel::UnitLabel::operator== | ( | const UnitLabel & | rhs | ) | const |
Equality operator with other label.
Test if two objects are considered equal.
rhs | A second label object |
Definition at line 43 of file UnitLabel.cpp.
const UnitLabel::Utf8String & Mantid::Kernel::UnitLabel::utf8 | ( | ) | const |
Return a utf-8 encoded label for unit.
Definition at line 110 of file UnitLabel.cpp.
References m_utf8.
Referenced by operator==().
|
private |
Value of plain-text label.
Definition at line 68 of file UnitLabel.h.
Referenced by ascii(), and UnitLabel().
|
private |
|
private |
Value of utf-8 encoded string.
Definition at line 70 of file UnitLabel.h.
Referenced by UnitLabel(), and utf8().