swift
Loading...
Searching...
No Matches
swift::misc::CStrongStringView Class Reference

Special-purpose string class used by CMessageBase. More...

#include <statusmessage.h>

Inheritance diagram for swift::misc::CStrongStringView:
[legend]

Public Member Functions

 CStrongStringView ()=default
 Default constructor.
template<size_t N>
 CStrongStringView (const char16_t(&string)[N])
 Construct from a UTF-16 character array.
 CStrongStringView (const QString &string)
 Construct from a QString.
 CStrongStringView (QStringView view)
 Construct from a QStringView. Explicit because it could be dangerous if used without care.
 CStrongStringView (const char *)=delete
 Deleted constructor.
 CStrongStringView (const CStrongStringView &other)
 Copy constructor.
CStrongStringView & operator= (const CStrongStringView &other)
 Copy assignment operator.
 ~CStrongStringView ()=default
 Destructor.
bool isEmpty () const
 String is empty.
bool isOwning () const
 Does it own its string data?
QStringView view () const
 Return as a QStringView.
QString convertToQString (bool i18n=false) const
 Return a copy as a QString.
void marshallToDbus (QDBusArgument &arg) const
 DBus marshalling.
void unmarshallFromDbus (const QDBusArgument &arg)
 DBus marshalling.
void marshalToDataStream (QDataStream &stream) const
 QDataStream marshalling.
void unmarshalFromDataStream (QDataStream &stream)
 QDataStream marshalling.
QJsonObject toJson () const
 JSON conversion.
void convertFromJson (const QJsonObject &json)
 JSON conversion.
Public Member Functions inherited from swift::misc::mixin::MetaType< CStrongStringView >
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::String< CStrongStringView >
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.

Friends

int compare (const CStrongStringView &a, const CStrongStringView &b)
 Compare two strings.
size_t qHash (const CStrongStringView &obj, uint seed=0)
 Hash value.

Additional Inherited Members

Static Public Member Functions inherited from swift::misc::mixin::MetaType< CStrongStringView >
static void registerMetadata ()
 Register metadata.

Detailed Description

Special-purpose string class used by CMessageBase.

Wraps a QStringView that can be constructed from a UTF-16 string literal or from a QString. If constructed from a QString, the QString is stored to prevent a dangling pointer.

Definition at line 48 of file statusmessage.h.

Constructor & Destructor Documentation

◆ CStrongStringView() [1/4]

template<size_t N>
swift::misc::CStrongStringView::CStrongStringView ( const char16_t(&) string[N])
inline

Construct from a UTF-16 character array.

Definition at line 63 of file statusmessage.h.

◆ CStrongStringView() [2/4]

swift::misc::CStrongStringView::CStrongStringView ( const QString & string)
inline

Construct from a QString.

Definition at line 67 of file statusmessage.h.

◆ CStrongStringView() [3/4]

swift::misc::CStrongStringView::CStrongStringView ( QStringView view)
inlineexplicit

Construct from a QStringView. Explicit because it could be dangerous if used without care.

Definition at line 70 of file statusmessage.h.

◆ CStrongStringView() [4/4]

swift::misc::CStrongStringView::CStrongStringView ( const CStrongStringView & other)
inline

Copy constructor.

Definition at line 76 of file statusmessage.h.

Member Function Documentation

◆ convertFromJson()

void swift::misc::CStrongStringView::convertFromJson ( const QJsonObject & json)
inline

JSON conversion.

Definition at line 149 of file statusmessage.h.

◆ convertToQString()

QString swift::misc::CStrongStringView::convertToQString ( bool i18n = false) const
inline

Return a copy as a QString.

Definition at line 106 of file statusmessage.h.

◆ isEmpty()

bool swift::misc::CStrongStringView::isEmpty ( ) const
inline

String is empty.

Definition at line 97 of file statusmessage.h.

◆ isOwning()

bool swift::misc::CStrongStringView::isOwning ( ) const
inline

Does it own its string data?

Definition at line 100 of file statusmessage.h.

◆ marshallToDbus()

void swift::misc::CStrongStringView::marshallToDbus ( QDBusArgument & arg) const
inline

DBus marshalling.

Definition at line 123 of file statusmessage.h.

◆ marshalToDataStream()

void swift::misc::CStrongStringView::marshalToDataStream ( QDataStream & stream) const
inline

QDataStream marshalling.

Definition at line 133 of file statusmessage.h.

◆ operator=()

CStrongStringView & swift::misc::CStrongStringView::operator= ( const CStrongStringView & other)
inline

Copy assignment operator.

Definition at line 79 of file statusmessage.h.

◆ toJson()

QJsonObject swift::misc::CStrongStringView::toJson ( ) const
inline

JSON conversion.

Definition at line 143 of file statusmessage.h.

◆ unmarshalFromDataStream()

void swift::misc::CStrongStringView::unmarshalFromDataStream ( QDataStream & stream)
inline

QDataStream marshalling.

Definition at line 134 of file statusmessage.h.

◆ unmarshallFromDbus()

void swift::misc::CStrongStringView::unmarshallFromDbus ( const QDBusArgument & arg)
inline

DBus marshalling.

Definition at line 124 of file statusmessage.h.

◆ view()

QStringView swift::misc::CStrongStringView::view ( ) const
inline

Return as a QStringView.

Definition at line 103 of file statusmessage.h.

◆ compare

int compare ( const CStrongStringView & a,
const CStrongStringView & b )
friend

Compare two strings.

Definition at line 113 of file statusmessage.h.

◆ qHash

size_t qHash ( const CStrongStringView & obj,
uint seed = 0 )
friend

Hash value.

Definition at line 119 of file statusmessage.h.


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