Krita Source Code Documentation
Loading...
Searching...
No Matches
KisMetaData::Entry Class Reference

#include <kis_meta_data_entry.h>

Public Member Functions

 Entry ()
 
 Entry (const Entry &)
 
 Entry (const KisMetaData::Schema *schema, QString name, const KisMetaData::Value &value)
 
bool isValid () const
 
QString name () const
 
Entryoperator= (const Entry &entry)
 
bool operator== (const Entry &) const
 
QString qualifiedName () const
 
const KisMetaData::Schemaschema () const
 
KisMetaData::Valuevalue ()
 
const KisMetaData::Valuevalue () const
 
 ~Entry ()
 

Static Public Member Functions

static bool isValidName (const QString &_name)
 

Private Member Functions

void setSchema (const KisMetaData::Schema *schema)
 

Private Attributes

Private *const d
 

Friends

class Store
 

Detailed Description

Represent a metadata entry, a name and a value (KisMetaData::Value).

Definition at line 24 of file kis_meta_data_entry.h.

Constructor & Destructor Documentation

◆ Entry() [1/3]

Entry::Entry ( )

Create an invalid entry

Definition at line 24 of file kis_meta_data_entry.cc.

24 :
25 d(new Private)
26{
27 d->schema = 0;
28 d->valid = false;
29}

References d.

◆ Entry() [2/3]

KisMetaData::Entry::Entry ( const KisMetaData::Schema * schema,
QString name,
const KisMetaData::Value & value )

Create a new entry.

Parameters
name
namespacePrefix
value

◆ Entry() [3/3]

KisMetaData::Entry::Entry ( const Entry & )

◆ ~Entry()

Entry::~Entry ( )

Definition at line 53 of file kis_meta_data_entry.cc.

54{
55 delete d;
56}

References d.

Member Function Documentation

◆ isValid()

bool Entry::isValid ( ) const
Returns
true if this entry is valid

Definition at line 91 of file kis_meta_data_entry.cc.

92{
93 return d->valid;
94}

References d.

◆ isValidName()

bool Entry::isValidName ( const QString & _name)
static
Returns
true if the name in argument is valid entry name.

Definition at line 96 of file kis_meta_data_entry.cc.

97{
98 if (_name.length() < 1) {
99 dbgMetaData << "Too small";
100 return false;
101 }
102 if (!_name[0].isLetter()) {
103 dbgMetaData << _name << " doesn't start by a letter";
104 return false;
105 }
106 for (int i = 1; i < _name.length(); ++i) {
107 QChar c = _name[i];
108 if (!c.isLetterOrNumber()) {
109 dbgMetaData << _name << " " << i << "th character isn't a letter or a digit";
110 return false;
111 }
112 }
113 return true;
114}
#define dbgMetaData
Definition kis_debug.h:61

References dbgMetaData.

◆ name()

QString KisMetaData::Entry::name ( ) const
Returns
the name of this entry

◆ operator=()

Entry & Entry::operator= ( const Entry & entry)

Affect the content of entry to this entry if entry is valid

Definition at line 122 of file kis_meta_data_entry.cc.

123{
124 if (e.isValid()) {
125 Q_ASSERT(!isValid() || *this == e);
126 d->name = e.d->name;
127 d->schema = e.d->schema;
128 d->value = e.d->value;
129 d->valid = true;
130 }
131 return *this;
132}

References d, and isValid().

◆ operator==()

bool Entry::operator== ( const Entry & e) const

Definition at line 117 of file kis_meta_data_entry.cc.

118{
119 return qualifiedName() == e.qualifiedName();
120}
QString qualifiedName() const

References qualifiedName().

◆ qualifiedName()

QString Entry::qualifiedName ( ) const
Returns
the qualified name of this entry, which is the concatenation of the namespace and of the name

Definition at line 75 of file kis_meta_data_entry.cc.

76{
77 Q_ASSERT(d->schema);
78 return d->schema->generateQualifiedName(d->name);
79}

References d.

◆ schema()

const KisMetaData::Schema * KisMetaData::Entry::schema ( ) const
Returns
the namespace of this entry

◆ setSchema()

void Entry::setSchema ( const KisMetaData::Schema * schema)
private

Definition at line 69 of file kis_meta_data_entry.cc.

70{
71 Q_ASSERT(schema);
72 d->schema = schema;
73}
const KisMetaData::Schema * schema() const

References d, and schema().

◆ value() [1/2]

KisMetaData::Value & KisMetaData::Entry::value ( )
Returns
the value of this entry

◆ value() [2/2]

const KisMetaData::Value & KisMetaData::Entry::value ( ) const
Returns
the value of this entry

Friends And Related Symbol Documentation

◆ Store

friend class Store
friend

Definition at line 27 of file kis_meta_data_entry.h.

Member Data Documentation

◆ d

Private* const KisMetaData::Entry::d
private

Definition at line 79 of file kis_meta_data_entry.h.


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