6 #ifndef SWIFT_MISC_PQ_PQSTRING_H
7 #define SWIFT_MISC_PQ_PQSTRING_H
19 namespace swift::misc::physical_quantities
30 QString convertToQString(
bool i18n =
false)
const;
51 CPqString(
const QString &value) : m_string(value) {}
54 static CVariant parseToVariant(
const QString &value, SeparatorMode mode = SeparatorQtDefault);
60 if (value.isEmpty()) {
return PQ::null(); }
61 if (value.contains(
"null", Qt::CaseInsensitive)) {
return PQ::null(); }
62 const CVariant qv = parseToVariant(value, mode);
68 static double parseNumber(
const QString &number,
bool &success, SeparatorMode mode = SeparatorBestGuess);
Mix of the most commonly used mixin classes.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
T value() const
Return the value converted to the type T.
bool isNull() const
True if this variant is null.
bool canConvert(int typeId) const
True if this variant can be converted to the type with the given metatype ID.
Represents a physical quantity by a string.
static PQ parse(const QString &value, SeparatorMode mode=SeparatorQtDefault)
Parse into concrete type.
SeparatorMode
Number separators / group separators.
@ SeparatorLocale
depending on QLocale, e.g.
@ SeparatorQtDefault
100000.00 no group separator
CPqString()=default
Default constructor.
CPqString(const QString &value)
Constructor, for values such as 10km/h.
SeparatorIndex
Group and digit separator.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...