00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KLDAP_LDAPMODELNODE_P_H
00022 #define KLDAP_LDAPMODELNODE_P_H
00023
00024 #include <QByteArray>
00025 #include <QString>
00026 #include <QtCore/QList>
00027 #include <QtCore/QVariant>
00028
00029 #include "ldapdn.h"
00030 #include "ldapobject.h"
00031 #include "kldap_export.h"
00032
00033 namespace KLDAP {
00034
00035 class LdapModelDNNode;
00036
00040 class LdapModelNode
00041 {
00042 public:
00043 explicit LdapModelNode( LdapModelDNNode *parent = 0 );
00044 virtual ~LdapModelNode();
00045
00046 enum NodeType {
00047 DN,
00048 Attr
00049 };
00050
00051 virtual NodeType nodeType() const = 0;
00052
00053 LdapModelDNNode *parent();
00054 int columnCount() const { return 2; }
00055 int row() const;
00056
00057 void setPopulated( bool b ) { m_isPopulated = b; }
00058 bool isPopulated() const { return m_isPopulated; }
00059
00060 private:
00061 LdapModelDNNode *m_parent;
00062 bool m_isPopulated;
00063 };
00064
00068 class LdapModelDNNode : public LdapModelNode
00069 {
00070 public:
00071 explicit LdapModelDNNode( LdapModelDNNode *parent = 0,
00072 const LdapDN &dn = LdapDN() );
00073 ~LdapModelDNNode();
00074
00075 LdapModelNode::NodeType nodeType() const
00076 { return LdapModelNode::DN; }
00077
00078 void appendChild( LdapModelNode *pItem );
00079 LdapModelNode *child( int row );
00080 int childCount() const { return m_childItems.size(); }
00081 const QList<LdapModelNode*>& children() const
00082 { return m_childItems; }
00083
00084 const LdapDN &dn() const { return m_dn; }
00085
00092 void setLdapObject( const LdapObject &object );
00093
00094 private:
00095 QList<LdapModelNode*> m_childItems;
00096 LdapDN m_dn;
00097 };
00098
00102 class LdapModelAttrNode : public LdapModelNode
00103 {
00104 public:
00105 explicit LdapModelAttrNode( LdapModelDNNode *parent = 0,
00106 const QString &attrName = QString(),
00107 const QByteArray &attrData = QByteArray() );
00108 ~LdapModelAttrNode();
00109
00110 LdapModelNode::NodeType nodeType() const
00111 { return LdapModelNode::Attr; }
00112
00113 const QString &attributeName() { return m_attrName; }
00114 const QByteArray &attributeData() { return m_attrData; }
00115
00116 private:
00117 QString m_attrName;
00118 QByteArray m_attrData;
00119 };
00120
00121 }
00122
00123 #endif