KLDAP Library
ldapmodelnode_p.h
00001 /* 00002 This file is part of libkldap. 00003 Copyright (c) 2006 Sean Harmer <sh@theharmers.co.uk> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library 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 GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 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
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:09:14 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:09:14 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.