Isis 3.0 Object Programmers' Reference
Home
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
PvlFormat.h
Go to the documentation of this file.
1
#ifndef PvlFormat_h
2
#define PvlFormat_h
3
25
#include <map>
26
#include <string>
27
28
#include "
Pvl.h
"
29
30
#include "
PvlKeyword.h
"
31
32
namespace
Isis {
33
35
enum
KeywordType
{ NoTypeKeyword,
36
StringKeyword,
37
BoolKeyword,
38
IntegerKeyword,
39
RealKeyword,
40
OctalKeyword,
41
HexKeyword,
42
BinaryKeyword,
43
EnumKeyword
44
};
45
54
inline
KeywordType
toKeywordType
(
const
QString type) {
55
56
QString t(type);
57
t = t.remove(QRegExp(
"[\\w_-\"'"
)).toUpper();
58
59
if
(t ==
"STRING"
)
return
StringKeyword;
60
else
if
(t ==
"BOOL"
)
return
BoolKeyword;
61
else
if
(t ==
"INTEGER"
)
return
IntegerKeyword;
62
else
if
(t ==
"REAL"
)
return
RealKeyword;
63
else
if
(t ==
"OCTAL"
)
return
OctalKeyword;
64
else
if
(t ==
"HEX"
)
return
HexKeyword;
65
else
if
(t ==
"BINARY"
)
return
BinaryKeyword;
66
else
if
(t ==
"ENUM"
)
return
EnumKeyword;
67
return
NoTypeKeyword;
68
}
69
124
class
PvlFormat
{
125
126
public
:
127
128
PvlFormat
();
129
PvlFormat
(
const
QString &file);
130
PvlFormat
(
Pvl
&keymap);
131
virtual
~
PvlFormat
() {};
132
133
void
add(
const
QString &file);
134
void
add(
Pvl
&keymap);
135
143
void
setCharLimit
(
const
unsigned
int
limit) {
144
m_charLimit
= limit;
145
};
146
154
unsigned
int
charLimit
()
const
{
155
return
m_charLimit
;
156
};
157
158
virtual
QString formatValue(
const
PvlKeyword
&keyword,
159
int
valueIndex = 0);
160
virtual
QString formatName(
const
PvlKeyword
&keyword);
161
virtual
QString formatEnd(
const
QString name,
162
const
PvlKeyword
&keyword);
163
virtual
QString formatEOL() {
164
return
"\n"
;
165
}
166
167
virtual
KeywordType
type(
const
PvlKeyword &keyword);
168
virtual
int
accuracy(
const
PvlKeyword &keyword);
169
170
protected
:
171
172
virtual
QString addQuotes(
const
QString value);
173
bool
isSingleUnit
(
const
PvlKeyword &keyword);
174
175
QString m_keywordMapFile;
176
Pvl m_keywordMap;
177
179
unsigned
int
m_charLimit
;
180
181
private
:
182
void
init
();
183
};
184
};
185
186
#endif
187