OpenStructure
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
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
80
EleList
GetSubs
(
const
String
& name)
const
;
81
84
ElePtr
GetSub
(
const
String
& name)
const
;
85
ElePtr
CreateSub
(
const
String
& name);
86
bool
HasSub
(
const
String
& name)
const
;
87
88
void
RemoveSub
(
const
String
& name);
89
90
void
RemoveSub
(
const
ElePtr
& ele);
91
92
QDomElement&
GetElement
();
93
const
QDomElement&
GetElement
()
const
;
94
95
InfoImpl
&
GetRoot
();
96
InfoImpl
&
GetRoot
()
const
;
97
98
std::vector<ElePtr>
GetSubList
()
const
;
99
100
ElePtr
GetParent
()
const
;
101
102
bool
operator==
(
const
EleImpl
& ref)
const
;
103
104
Type
GetType
()
const
;
105
void
SetType
(
Type
t);
106
107
void
SetNewType
(
int
t);
108
109
void
SetStringRepr
(
const
String
& v,
bool
settype);
110
String
GetStringRepr
()
const
;
111
void
SetIntRepr
(
int
repr);
112
int
GetIntRepr
()
const
;
113
void
SetFloatRepr
(
float
repr);
114
float
GetFloatRepr
()
const
;
115
void
SetBoolRepr
(
bool
repr);
116
bool
GetBoolRepr
()
const
;
117
void
SetVecRepr
(
const
geom::Vec3
& repr);
118
geom::Vec3
GetVecRepr
()
const
;
119
120
private
:
121
QDomElement ele_;
122
123
Type
type_;
124
125
String
String_repr_;
126
int
int_repr_;
127
float
float_repr_;
128
bool
bool_repr_;
129
geom::Vec3
vec_repr_;
130
};
131
132
133
class
InfoImpl
{
134
public
:
135
InfoImpl
();
136
InfoImpl
(
const
String
& file);
137
InfoImpl
(
bool
dummy,
const
String
& text);
138
139
RootPtr
Copy
()
const
;
140
141
void
Import
(
const
String
& file);
142
void
Export
(
const
String
& file);
143
144
EleImpl
Root
();
145
146
RootPtrList
&
DefList
() {
return
def_list_;}
147
const
RootPtrList
&
DefList
()
const
{
return
def_list_;}
148
149
QDomDocument&
GetDocument
() {
return
document_;}
150
const
QDomDocument&
GetDocument
()
const
{
return
document_;}
151
152
private
:
153
QDomDocument document_;
154
155
RootPtrList
def_list_;
156
};
157
158
}}}
// ns
159
160
#endif
Generated on Thu Jun 14 2012 18:58:01 for OpenStructure by
1.8.1.1