1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

update qqt dictionary

This commit is contained in:
tianduanrui 2018-03-04 10:21:54 +08:00
parent 922c96a7ba
commit 1c5a007643
3 changed files with 32 additions and 30 deletions

View File

@ -39,8 +39,7 @@ lessThan(QT_VERSION , 5.8.0):SUBDIRS -= examples/qqtudpexample
#greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += examples/QtSdkManager
#greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += demo/VegeTablesPrice
#SUBDIRS += examples/GuiBuildTool
#
SUBDIRS += test/LearnCookieTest
#SUBDIRS += test/LearnCookieTest
##-----------------------------------------------------------------
##some test project
##-----------------------------------------------------------------

View File

@ -1,4 +1,4 @@
#include "qqtdictionary.h"
#include "qqtdictionary.h"
QQtDictNode::QQtDictNode ( QObject* parent ) :
QObject ( parent )
@ -70,7 +70,7 @@ void QQtDictNode::insertChild ( int index, const QQtDictNode& dict )
{
m_type = DictList;
//m_list.insert ( index, dict );
this->operator [](index) = dict;
this->operator [] ( index ) = dict;
}
void QQtDictNode::insertChild ( const QString& key, const QString& value )
@ -110,26 +110,26 @@ bool QQtDictNode::isEmpty() const
switch ( m_type )
{
case DictValue:
if ( !m_value.isNull() )
isEmpty = false;
case DictValue:
if ( !m_value.isNull() )
isEmpty = false;
break;
break;
case DictList:
if ( !m_list.isEmpty() )
isEmpty = false;
case DictList:
if ( !m_list.isEmpty() )
isEmpty = false;
break;
break;
case DictMap:
if ( !m_map.isEmpty() )
isEmpty = false;
case DictMap:
if ( !m_map.isEmpty() )
isEmpty = false;
break;
break;
default:
break;
default:
break;
}
return isEmpty;
@ -171,6 +171,7 @@ bool QQtDictNode::hasChild ( const QQtDictNode& value ) const
{
bool has = false;
//对于list不同于maplist当中value相等就是包含。
if ( m_list.contains ( value ) )
has = true;
@ -286,22 +287,22 @@ QQtDictNode& QQtDictNode::operator = ( const QQtDictNode& other )
switch ( type )
{
case DictValue:
m_value = other.getValue() ;
break;
case DictValue:
m_value = other.getValue() ;
break;
case DictList:
m_list = other.getList();
case DictList:
m_list = other.getList();
break;
break;
case DictMap:
m_map = other.getMap();
case DictMap:
m_map = other.getMap();
break;
break;
default:
break;
default:
break;
}
m_type = type;

View File

@ -1,4 +1,4 @@
#ifndef QQTDICTIONARY_H
#ifndef QQTDICTIONARY_H
#define QQTDICTIONARY_H
#include <QObject>
@ -14,9 +14,11 @@
class QQtDictNode;
typedef QMap<QString, QQtDictNode> QQtMapNode;
typedef QMapIterator<QString, QQtDictNode> QQtMapNodeIterator;
typedef QMutableMapIterator<QString, QQtDictNode> QQtMutableMapNodeIterator;
typedef QList<QQtDictNode> QQtListNode;
typedef QListIterator<QQtDictNode> QQtListNodeIterator;
typedef QMutableListIterator<QQtDictNode> QQtMutableListNodeIterator;
/**
* @brief The QQtDictionary class