• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kget

bnode.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Joris Guisson                                   *
00003  *   joris.guisson@gmail.com                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.             *
00019  ***************************************************************************/
00020 #ifndef BTBNODE_H
00021 #define BTBNODE_H
00022 
00023 #include <QList>
00024 #include <util/constants.h>
00025 #include <btcore_export.h>
00026 #include "value.h"
00027 
00028 
00029 namespace bt
00030 {
00031     class BListNode;
00032 
00040     class BTCORE_EXPORT BNode
00041     {
00042     public:
00043         enum Type
00044         {
00045             VALUE,DICT,LIST
00046         };
00047         
00054         BNode(Type type,Uint32 off);
00055         virtual ~BNode();
00056 
00058         Type getType() const {return type;}
00059 
00061         Uint32 getOffset() const {return off;}
00062 
00064         Uint32 getLength() const {return len;}
00065 
00067         void setLength(Uint32 l) {len = l;}
00068 
00070         virtual void printDebugInfo() = 0;
00071     private:
00072         Type type;
00073         Uint32 off,len;
00074     };
00075 
00082     class BTCORE_EXPORT BValueNode : public BNode
00083     {
00084         Value v;
00085     public:
00086         BValueNode(const Value & v,Uint32 off);
00087         virtual ~BValueNode();
00088         
00089         const Value & data() const {return v;}
00090         void printDebugInfo();
00091     };
00092 
00098     class BTCORE_EXPORT BDictNode : public BNode
00099     {
00100         struct DictEntry
00101         {
00102             QByteArray key;
00103             BNode* node;
00104         };
00105         QList<DictEntry> children;
00106     public:
00107         BDictNode(Uint32 off);
00108         virtual ~BDictNode();
00109         
00115         void insert(const QByteArray & key,BNode* node);
00116         
00122         BNode* getData(const QString & key);
00123 
00129         BListNode* getList(const QString & key);
00130 
00136         BDictNode* getDict(const QString & key);
00137         
00143         BDictNode* getDict(const QByteArray & key);
00144 
00150         BValueNode* getValue(const QString & key);
00151         
00152         void printDebugInfo();
00153     };
00154 
00160     class BTCORE_EXPORT BListNode : public BNode
00161     {
00162         QList<BNode*> children;
00163     public:
00164         BListNode(Uint32 off);
00165         virtual ~BListNode();
00166 
00171         void append(BNode* node);
00172         void printDebugInfo();
00173 
00175         Uint32 getNumChildren() const {return children.count();}
00176         
00182         BNode* getChild(Uint32 idx) {return children.at(idx);}
00183 
00190         BListNode* getList(Uint32 idx);
00191 
00198         BDictNode* getDict(Uint32 idx);
00199 
00206         BValueNode* getValue(Uint32 idx);
00207     };
00208 }
00209 
00210 #endif

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal