swift
Loading...
Searching...
No Matches
swift::misc::physical_quantities::CPqString Class Reference

Represents a physical quantity by a string. More...

#include <pqstring.h>

Inheritance diagram for swift::misc::physical_quantities::CPqString:
[legend]

Public Types

enum  SeparatorMode { SeparatorQtDefault , SeparatorLocale , SeparatorBestGuess }
 Number separators / group separators. More...
enum  SeparatorIndex { Group , Digit }
 Group and digit separator. More...
Public Types inherited from swift::misc::CValueObject< CPqString >
using base_type
 Base class.
Public Types inherited from swift::misc::CEmpty
using base_type = CEmpty
 Base class is alias of itself.
Public Types inherited from swift::misc::mixin::Index< CPqString >
enum  ColumnIndex
 Base class enums. More...

Public Member Functions

QString convertToQString (bool i18n=false) const
 Cast as QString.
 CPqString ()=default
 Default constructor.
 CPqString (const QString &value)
 Constructor, for values such as 10km/h.
Public Member Functions inherited from swift::misc::mixin::MetaType< CPqString >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object.
QString getClassName () const
 Class name.
bool isA (int metaTypeId) const
 Returns true if this object is an instance of the class with the given meta type ID, or one of its subclasses.
Public Member Functions inherited from swift::misc::mixin::DBusByMetaClass< CPqString >
void marshallToDbus (QDBusArgument &arg, Tags...) const
 Marshall without begin/endStructure, for when composed within another object.
void unmarshallFromDbus (const QDBusArgument &arg, Tags...)
 Unmarshall without begin/endStructure, for when composed within another object.
Public Member Functions inherited from swift::misc::mixin::DataStreamByMetaClass< CPqString >
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream.
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream.
Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< CPqString >
QJsonObject toJson () const
 Cast to JSON object.
QString toJsonString (QJsonDocument::JsonFormat format=QJsonDocument::Indented) const
 Convenience function JSON as string.
void convertFromJson (const QJsonObject &json)
 Assign from JSON object.
Public Member Functions inherited from swift::misc::mixin::String< CPqString >
QString toQString (bool i18n=false) const
 Cast as QString.
std::string toStdString (bool i18n=false) const
 To std string.
QString stringForStreaming () const
 String for streaming operators.
Public Member Functions inherited from swift::misc::mixin::Index< CPqString >
CPropertyIndexList apply (const CPropertyIndexVariantMap &indexMap, bool skipEqualValues=false)
 Update by variant map.
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const CPqString &compareValue) const
 Compare for index.
bool equalsPropertyByIndex (const QVariant &compareValue, CPropertyIndexRef index) const
 Is given variant equal to value of property index?
Public Member Functions inherited from swift::misc::mixin::Icon< CPqString >
CIcons::CIcons::StandardIconUnknown16 toIcon () const
 As icon, not implemented by all classes.

Static Public Member Functions

static CVariant parseToVariant (const QString &value, SeparatorMode mode=SeparatorQtDefault)
 Parse a string value like "100m", "10.3Mhz".
template<class PQ>
static PQ parse (const QString &value, SeparatorMode mode=SeparatorQtDefault)
 Parse into concrete type.
static double parseNumber (const QString &number, bool &success, SeparatorMode mode=SeparatorBestGuess)
 Locale aware parsing.
Static Public Member Functions inherited from swift::misc::mixin::MetaType< CPqString >
static void registerMetadata ()
 Register metadata.
Static Public Member Functions inherited from swift::misc::mixin::JsonByMetaClass< CPqString >
static DerivedObj fromJson (const QJsonObject &json)
 Get object from QJsonObject.
static DerivedObj fromJsonNoThrow (const QString &jsonString, bool acceptCacheJson, bool &success, QString &errMsg)
 Get object from JSON string.

Additional Inherited Members

Protected Member Functions inherited from swift::misc::CValueObject< CPqString >
 CEmpty ()=default
 Inheriting constructors.
 CEmpty (const CEmpty &)=default
 Inheriting constructors.
 CValueObject ()=default
 Default constructor.
CValueObject & operator= (const CValueObject &)=default
 Copy assignment operator.
 ~CValueObject ()=default
 Destructor.
Protected Member Functions inherited from swift::misc::CEmpty
 CEmpty ()=default
 Protected default constructor.
 CEmpty (const CEmpty &)=default
 Protected copy constructor.
CEmpty & operator= (const CEmpty &)=default
 Protected copy assignment operator.
 ~CEmpty ()=default
 Non-virtual protected destructor.

Detailed Description

Represents a physical quantity by a string.

Used to parse strings into physical quantities, validate strings

See also
swift::misc::PhysicalQuantity

Definition at line 26 of file pqstring.h.

Member Enumeration Documentation

◆ SeparatorIndex

Group and digit separator.

Definition at line 41 of file pqstring.h.

◆ SeparatorMode

Number separators / group separators.

Enumerator
SeparatorQtDefault 

100000.00 no group separator

SeparatorLocale 

depending on QLocale, e.g.

100.000,00 in Germany

SeparatorBestGuess 

try to figure out

Definition at line 33 of file pqstring.h.

Constructor & Destructor Documentation

◆ CPqString()

swift::misc::physical_quantities::CPqString::CPqString ( const QString & value)
inline

Constructor, for values such as 10km/h.

Definition at line 51 of file pqstring.h.

Member Function Documentation

◆ convertToQString()

QString swift::misc::physical_quantities::CPqString::convertToQString ( bool i18n = false) const

Cast as QString.

Parameters
i18ni18n *

Definition at line 26 of file pqstring.cpp.

◆ parse()

template<class PQ>
PQ swift::misc::physical_quantities::CPqString::parse ( const QString & value,
SeparatorMode mode = SeparatorQtDefault )
inlinestatic

Parse into concrete type.

Definition at line 58 of file pqstring.h.

◆ parseNumber()

double swift::misc::physical_quantities::CPqString::parseNumber ( const QString & number,
bool & success,
CPqString::SeparatorMode mode = SeparatorBestGuess )
static

Locale aware parsing.

Definition at line 118 of file pqstring.cpp.

◆ parseToVariant()

CVariant swift::misc::physical_quantities::CPqString::parseToVariant ( const QString & value,
SeparatorMode mode = SeparatorQtDefault )
static

Parse a string value like "100m", "10.3Mhz".

Definition at line 28 of file pqstring.cpp.


The documentation for this class was generated from the following files: