Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
VariantDataModel Class Reference

VariantDataModel encapsulates QVariant and can be used as a model for any type of QVariant supported data structure (map, list, atomic variant such as double, int, ...) More...

#include <VariantDataModel.h>

+ Collaboration diagram for VariantDataModel:

Public Types

enum  VariantNodeType { Atomic , List , Map }
 The different types that can be stored in a VariantDataModel. More...
 

Public Member Functions

constructors

Default constructor: build an atomic invalid VariantDataModel

 VariantDataModel ()
 
 VariantDataModel (const QVariant &variant)
 Build an atomic VariantDataModel with the given variant value.
 
 VariantDataModel (const QVariantList &variant)
 Build a list VariantDataModel from the given variant list It recursively build the VariantDataModel (hence if the given variant contains atomic, list or map elements their VariantDataModel representation will be inserted in the list)
 
 VariantDataModel (const QVariantMap &variant)
 Build a map VariantDataModel from the given variant map It recursively build the VariantDataModel (hence if the given variant contains atomic, list or map elements their VariantDataModel representation will be inserted in the map)
 
 VariantDataModel (const VariantDataModel &other)
 Copy constructor.
 
informative methods

true if there was data modification since the instantiation or the last reset

bool isModified () const
 
bool isValid () const
 true if this is the invalid VariantDataModel
 
QString typeString () const
 either "Atomic", "List" or "Map"
 
QString getName ()
 same as typeString() (unused)
 
set/get/test

affectation to the given newValue (can be atomic, list or map)

VariantDataModeloperator= (QVariant newValue)
 
QVariant getValue () const
 get the encapsulated value (can be atomic, list or map)
 
QString toString () const
 Get the QVariant value as a string (for atomic type)
 
 operator QString () const
 utility function to automatically convert to QString in statement
 
QString toJsonString () const
 Get the string representing this model in JSON format:
 
void remove ()
 Clear all encapsulated data As this method renders the data model invalid (same effect as = QVariant()), this VariantDataModel will therefore not be added to its parent in the subsequent getValue(), toString()...
 
bool operator== (const VariantDataModel &other) const
 equality test (use QVariant/QVariantList/QVariantMap == operator)
 
bool operator== (const QVariant &v) const
 
bool operator== (const QVariantList &v) const
 
bool operator== (const QVariantMap &v) const
 
bool operator!= (const VariantDataModel &other) const
 inequality test (opposite of ==)
 
bool operator!= (const QVariant &v) const
 
bool operator!= (const QVariantList &v) const
 
bool operator!= (const QVariantMap &v) const
 
VariantDataModellast ()
 Returned value depends on the VariantDataModel type:
 
int size () const
 Returned value depends on the VariantDataModel type:
 
bool isEmpty () const
 Returned value depends on the VariantDataModel type:
 
void reset ()
 reset the modified flag (recursively for list and map)
 
Map management

This methods are useful when the VariantDataModel is a map

VariantDataModelvalue (const QString &key)
 Returned value depends on the VariantDataModel type:
 
VariantDataModeloperator[] (const QString &key)
 Returned value depends on the VariantDataModel type:
 
const VariantDataModel operator[] (const QString &key) const
 const version of operator[](QString)
 
bool contains (const QString &key) const
 Returned value depends on the VariantDataModel type:
 
void insert (const QString &key, const VariantDataModel &value)
 Behaviour depends on the VariantDataModel type:
 
void insert (const QString &key, const QVariant &value)
 Behaviour depends on the VariantDataModel type:
 
int remove (const QString &key)
 Behaviour and returned value depends on the VariantDataModel type:
 
List management

This methods are useful when the VariantDataModel is a List

VariantDataModelat (int i)
 Returned value depends on the VariantDataModel type:
 
VariantDataModeloperator[] (int i)
 same as at(int)
 
const VariantDataModel operator[] (int i) const
 const version of operator[](int)
 
bool removeOne (const VariantDataModel &item)
 Behaviour and returned value depends on the VariantDataModel type:
 
bool removeAt (int i)
 Behaviour and returned value depends on the VariantDataModel type:
 
void append (const VariantDataModel &item)
 Behaviour depends on the VariantDataModel type:
 
STL-style iterators
QList< VariantDataModel >::iterator begin ()
 Returns an STL-style iterator pointing to the first item in the list.
 
QList< VariantDataModel >::const_iterator begin () const
 const version of begin()
 
QList< VariantDataModel >::iterator end ()
 Returns an STL-style iterator pointing to the imaginary item after the last item in the list.
 
QList< VariantDataModel >::const_iterator end () const
 const version of end()
 
QMap< QString, VariantDataModel >::iterator beginMap ()
 Returns a STL-style iterator pointing to the first item in the map.
 
QMap< QString, VariantDataModel >::const_iterator beginMap () const
 const version of beginMap()
 
QMap< QString, VariantDataModel >::iterator endMap ()
 Returns an STL-style iterator pointing to the imaginary item after the last item in the map.
 
QMap< QString, VariantDataModel >::const_iterator endMap () const
 const version of endMap()
 

Static Public Member Functions

static utility method

Build the model from the given JSON string (must be representing a JSON object)

static const VariantDataModel fromJsonString (const QString &jsonString)
 
static const VariantDataModel fromJsonObject (const QJsonObject &jsonObject)
 Build the model from the given JSON object.
 
static VariantDataModelinvalid ()
 get the invalid VariantDataModel
 

Protected Member Functions

void setName (const QString &name)
 set the name of the VariantDataModel
 

Protected Attributes

bool isModifiedFlag
 true if there was a modification in the value, item or pair since instanciation or last reset
 
QString name
 name (unused, equals to typeString())
 
VariantNodeType type
 type can be Atomic, List or Map depending on how the VariantDataModel was instantiated
 

Static Protected Attributes

static VariantDataModel invalidVariantDataModel
 The default VariantDataModel, an Atomic VariantDataModel with invalid status.
 

Detailed Description

VariantDataModel encapsulates QVariant and can be used as a model for any type of QVariant supported data structure (map, list, atomic variant such as double, int, ...)

Advantages over QVariant

  • the data are accessed by reference to a VariantDataModel
  • in-place adding/removing/modifying data keeps the reference unchanged while updating the encapsulated QVariant (e.g., adding a element in an array is seen as "in place" and is not done in a new array)
  • STL algorithms can be used for list and maps

VariantDataModel supports atomic (single value QVariant such as string, numeric value), list (using QVariantList) and map (using QVariantMap).

VariantDataModel can be build directly from JSON string, JSON object, QVariant, QVariantList and QVariantMap. VariantDataModel offers utility methods to access, insert, remove data in place

Simple example ()

// use JSON string as input (you can also use JSON object, QVariantList, QVariantMap or QVariant)
QString rawInput = R"json({
"name":"foo",
"parameters":[
{"name":"bar","value":14},
{"name":"baz","value":"faz"}
]
})json";
// get a ref to part of the data model
VariantDataModel& parameters = dataModel["parameters"];
// get values and modify in place
parameters[0]["value"] = parameters[0]["value"].getValue().toInt() / 4.0;
parameters[1]["value"] = "fuz";
// create from QVariantMap
VariantDataModel anotherParam = QVariantMap();
// add key/value
anotherParam["name"] = "camitk";
anotherParam["value"] = true;
// append to existing data
parameters.append(anotherParam);
// also available:
// remove(), removeAt(..)
VariantDataModel encapsulates QVariant and can be used as a model for any type of QVariant supported ...
Definition VariantDataModel.h:124
QVariant getValue() const
get the encapsulated value (can be atomic, list or map)
Definition VariantDataModel.cpp:290
void append(const VariantDataModel &item)
Behaviour depends on the VariantDataModel type:
Definition VariantDataModel.cpp:619
static const VariantDataModel fromJsonString(const QString &jsonString)
Definition VariantDataModel.cpp:129

Usage example

std::cout << "Name: " << dataModel["name"].toString().toStdString() << std::endl; // "foo"
for (unsigned i = 0; i < parameters.size(); i++) {
std::cout << "- parameter " << i << ": name \"" << parameters[i]["name"].toString().toStdString() << "\", value: " << parameters[i]["value"].toString().toStdString() << std::endl;
}
QString toString() const
Get the QVariant value as a string (for atomic type)
Definition VariantDataModel.cpp:318
int size() const
Returned value depends on the VariantDataModel type:
Definition VariantDataModel.cpp:497

Prints

Name: foo
- parameter 0: name "bar", value: 3.5
- parameter 1: name "baz", value: fuz
- parameter 2: name "camitk", value: true
VariantDataModel & value(const QString &key)
Returned value depends on the VariantDataModel type:
Definition VariantDataModel.cpp:380
QString name
name (unused, equals to typeString())
Definition VariantDataModel.h:372

using STL

for (auto p : parameters) {
std::cout << "- parameter name \"" << p["name"].toString().toStdString() << "\", value: " << p["value"].toString().toStdString() << std::endl;
}
QString parameterToFind = "camitk";
auto itList = std::find_if(parameters.begin(), parameters.end(), [ &parameterToFind ](VariantDataModel const & p) {
return p["name"].toString() == parameterToFind;
});
std::cout << (itList != parameters.end()) << std::endl; // true
QString valueToFind = "foo";
auto itMap = std::find_if(dataModel.beginMap(), dataModel.endMap(), [&valueToFind](const QString & value) {
return value == valueToFind;
});
std::cout << "Key \"" << it.key() << "\" has value \"" << valueToFind \"" << std::endl;
QList< VariantDataModel >::iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list.
Definition VariantDataModel.cpp:694
QMap< QString, VariantDataModel >::iterator endMap()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map.
Definition VariantDataModel.cpp:712
QMap< QString, VariantDataModel >::iterator beginMap()
Returns a STL-style iterator pointing to the first item in the map.
Definition VariantDataModel.cpp:703
QList< VariantDataModel >::iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition VariantDataModel.cpp:685
Note
This class might need two additional members, depending on future usage:
  • getErrorStatus():bool
  • getErrorString():QString instead of using std::cerr for warning and errors

Member Enumeration Documentation

◆ VariantNodeType

The different types that can be stored in a VariantDataModel.

Enumerator
Atomic 

Atomic type (string, numeric values, boolean)

List 

List of VariantDataModel.

Map 

Map of <QString (key), VariantDataModel (value)>

Constructor & Destructor Documentation

◆ VariantDataModel() [1/5]

VariantDataModel::VariantDataModel ( )

References Atomic, isModifiedFlag, name, and type.

Referenced by insert(), and VariantDataModel().

+ Here is the caller graph for this function:

◆ VariantDataModel() [2/5]

VariantDataModel::VariantDataModel ( const QVariant &  variant)

Build an atomic VariantDataModel with the given variant value.

Note
no type check are done, any QVariant apart from QVariantList and QVariantMap can be stored in an atomic VariantDataModel. The user is responsible to ensure this is coherent with its data model structure

References Atomic, isModifiedFlag, List, name, type, typeString(), and VariantDataModel().

+ Here is the call graph for this function:

◆ VariantDataModel() [3/5]

VariantDataModel::VariantDataModel ( const QVariantList &  variant)

Build a list VariantDataModel from the given variant list It recursively build the VariantDataModel (hence if the given variant contains atomic, list or map elements their VariantDataModel representation will be inserted in the list)

References isModifiedFlag, List, name, type, and typeString().

+ Here is the call graph for this function:

◆ VariantDataModel() [4/5]

VariantDataModel::VariantDataModel ( const QVariantMap &  variant)

Build a map VariantDataModel from the given variant map It recursively build the VariantDataModel (hence if the given variant contains atomic, list or map elements their VariantDataModel representation will be inserted in the map)

References isModifiedFlag, Map, name, type, and typeString().

+ Here is the call graph for this function:

◆ VariantDataModel() [5/5]

VariantDataModel::VariantDataModel ( const VariantDataModel other)

Copy constructor.

References isModifiedFlag, name, and type.

Member Function Documentation

◆ append()

void VariantDataModel::append ( const VariantDataModel item)

Behaviour depends on the VariantDataModel type:

  • for list: adds the given item to the list
  • for atomic and mpa: does nothing

References getValue(), isModifiedFlag, List, type, and typeString().

Referenced by CamiTKExtensionModelPresenter::plusButtonClicked(), and CamiTKPropertyListFieldEditor::plusButtonClicked().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ at()

VariantDataModel & VariantDataModel::at ( int  i)

Returned value depends on the VariantDataModel type:

  • For list: returns the i-th element
  • For map and atomic value: returns an invalid VariantDataModel

References invalid(), List, type, and typeString().

Referenced by operator[]().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ begin() [1/2]

QList< VariantDataModel >::iterator VariantDataModel::begin ( )

Returns an STL-style iterator pointing to the first item in the list.

Note
if the list is empty or if this VariantDataModel is not a list, this is the same as end()

◆ begin() [2/2]

QList< VariantDataModel >::const_iterator VariantDataModel::begin ( ) const

const version of begin()

◆ beginMap() [1/2]

QMap< QString, VariantDataModel >::iterator VariantDataModel::beginMap ( )

Returns a STL-style iterator pointing to the first item in the map.

Note
if the map is empty or if this VariantDataModel is not a map, this is the same as endMap()

◆ beginMap() [2/2]

QMap< QString, VariantDataModel >::const_iterator VariantDataModel::beginMap ( ) const

const version of beginMap()

◆ contains()

bool VariantDataModel::contains ( const QString &  key) const

Returned value depends on the VariantDataModel type:

  • For map: returns true if the map contains the given key
  • For atomic or list: returns false

References Map, type, and typeString().

Referenced by CamiTKExtensionModel::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end() [1/2]

QList< VariantDataModel >::iterator VariantDataModel::end ( )

Returns an STL-style iterator pointing to the imaginary item after the last item in the list.

Note
if the list is empty or if this VariantDataModel is not a list, this is the same as begin()

◆ end() [2/2]

QList< VariantDataModel >::const_iterator VariantDataModel::end ( ) const

const version of end()

◆ endMap() [1/2]

QMap< QString, VariantDataModel >::iterator VariantDataModel::endMap ( )

Returns an STL-style iterator pointing to the imaginary item after the last item in the map.

Note
if the map is empty or if this VariantDataModel is not a map, this is the same as beginMap()

◆ endMap() [2/2]

QMap< QString, VariantDataModel >::const_iterator VariantDataModel::endMap ( ) const

const version of endMap()

◆ fromJsonObject()

const VariantDataModel VariantDataModel::fromJsonObject ( const QJsonObject &  jsonObject)
static

Build the model from the given JSON object.

References isModifiedFlag, Map, name, type, and typeString().

+ Here is the call graph for this function:

◆ fromJsonString()

const VariantDataModel VariantDataModel::fromJsonString ( const QString &  jsonString)
static

References isModifiedFlag, Map, name, type, and typeString().

+ Here is the call graph for this function:

◆ getName()

QString VariantDataModel::getName ( )

same as typeString() (unused)

References name.

Referenced by QtPropertyFieldEditor::getWidget().

+ Here is the caller graph for this function:

◆ getValue()

QVariant VariantDataModel::getValue ( ) const

get the encapsulated value (can be atomic, list or map)

References Atomic, List, and type.

Referenced by append(), CamiTKPropertyFieldEditor::buildTypeDependentEditors(), camitk::CppHotPlugAction::CppHotPlugAction(), ExtensionGenerator::generate(), ListFieldEditor::getWidget(), camitk::HotPlugAction::HotPlugAction(), camitk::HotPlugActionExtension::HotPlugActionExtension(), QtPropertyFieldEditor::QtPropertyFieldEditor(), removeOne(), CamiTKExtensionModel::toJSON(), and toString().

+ Here is the caller graph for this function:

◆ insert() [1/2]

void VariantDataModel::insert ( const QString &  key,
const QVariant &  value 
)

Behaviour depends on the VariantDataModel type:

  • For map: insert the given pair to the map (with recursive encapsulation of the given variant)
  • For atom and list: does nothing

References insert(), Map, toString(), type, typeString(), value(), and VariantDataModel().

+ Here is the call graph for this function:

◆ insert() [2/2]

void VariantDataModel::insert ( const QString &  key,
const VariantDataModel value 
)

Behaviour depends on the VariantDataModel type:

  • For map: insert the given pair to the map
  • For atom and list: does nothing

References isModifiedFlag, Map, type, typeString(), and value().

Referenced by insert(), and CamiTKExtensionModel::resetModel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ invalid()

VariantDataModel & VariantDataModel::invalid ( )
static

get the invalid VariantDataModel

References invalidVariantDataModel.

Referenced by at(), isValid(), operator[](), operator[](), operator[](), and value().

+ Here is the caller graph for this function:

◆ isEmpty()

bool VariantDataModel::isEmpty ( ) const

Returned value depends on the VariantDataModel type:

  • for atomic: returns true if this is an invalid VariantDataModel, false otherwise
  • for list: returns true if the list is empty
  • for map: returns true if the map is empty

References Atomic, List, and type.

Referenced by size().

+ Here is the caller graph for this function:

◆ isModified()

bool VariantDataModel::isModified ( ) const

References Atomic, isModifiedFlag, List, and type.

Referenced by CamiTKExtensionModel::isModified().

