OpenStructure
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
stage
include
ost
info
info_impl.hh
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
// This file is part of the OpenStructure project <www.openstructure.org>
3
//
4
// Copyright (C) 2008-2011 by the OpenStructure authors
5
// Copyright (C) 2003-2010 by the IPLT authors
6
//
7
// This library is free software; you can redistribute it and/or modify it under
8
// the terms of the GNU Lesser General Public License as published by the Free
9
// Software Foundation; either version 3.0 of the License, or (at your option)
10
// any later version.
11
// This library is distributed in the hope that it will be useful, but WITHOUT
12
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14
// details.
15
//
16
// You should have received a copy of the GNU Lesser General Public License
17
// along with this library; if not, write to the Free Software Foundation, Inc.,
18
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
//------------------------------------------------------------------------------
20
21
/*
22
low level info implementation
23
24
Author: Ansgar Philippsen
25
*/
26
27
#ifndef OST_DATA_INFO_IMPL_H
28
#define OST_DATA_INFO_IMPL_H
29
30
#include <
ost/message.hh
>
31
#include <utility>
32
#include <vector>
33
#include <iostream>
34
35
#include <QDomElement>
36
#include <QDomDocument>
37
#include <QDomAttr>
38
#include <QDomText>
39
40
#include <
ost/base.hh
>
41
#include <
ost/geom/geom.hh
>
42
43
#include <
ost/ptr_observer.hh
>
44
45
#include "
info_impl_fw.hh
"
46
#include "
item_type.hh
"
47
48
namespace
ost {
namespace
info {
namespace
detail {
49
50
typedef
std::vector<ElePtr>
EleList
;
51
/*
52
wraps a DomElement, to be used by the high level item and group class
53
*/
54
class
EleImpl
{
55
public
:
56
EleImpl
(
const
QDomElement& e);
57
58
// tag name access
59
String
GetName
()
const
;
60
void
SetName
(
const
String
& n);
61
62
// get full path
63
String
GetPath
()
const
;
64
65
66
// attribute access
67
void
SetAttribute
(
const
String
& name,
const
String
& value);
68
String
GetAttribute
(
const
String
& name)
const
;
69
bool
HasAttribute
(
const
String
& name)
const
;
70
void
RemoveAttribute
(
const
String
& name);
71
72
std::vector<String>
GetAttributeList
()
const
;
73
74
String
GetTextData
()
const
;
75
void
SetTextData
(
const
String
& td);
76
77
String
GetComment
()
const
;
78
82
EleList
GetSubs
(
const
String
& name)
const
;
83
86
ElePtr
GetSub
(
const
String
& name)
const
;
87
ElePtr
CreateSub
(
const
String
& name);
88
bool
HasSub
(
const
String
& name)
const
;
89
90
void
RemoveSub
(
const
String
& name);
91
92
void
RemoveSub
(
const
ElePtr
& ele);
93
94
QDomElement&
GetElement
();
95
const
QDomElement&
GetElement
()
const
;
96
97
InfoImpl
&
GetRoot
();
98
InfoImpl
&
GetRoot
()
const
;
99
100
std::vector<ElePtr>
GetSubList
()
const
;
101
102
ElePtr
GetParent
()
const
;
103
104
bool
operator==
(
const
EleImpl
& ref)
const
;
105
106
Type
GetType
()
const
;
107
void
SetType
(
Type
t);
108
109
void
SetNewType
(
int
t);
110
111
void
SetStringRepr
(
const
String
& v,
bool
settype);
112
String
GetStringRepr
()
const
;
113
void
SetIntRepr
(
int
repr);
114
int
GetIntRepr
()
const
;
115
void
SetFloatRepr
(
float
repr);
116
float
GetFloatRepr
()
const
;
117
void
SetBoolRepr
(
bool
repr);
118
bool
GetBoolRepr
()
const
;
119
void
SetVecRepr
(
const
geom::Vec3
& repr);
120
geom::Vec3
GetVecRepr
()
const
;
121
122
private
:
123
QDomElement ele_;
124
125
Type
type_;
126
127
String
String_repr_;
128
int
int_repr_;
129
float
float_repr_;
130
bool
bool_repr_;
131
geom::Vec3
vec_repr_;
132
};
133
134
135
class
InfoImpl
{
136
public
:
137
InfoImpl
();
138
InfoImpl
(
const
String
& file);
139
InfoImpl
(
bool
dummy,
const
String
& text);
140
141
RootPtr
Copy
()
const
;
142
143
void
Import
(
const
String
& file);
144
void
Export
(
const
String
& file);
145
146
EleImpl
Root
();
147
148
RootPtrList
&
DefList
() {
return
def_list_;}
149
const
RootPtrList
&
DefList
()
const
{
return
def_list_;}
150
151
QDomDocument&
GetDocument
() {
return
document_;}
152
const
QDomDocument&
GetDocument
()
const
{
return
document_;}
153
154
private
:
155
QDomDocument document_;
156
157
RootPtrList
def_list_;
158
};
159
160
}}}
// ns
161
162
#endif
Generated on Mon Nov 5 2012 13:31:03 for OpenStructure by
1.8.1.1