Rabbit Remote Control 0.1.0-bate14
Loading...
Searching...
No Matches
CDatabaseTree Class Reference

The CDatabaseTree class. More...

#include <DatabaseTree.h>

Inheritance diagram for CDatabaseTree:
Collaboration diagram for CDatabaseTree:

Signals

void sigAddNode (int id, int parentId)
void sigAdd (int id, int parentId)
Signals inherited from CDatabase
void sigChanged ()

Public Member Functions

 CDatabaseTree (const QString &szPrefix=QString(), QObject *parent=nullptr)
virtual int Add (const TreeItem &item)
 Add item.
virtual bool Update (const TreeItem &item)
virtual bool Delete (int id, bool delKey=false)
virtual bool Delete (QList< int > items, bool delKey=false)
virtual bool DeleteChild (int parentId, bool delKey=false)
virtual bool Move (int id, int newParent)
TreeItem GetLeaf (int id)
QList< TreeItemGetLeaves (int nodeId)
 Get the leaves under nodeId.
QList< TreeItemGetLeavesByKey (int key)
 Get leaves.
QList< TreeItemGetLeavesByKey (QList< int > key)
int GetLeafCount (int parentId=0)
virtual int AddNode (const QString &name, int parentId=0)
virtual bool RenameNode (int id, const QString &newName)
virtual bool DeleteNode (int id, bool delKey=false)
virtual bool MoveNode (int id, int newParentId)
TreeItem GetNode (int id)
QList< TreeItemGetAllNodes ()
QList< TreeItemGetSubNodes (int parentId)
int GetNodeCount (int nParentId=0)
int GetCount (int parentId=0)
 Get the count of parentId.
virtual bool ExportToJson (QJsonObject &obj) override
virtual bool ImportFromJson (const QJsonObject &obj) override
Public Member Functions inherited from CDatabase
 CDatabase (QObject *parent=nullptr)
QSqlDatabase GetDatabase () const
virtual bool IsOpen () const
void CloseDatabase ()
 Close database.
const CParameterDatabaseGetParameter () const
const QString GetError () const
bool SetDatabase (const CDatabase *db)
 Share an existing database.
bool SetDatabase (const QSqlDatabase db, const CParameterDatabase *pPara)
 Share an existing database.
bool OpenDatabase (const CParameterDatabase *pPara=nullptr, const QString &szConnectName=QString())
 Open a new database.
bool OpenMySqlDatabase (const CParameterDatabase *pPara, const QString &szConnectName=QString())
bool OpenODBCDatabase (const CParameterDatabase *pPara, const QString &szConnectName=QString())
bool OpenSQLiteDatabase (const CParameterDatabase *pPara, const QString &szConnectionName=QString())
bool OpenSQLiteDatabase (const QString &szFile, const QString &szConnectionName=QString())
virtual bool ExportToJsonFile (const QString &szFile)
virtual bool ImportFromJsonFile (const QString &szFile)

Protected Member Functions

virtual bool OnDeleteKey (int key)
virtual bool OnInitializeDatabase () override
 Initialize database.
virtual bool OnInitializeSqliteDatabase () override
virtual bool OnInitializeMySqlDatabase () override
Protected Member Functions inherited from CDatabase
void SetError (const QString &szErr=QString())

Private Attributes

QString m_szTableName
CDatabaseNode m_FolderDB

Additional Inherited Members

Protected Attributes inherited from CDatabase
QString m_szConnectName
QString m_MinVersion
const CParameterDatabasem_pPara

Detailed Description

The CDatabaseTree class.

Definition at line 109 of file DatabaseTree.h.

Constructor & Destructor Documentation

◆ CDatabaseTree()

CDatabaseTree::CDatabaseTree ( const QString & szPrefix = QString(),
QObject * parent = nullptr )
explicit

Definition at line 528 of file DatabaseTree.cpp.

Member Function Documentation

◆ Add()

int CDatabaseTree::Add ( const TreeItem & item)
virtual

Add item.

Parameters
item
Returns
> 0 , id of added item. = 0 , failed

Definition at line 615 of file DatabaseTree.cpp.

◆ AddNode()

int CDatabaseTree::AddNode ( const QString & name,
int parentId = 0 )
virtual

Definition at line 981 of file DatabaseTree.cpp.

◆ Delete() [1/2]

bool CDatabaseTree::Delete ( int id,
bool delKey = false )
virtual

Definition at line 710 of file DatabaseTree.cpp.

◆ Delete() [2/2]

bool CDatabaseTree::Delete ( QList< int > items,
bool delKey = false )
virtual

Definition at line 738 of file DatabaseTree.cpp.

◆ DeleteChild()

bool CDatabaseTree::DeleteChild ( int parentId,
bool delKey = false )
virtual