+ Here is the caller graph for this function:

◆ isValid()

bool VariantDataModel::isValid ( ) const

true if this is the invalid VariantDataModel

References invalid().

Referenced by ActionTabPresenter::ActionTabPresenter(), CamiTKPropertyFieldEditor::buildTypeDependentEditors(), CamiTKExtensionModelPresenter::CamiTKExtensionModelPresenter(), ExtensionTabPresenter::ExtensionTabPresenter(), CamiTKExtensionModelPresenter::isHotPlug(), CamiTKExtensionModelPresenter::isPython(), camitk::HotPlugActionExtension::newHotPlugActionExtension(), and CamiTKExtensionModelPresenter::tabCloseRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ last()

VariantDataModel & VariantDataModel::last ( )

Returned value depends on the VariantDataModel type:

  • For atomic: returns (*this)
  • For list: returns the last element of the list
  • For map: returns the last value of the map

References Atomic, List, and type.

Referenced by CamiTKExtensionModelPresenter::plusButtonClicked(), and CamiTKPropertyListFieldEditor::plusButtonClicked().

+ Here is the caller graph for this function:

◆ operator QString()

VariantDataModel::operator QString ( ) const

utility function to automatically convert to QString in statement

◆ operator!=() [1/4]

bool VariantDataModel::operator!= ( const QVariant &  v) const

◆ operator!=() [2/4]

bool VariantDataModel::operator!= ( const QVariantList &  v) const

◆ operator!=() [3/4]

bool VariantDataModel::operator!= ( const QVariantMap &  v) const

◆ operator!=() [4/4]

bool VariantDataModel::operator!= ( const VariantDataModel other) const

inequality test (opposite of ==)

◆ operator=()

VariantDataModel & VariantDataModel::operator= ( QVariant  newValue)

References Atomic, List, Map, and type.

◆ operator==() [1/4]

bool VariantDataModel::operator== ( const QVariant &  v) const

References Atomic, List, and type.

◆ operator==() [2/4]

bool VariantDataModel::operator== ( const QVariantList &  v) const

◆ operator==() [3/4]

bool VariantDataModel::operator== ( const QVariantMap &  v) const

◆ operator==() [4/4]

bool VariantDataModel::operator== ( const VariantDataModel other) const

equality test (use QVariant/QVariantList/QVariantMap == operator)

References Atomic, List, and type.

◆ operator[]() [1/4]

VariantDataModel & VariantDataModel::operator[] ( const QString &  key)

Returned value depends on the VariantDataModel type:

  • For map: this is the same as value(...)
  • For list: if the key represents an int (e.g. "42"), this methods acts as operator[](int i), otherwise it returns an invalid VariantDataModel
  • For atomic value: returns an invalid VariantDataModel
    Returns
    invalid variant if the key si not present in the map

References invalid(), List, Map, type, and typeString().

+ Here is the call graph for this function:

◆ operator[]() [2/4]

const VariantDataModel VariantDataModel::operator[] ( const QString &  key) const

const version of operator[](QString)

References invalid(), List, Map, type, and typeString().

+ Here is the call graph for this function:

◆ operator[]() [3/4]

VariantDataModel & VariantDataModel::operator[] ( int  i)

same as at(int)

References at().

+ Here is the call graph for this function:

◆ operator[]() [4/4]

const VariantDataModel VariantDataModel::operator[] ( int  i) const

const version of operator[](int)

References invalid(), List, type, and typeString().

+ Here is the call graph for this function:

◆ remove() [1/2]

void VariantDataModel::remove ( )

Clear all encapsulated data As this method renders the data model invalid (same effect as = QVariant()), this VariantDataModel will therefore not be added to its parent in the subsequent getValue(), toString()...

It is still present in the parent VariantDataModel (as there are no members that links the current VariantDataModel to its parent), but can be considered as removed as it won't be added to the value in any subsequent getValue(), toString()...

References Atomic, isModifiedFlag, and type.

Referenced by CamiTKPropertyFieldEditor::buildTypeDependentEditors(), FieldEditor::deleteButtonClicked(), and CamiTKExtensionModelPresenter::tabCloseRequest().

+ Here is the caller graph for this function:

◆ remove() [2/2]

int VariantDataModel::remove ( const QString &  key)

Behaviour and returned value depends on the VariantDataModel type:

  • For map: removes all the item that have the given keyp and return the number of items removed (1 if the key exists, 0 otherwise)
  • For atomic or list: does nothing, returns 0

