00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#ifndef GM_TREE_H
00025
#define GM_TREE_H
00026
00027
#include <string>
00028
#include "gm/xmlnode.h"
00029
00030
namespace GNUMessenger {
00031
00032
using namespace std;
00033
class Contact;
00034
00043 class Folder:
public XMLNode
00044 {
00045
public:
00046
00047
Folder();
00048
00049
Folder(
const Folder& tree);
00050
Folder(
const string& xml);
00051
00052
virtual ~
Folder();
00053
00054
virtual const string type()
const {
return "folder"; }
00055
00056 virtual const string&
name()
const { m_name =
property(
"name");
return m_name; }
00057 virtual XMLNode&
setName(
const string& name) {
setProperty(
"name", name);
return *
this; }
00058
00059
int countContacts()
const {
return numChildren(
"contact"); }
00060
int countFolders()
const {
return numChildren(
"folder"); }
00061
00062 Contact addContact(
const string& name);
00063 Contact addContact(
const Contact& contact);
00064
00065 Folder addFolder(
const string& name);
00066 Folder addFolder(
const Folder& Folder);
00067
00068 Contact getContact(
const string& name)
const;
00069 Folder getFolder(
const string& name)
const;
00070
00071 Contact contactAt(
int index)
const;
00072 Folder folderAt(
int index)
const;
00073
00076 Folder&
operator=(
const Folder &other);
00077
00078
00079
private:
00080
00081
00082
00083
00084
mutable string m_name;
00085
00086 };
00087
00088 }
00089
00090
#endif