Krita Source Code Documentation
Loading...
Searching...
No Matches
KoID Class Reference

#include <KoID.h>

Classes

struct  KoIDPrivate
 
struct  TranslatedString
 

Public Member Functions

QString id () const
 
 KoID ()
 
 KoID (const KoID &rhs)
 
 KoID (const QString &id, const KLocalizedString &name)
 
 KoID (const QString &id, const QString &name=QString())
 
QString name () const
 
KoIDoperator= (const KoID &rhs)
 

Static Public Member Functions

static bool compareNames (const KoID &id1, const KoID &id2)
 

Private Types

using StorageType
 

Private Attributes

QSharedPointer< KoIDPrivatem_d
 

Friends

bool operator!= (const KoID &, const KoID &)
 
bool operator< (const KoID &, const KoID &)
 
bool operator== (const KoID &, const KoID &)
 
bool operator> (const KoID &, const KoID &)
 

Detailed Description

A KoID is a combination of a user-visible string and a string that uniquely identifies a given resource across languages.

Definition at line 29 of file KoID.h.

Member Typedef Documentation

◆ StorageType

using KoID::StorageType
private
Initial value:
KisLazyStorage<TranslatedString,
boost::optional<KLocalizedString>>

Definition at line 39 of file KoID.h.

Constructor & Destructor Documentation

◆ KoID() [1/4]

KoID::KoID ( )

Definition at line 35 of file KoID.cpp.

36 : m_d(new KoIDPrivate(QString(), QString()))
37{
38}
QSharedPointer< KoIDPrivate > m_d
Definition KoID.h:93

◆ KoID() [2/4]

KoID::KoID ( const QString & id,
const QString & name = QString() )
explicit

Construct a KoID with the given id, and name, id is the untranslated official name of the id, name should be translatable as it will be used in the UI.

KoID("id", i18n("name"))
KoID()
Definition KoID.cpp:35

Definition at line 40 of file KoID.cpp.

41 : m_d(new KoIDPrivate(id, name))
42{
43}
QString name() const
Definition KoID.cpp:68

◆ KoID() [3/4]

KoID::KoID ( const QString & id,
const KLocalizedString & name )
explicit

Use this constructor for static KoID. as KoID("id", ki18n("name")); the name will be translated the first time it is needed. This is important because static objects are constructed before translations are initialized.

Definition at line 45 of file KoID.cpp.

46 : m_d(new KoIDPrivate(id, name))
47{
48}

◆ KoID() [4/4]

KoID::KoID ( const KoID & rhs)

Definition at line 50 of file KoID.cpp.

51 : m_d(rhs.m_d)
52{
53}

Member Function Documentation

◆ compareNames()

static bool KoID::compareNames ( const KoID & id1,
const KoID & id2 )
inlinestatic

Definition at line 87 of file KoID.h.

88 {
89 return id1.name() < id2.name();
90 }

References name().

◆ id()

QString KoID::id ( ) const

Definition at line 63 of file KoID.cpp.

64{
65 return m_d->id;
66}

References m_d.

◆ name()

QString KoID::name ( ) const

Definition at line 68 of file KoID.cpp.

69{
70 return *m_d->name;
71}

References m_d.

◆ operator=()

KoID & KoID::operator= ( const KoID & rhs)

Definition at line 55 of file KoID.cpp.

56{
57 if (this != &rhs) {
58 m_d = rhs.m_d;
59 }
60 return *this;
61}

References m_d.

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const KoID & v1,
const KoID & v2 )
friend

Definition at line 103 of file KoID.h.

104{
105 return !(v1 == v2);
106}

◆ operator<

bool operator< ( const KoID & v1,
const KoID & v2 )
friend

Definition at line 108 of file KoID.h.

109{
110 return v1.m_d->id < v2.m_d->id;
111}

◆ operator==

bool operator== ( const KoID & v1,
const KoID & v2 )
friend

Definition at line 98 of file KoID.h.

99{
100 return v1.m_d == v2.m_d || v1.m_d->id == v2.m_d->id;
101}

◆ operator>

bool operator> ( const KoID & v1,
const KoID & v2 )
friend

Definition at line 113 of file KoID.h.

114{
115 return v1.m_d->id > v2.m_d->id;;
116}

Member Data Documentation

◆ m_d

QSharedPointer<KoIDPrivate> KoID::m_d
private

Definition at line 93 of file KoID.h.


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