References isModifiedFlag, Map, type, and typeString().

+ Here is the call graph for this function:

◆ removeAt()

bool VariantDataModel::removeAt ( int  i)

Behaviour and returned value depends on the VariantDataModel type:

  • For list: removes the item at index position i. If i is not a valid index (i.e., 0 <= i < size()), the VariantDataModel stays unmodified. Return true on success; otherwise returns false.
  • for atomic and mpa: does nothing, returns false

References isModifiedFlag, List, type, and typeString().

+ Here is the call graph for this function:

◆ removeOne()

bool VariantDataModel::removeOne ( const VariantDataModel item)

Behaviour and returned value depends on the VariantDataModel type:

  • For list: removes the first occurrence of the item with the given value and returns true on success; otherwise returns false.
  • For atomic and map: does nothing, returns false

References getValue(), isModifiedFlag, List, type, and typeString().

+ Here is the call graph for this function:

◆ reset()

void VariantDataModel::reset ( )

reset the modified flag (recursively for list and map)

References isModifiedFlag.

Referenced by CamiTKExtensionModel::save().

+ Here is the caller graph for this function:

◆ setName()

void VariantDataModel::setName ( const QString &  name)
protected

set the name of the VariantDataModel

References name.

◆ size()

int VariantDataModel::size ( ) const

Returned value depends on the VariantDataModel type:

  • For atomic: returns 1 is this is not empty (i.e., if it is a valid VariantDataModel) otherwise returns 0
  • For list: returns the list size
  • For map: returns the map size

References Atomic, isEmpty(), List, and type.

Referenced by ActionTabPresenter::ActionTabPresenter(), CamiTKExtensionModelPresenter::CamiTKExtensionModelPresenter(), camitk::HotPlugActionExtension::declaredActionCount(), camitk::CppHotPlugActionExtension::initActions(), and CamiTKExtensionModelPresenter::plusButtonClicked().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toJsonString()

QString VariantDataModel::toJsonString ( ) const

Get the string representing this model in JSON format:

  • an Atomic returns the quoted value for strings (same as toString() but with quotes), not quoted for any other atomic values
  • a List returns the equivalent JSON array ("[ ..., ... ]")
  • a Map returns the equivalent JSON object ("{ ..., ... }")

References Atomic, List, and type.

◆ toString()

QString VariantDataModel::toString ( ) const

Get the QVariant value as a string (for atomic type)

Warning
For list and map this will return an empty string (use toJsonString() if you want the json equivalent of a VariantDataModel)

References getValue().

Referenced by CamiTKPropertyFieldEditor::buildTypeDependentEditors(), QtPropertyFieldEditor::getWidget(), insert(), CamiTKExtensionModelPresenter::isHotPlug(), CamiTKExtensionModelPresenter::isPython(), and camitk::HotPlugActionExtension::newHotPlugActionExtension().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ typeString()

QString VariantDataModel::typeString ( ) const

either "Atomic", "List" or "Map"

Returns

References Atomic, List, and type.

Referenced by append(), at(), contains(), fromJsonObject(), fromJsonString(), insert(), insert(), operator[](), operator[](), operator[](), remove(), removeAt(), removeOne(), value(), VariantDataModel(), VariantDataModel(), and VariantDataModel().

+ Here is the caller graph for this function:

◆ value()

VariantDataModel & VariantDataModel::value ( const QString &  key)

Returned value depends on the VariantDataModel type:

  • for map: returns the value corresponding given key
  • for atomic or list: returns an invalid VariantDataModel
Note
for map: if the key is not in the map, it will be created and the returned value will be an invalid VariantDataModel

References invalid(), Map, type, and typeString().

Referenced by insert(), and insert().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ invalidVariantDataModel

VariantDataModel VariantDataModel::invalidVariantDataModel
staticprotected

The default VariantDataModel, an Atomic VariantDataModel with invalid status.

Referenced by invalid().

◆ isModifiedFlag

bool VariantDataModel::isModifiedFlag
protected

true if there was a modification in the value, item or pair since instanciation or last reset

Referenced by append(), fromJsonObject(), fromJsonString(), insert(), isModified(), remove(), remove(), removeAt(), removeOne(), reset(), VariantDataModel(), VariantDataModel(), VariantDataModel(), VariantDataModel(), and VariantDataModel().

◆ name

QString VariantDataModel::name
protected

◆ type


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