author | Mitch Watrous <watrous@u.washington.edu> |
Mon, 21 Mar 2011 11:26:56 -0700 | |
changeset 6925 | 43d9c7eedf7b |
parent 5995 | 017e7a1cfa7c |
child 7903 | eed953cd94a0 |
permissions | -rw-r--r-- |
5992
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
2 |
/* |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
3 |
* This program is free software; you can redistribute it and/or modify |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
4 |
* it under the terms of the GNU General Public License version 2 as |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
5 |
* published by the Free Software Foundation; |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
6 |
* |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* This program is distributed in the hope that it will be useful, |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* GNU General Public License for more details. |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* You should have received a copy of the GNU General Public License |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* along with this program; if not, write to the Free Software |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Authors: Faker Moatamri <faker.moatamri@sophia.inria.fr> |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
18 |
*/ |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
19 |
|
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
20 |
#include "attribute-iterator.h" |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
21 |
#include <gtk/gtk.h> |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
22 |
|
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
23 |
namespace ns3 |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
24 |
{ |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
25 |
|
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
26 |
enum |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
27 |
{ |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
28 |
COL_NODE = 0, COL_LAST |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
29 |
}; |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
30 |
|
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
31 |
struct ModelNode |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
32 |
{ |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
33 |
enum |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
34 |
{ |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
35 |
// store object + attribute name |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
36 |
NODE_ATTRIBUTE, |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
37 |
// store object + attribute name |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
38 |
NODE_POINTER, |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
39 |
// store object + attribute name |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
40 |
NODE_VECTOR, |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
41 |
// store index + value (object) |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
42 |
NODE_VECTOR_ITEM, |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
43 |
// store object |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
44 |
NODE_OBJECT |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
45 |
} type; |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
46 |
std::string name; |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
47 |
Ptr<Object> object; |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
48 |
uint32_t index; |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
49 |
}; |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
50 |
class ModelCreator : public AttributeIterator |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
51 |
{ |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
52 |
public: |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
53 |
ModelCreator (); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
54 |
|
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
55 |
void Build (GtkTreeStore *treestore); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
56 |
private: |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
57 |
virtual void DoVisitAttribute (Ptr<Object> object, std::string name); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
58 |
virtual void DoStartVisitObject (Ptr<Object> object); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
59 |
virtual void DoEndVisitObject (void); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
60 |
virtual void DoStartVisitPointerAttribute (Ptr<Object> object, std::string name, Ptr<Object> value); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
61 |
virtual void DoEndVisitPointerAttribute (void); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
62 |
virtual void DoStartVisitArrayAttribute (Ptr<Object> object, std::string name, const ObjectVectorValue &vector); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
63 |
virtual void DoEndVisitArrayAttribute (void); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
64 |
virtual void DoStartVisitArrayItem (const ObjectVectorValue &vector, |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
65 |
uint32_t index, Ptr<Object> item); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
66 |
virtual void DoEndVisitArrayItem (void); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
67 |
void Add (ModelNode *node); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
68 |
void Remove (void); |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
69 |
|
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
70 |
GtkTreeStore *m_treestore; |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
71 |
std::vector<GtkTreeIter *> m_iters; |
73ea01eb5674
Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff
changeset
|
72 |
}; |
5995
017e7a1cfa7c
fix build, remove debugging code from tap example
Craig Dowell <craigdo@ee.washington.edu>
parents:
5992
diff
changeset
|
73 |
} |