]> AND Private Git Repository - blast.git/blob - BlockLibraryTree.h
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
f8fa60c3f0b1e37bc650b312977dda9a2d63150a
[blast.git] / BlockLibraryTree.h
1 #ifndef __BLOCKLIBRARYTREE_H__
2 #define __BLOCKLIBRARYTREE_H__
3
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <fcntl.h>
7 #include <signal.h>
8
9 #include <iostream>
10 #include <fstream>
11
12 #include <QtCore>
13
14 #include "BlockCategory.h"
15 #include "Exception.h"
16
17 using namespace std;
18 using namespace Qt;
19 class BlockCategory;
20 class BlockLibraryTree {
21
22 public :
23   BlockLibraryTree();
24   ~BlockLibraryTree();
25
26   void clear(); // free thewhole tree
27   void clearBlocks(); // just remove the blocks from the BlockCateogry lists
28   void addItem(QXmlAttributes &attributes);
29   bool initChildParent();
30
31   BlockCategory *getRoot();
32   BlockCategory *searchCategory(int id);
33
34   QDomElement save(QDomDocument &doc);
35   void load(QDomElement &elt) throw(Exception);
36 private:
37   /* NOTE :
38      This class builds a tree of BlockCategory, but it also stores all BlockCategory object
39      in an array so that access via an id is direct.
40
41      The root of the tree is in fact tabCategories[0]
42    */
43   BlockCategory** tabCategories;
44   int* tabIdParent;
45   int nbCategories;
46
47 };
48
49
50 #endif // BLOCKLIBRARYTREE_H