Definition at line 778 of file DatabaseTree.cpp.

◆ DeleteNode()

bool CDatabaseTree::DeleteNode ( int id,
bool delKey = false )
virtual

Definition at line 991 of file DatabaseTree.cpp.

◆ ExportToJson()

bool CDatabaseTree::ExportToJson ( QJsonObject & obj)
nodiscardoverridevirtual

Reimplemented from CDatabase.

Definition at line 1036 of file DatabaseTree.cpp.

◆ GetAllNodes()

QList< TreeItem > CDatabaseTree::GetAllNodes ( )
nodiscard

Definition at line 1011 of file DatabaseTree.cpp.

◆ GetCount()

int CDatabaseTree::GetCount ( int parentId = 0)
nodiscard

Get the count of parentId.

include nodes and leaves

Parameters
parentId0, Get all count
Returns

Definition at line 1026 of file DatabaseTree.cpp.

◆ GetLeaf()

TreeItem CDatabaseTree::GetLeaf ( int id)
nodiscard

Definition at line 818 of file DatabaseTree.cpp.

◆ GetLeafCount()

int CDatabaseTree::GetLeafCount ( int parentId = 0)
nodiscard

Definition at line 961 of file DatabaseTree.cpp.

◆ GetLeaves()

QList< TreeItem > CDatabaseTree::GetLeaves ( int nodeId)
nodiscard

Get the leaves under nodeId.

Parameters
nodeId
  • < 0: Get all leaves
  • >= 0: Get the leaves under the node

Definition at line 852 of file DatabaseTree.cpp.

◆ GetLeavesByKey() [1/2]

QList< TreeItem > CDatabaseTree::GetLeavesByKey ( int key)
nodiscard

Get leaves.

Parameters
valueGet the leaves of value

Definition at line 887 of file DatabaseTree.cpp.

◆ GetLeavesByKey() [2/2]

QList< TreeItem > CDatabaseTree::GetLeavesByKey ( QList< int > key)
nodiscard

Definition at line 920 of file DatabaseTree.cpp.

◆ GetNode()

TreeItem CDatabaseTree::GetNode ( int id)
nodiscard

Definition at line 1006 of file DatabaseTree.cpp.

◆ GetNodeCount()

int CDatabaseTree::GetNodeCount ( int nParentId = 0)
nodiscard

Definition at line 1021 of file DatabaseTree.cpp.

◆ GetSubNodes()

QList< TreeItem > CDatabaseTree::GetSubNodes ( int parentId)
nodiscard

Definition at line 1016 of file DatabaseTree.cpp.

◆ ImportFromJson()

bool CDatabaseTree::ImportFromJson ( const QJsonObject & obj)
nodiscardoverridevirtual

Reimplemented from CDatabase.

Definition at line 1072 of file DatabaseTree.cpp.

◆ Move()

bool CDatabaseTree::Move ( int id,
int newParent )
virtual

Definition at line 801 of file DatabaseTree.cpp.

◆ MoveNode()

bool CDatabaseTree::MoveNode ( int id,
int newParentId )
virtual

Definition at line 1001 of file DatabaseTree.cpp.

◆ OnDeleteKey()

bool CDatabaseTree::OnDeleteKey ( int key)
nodiscardprotectedvirtual

Definition at line 1031 of file DatabaseTree.cpp.

◆ OnInitializeDatabase()

bool CDatabaseTree::OnInitializeDatabase ( )
nodiscardoverrideprotectedvirtual

Initialize database.

Returns

Reimplemented from CDatabase.

Reimplemented in CFavoriteDatabase.

Definition at line 538 of file DatabaseTree.cpp.

◆ OnInitializeMySqlDatabase()

bool CDatabaseTree::OnInitializeMySqlDatabase ( )
nodiscardoverrideprotectedvirtual

Reimplemented from CDatabase.

Definition at line 585 of file DatabaseTree.cpp.

◆ OnInitializeSqliteDatabase()

bool CDatabaseTree::OnInitializeSqliteDatabase ( )
nodiscardoverrideprotectedvirtual

Reimplemented from CDatabase.

Definition at line 553 of file DatabaseTree.cpp.

◆ RenameNode()

bool CDatabaseTree::RenameNode ( int id,
const QString & newName )
virtual

Definition at line 986 of file DatabaseTree.cpp.

◆ Update()

bool CDatabaseTree::Update ( const TreeItem & item)
virtual

Definition at line 673 of file DatabaseTree.cpp.

Member Data Documentation

◆ m_FolderDB

CDatabaseNode CDatabaseTree::m_FolderDB
private

Definition at line 190 of file DatabaseTree.h.

◆ m_szTableName

QString CDatabaseTree::m_szTableName
private

Definition at line 189 of file DatabaseTree.h.


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