Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GeoModelDev
GeoModel
Commits
fa288ef0
Commit
fa288ef0
authored
1 year ago
by
Johannes Junggeburth
Browse files
Options
Downloads
Patches
Plain Diff
Minor cleaning of the XMLHandler
parent
5fc6ac02
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!295
Minor cleaning of the XMLHandler
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GeoModelTools/GeoModelXMLParser/GeoModelXMLParser/XMLHandler.h
+57
-48
57 additions, 48 deletions
...delTools/GeoModelXMLParser/GeoModelXMLParser/XMLHandler.h
GeoModelTools/GeoModelXMLParser/src/XMLHandler.cxx
+83
-99
83 additions, 99 deletions
GeoModelTools/GeoModelXMLParser/src/XMLHandler.cxx
with
140 additions
and
147 deletions
GeoModelTools/GeoModelXMLParser/GeoModelXMLParser/XMLHandler.h
+
57
−
48
View file @
fa288ef0
...
...
@@ -17,59 +17,68 @@ class XMLHandlerStore;
class
XMLHandler
{
public:
XMLHandler
(
std
::
string
n
);
virtual
~
XMLHandler
()
{}
std
::
string
GetName
()
{
return
m_name
;}
virtual
void
ElementHandle
()
=
0
;
virtual
void
Handle
(
xercesc
::
DOMNode
*
t
)
{
SetCurrentElement
(
t
);
ElementHandle
();
}
void
StopLoop
(
bool
);
bool
IsLoopToBeStopped
();
virtual
void
postLoopHandling
()
{;}
XMLHandler
(
const
std
::
string
&
n
);
virtual
~
XMLHandler
()
{}
const
std
::
string
&
GetName
()
const
{
return
m_name
;}
virtual
void
ElementHandle
()
=
0
;
virtual
void
Handle
(
xercesc
::
DOMNode
*
t
)
{
SetCurrentElement
(
t
);
ElementHandle
();
}
void
StopLoop
(
bool
);
bool
IsLoopToBeStopped
()
const
;
virtual
void
postLoopHandling
()
{;}
protected
:
std
::
string
m_name
;
bool
m_stopLoop
;
std
::
string
m_name
;
bool
m_stopLoop
{
false
}
;
static
xercesc
::
DOMNode
*
s_currentElement
;
static
void
SetCurrentElement
(
xercesc
::
DOMNode
*
t
)
{
s_currentElement
=
t
;}
static
xercesc
::
DOMNode
*
GetCurrentElement
()
{
return
s_currentElement
;}
static
xercesc
::
DOMNode
*
s_currentElement
;
static
void
SetCurrentElement
(
xercesc
::
DOMNode
*
t
)
{
s_currentElement
=
t
;}
static
xercesc
::
DOMNode
*
GetCurrentElement
()
{
return
s_currentElement
;}
bool
isAttribute
(
const
std
::
string
)
const
;
bool
isAttribute
(
const
std
::
string
&
attributeName
)
const
;
std
::
string
getAttribute
(
const
std
::
string
,
bool
&
)
const
;
std
::
string
getAttributeAsString
(
const
std
::
string
)
const
;
double
getAttributeAsDouble
(
const
std
::
string
)
const
;
float
getAttributeAsFloat
(
const
std
::
string
)
const
;
int
getAttributeAsInt
(
const
std
::
string
)
const
;
long
getAttributeAsLong
(
const
std
::
string
)
const
;
std
::
vector
<
double
>
getAttributeAsVector
(
const
std
::
string
)
const
;
std
::
vector
<
int
>
getAttributeAsIntVector
(
const
std
::
string
)
const
;
std
::
string
getAttributeAsString
(
const
std
::
string
,
bool
&
)
const
;
double
getAttributeAsDouble
(
const
std
::
string
,
bool
&
)
const
;
float
getAttributeAsFloat
(
const
std
::
string
,
bool
&
)
const
;
int
getAttributeAsInt
(
const
std
::
string
,
bool
&
)
const
;
long
getAttributeAsLong
(
const
std
::
string
,
bool
&
)
const
;
std
::
vector
<
double
>
getAttributeAsVector
(
const
std
::
string
,
bool
&
)
const
;
std
::
vector
<
int
>
getAttributeAsIntVector
(
const
std
::
string
,
bool
&
)
const
;
std
::
string
getAttributeAsString
(
const
std
::
string
,
const
std
::
string
)
const
;
double
getAttributeAsDouble
(
const
std
::
string
,
const
double
)
const
;
float
getAttributeAsFloat
(
const
std
::
string
,
const
float
)
const
;
int
getAttributeAsInt
(
const
std
::
string
,
const
int
)
const
;
long
getAttributeAsLong
(
const
std
::
string
,
const
long
)
const
;
std
::
vector
<
double
>
getAttributeAsVector
(
const
std
::
string
,
const
std
::
vector
<
double
>
)
const
;
std
::
vector
<
int
>
getAttributeAsIntVector
(
const
std
::
string
,
const
std
::
vector
<
int
>
)
const
;
static
bool
s_printFlag
;
std
::
string
getAttribute
(
const
std
::
string
&
attributeName
,
bool
&
attrIsPresent
)
const
;
std
::
string
getAttributeAsString
(
const
std
::
string
&
attributeName
)
const
;
double
getAttributeAsDouble
(
const
std
::
string
&
attributeName
)
const
;
float
getAttributeAsFloat
(
const
std
::
string
&
attributeName
)
const
;
int
getAttributeAsInt
(
const
std
::
string
&
attributeName
)
const
;
long
getAttributeAsLong
(
const
std
::
string
&
attributeName
)
const
;
std
::
vector
<
double
>
getAttributeAsVector
(
const
std
::
string
&
attributeName
)
const
;
std
::
vector
<
int
>
getAttributeAsIntVector
(
const
std
::
string
&
attributeName
)
const
;
std
::
string
getAttributeAsString
(
const
std
::
string
&
attributeName
,
bool
&
attrIsPresent
)
const
;
double
getAttributeAsDouble
(
const
std
::
string
&
attributeName
,
bool
&
attrIsPresent
)
const
;
float
getAttributeAsFloat
(
const
std
::
string
&
attributeName
,
bool
&
attrIsPresent
)
const
;
int
getAttributeAsInt
(
const
std
::
string
&
attributeName
,
bool
&
attrIsPresent
)
const
;
long
getAttributeAsLong
(
const
std
::
string
&
attributeName
,
bool
&
attrIsPresent
)
const
;
std
::
vector
<
double
>
getAttributeAsVector
(
const
std
::
string
&
attributeName
,
bool
&
attrIsPresent
)
const
;
std
::
vector
<
int
>
getAttributeAsIntVector
(
const
std
::
string
&
attributeName
,
bool
&
attrIsPresent
)
const
;
std
::
string
getAttributeAsString
(
const
std
::
string
&
attributeName
,
const
std
::
string
&
fallBackVal
)
const
;
double
getAttributeAsDouble
(
const
std
::
string
&
attributeName
,
const
double
fallBackVal
)
const
;
float
getAttributeAsFloat
(
const
std
::
string
&
attributeName
,
const
float
fallBackVal
)
const
;
int
getAttributeAsInt
(
const
std
::
string
&
attributeName
,
const
int
fallBackVal
)
const
;
long
getAttributeAsLong
(
const
std
::
string
&
attributeName
,
const
long
fallBackVal
)
const
;
std
::
vector
<
double
>
getAttributeAsVector
(
const
std
::
string
&
attributeName
,
const
std
::
vector
<
double
>&
fallBackVal
)
const
;
std
::
vector
<
int
>
getAttributeAsIntVector
(
const
std
::
string
&
attributeName
,
const
std
::
vector
<
int
>&
fallBackVal
)
const
;
static
bool
s_printFlag
;
ExpressionEvaluator
*
Evaluator
()
const
{
static
ExpressionEvaluator
*
eval
=
ExpressionEvaluator
::
GetEvaluator
();
return
eval
;
}
ExpressionEvaluator
*
Evaluator
()
const
{
static
ExpressionEvaluator
*
eval
=
ExpressionEvaluator
::
GetEvaluator
();
return
eval
;
}
private
:
void
RegisterToStore
();
};
}
// end namespace
...
...
This diff is collapsed.
Click to expand it.
GeoModelTools/GeoModelXMLParser/src/XMLHandler.cxx
+
83
−
99
View file @
fa288ef0
...
...
@@ -16,33 +16,24 @@ using namespace GeoModelTools;
DOMNode
*
XMLHandler
::
s_currentElement
=
0
;
bool
XMLHandler
::
s_printFlag
=
false
;
XMLHandler
::
XMLHandler
(
std
::
string
n
)
:
m_name
(
n
)
{
XMLHandler
::
XMLHandler
(
const
std
::
string
&
n
)
:
m_name
(
n
)
{
// std::cout<< " creating new handler "<<n<<std::endl;
m_stopLoop
=
false
;
RegisterToStore
();
XMLHandlerStore
::
GetHandlerStore
()
->
RegisterHandler
(
this
);
}
void
XMLHandler
::
RegisterToStore
()
{
XMLHandlerStore
::
GetHandlerStore
()
->
RegisterHandler
(
this
);
}
void
XMLHandler
::
StopLoop
(
bool
v
)
{
void
XMLHandler
::
StopLoop
(
bool
v
)
{
m_stopLoop
=
v
;
}
bool
XMLHandler
::
IsLoopToBeStopped
()
{
bool
XMLHandler
::
IsLoopToBeStopped
()
const
{
return
m_stopLoop
;
}
bool
XMLHandler
::
isAttribute
(
const
std
::
string
name
)
const
{
bool
XMLHandler
::
isAttribute
(
const
std
::
string
&
name
)
const
{
bool
res
;
std
::
string
temp
=
getAttribute
(
name
,
res
);
return
res
;
}
std
::
string
XMLHandler
::
getAttribute
(
const
std
::
string
name
,
bool
&
isPresent
)
const
{
std
::
string
XMLHandler
::
getAttribute
(
const
std
::
string
&
name
,
bool
&
isPresent
)
const
{
std
::
string
retValue
=
""
;
isPresent
=
false
;
if
(
s_currentElement
->
hasAttributes
())
{
...
...
@@ -64,8 +55,7 @@ std::string XMLHandler::getAttribute(const std::string name, bool& isPresent) co
}
return
retValue
;
}
std
::
string
XMLHandler
::
getAttributeAsString
(
const
std
::
string
name
)
const
{
std
::
string
XMLHandler
::
getAttributeAsString
(
const
std
::
string
&
name
)
const
{
bool
isPresent
{
false
};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
!
isPresent
)
{
...
...
@@ -73,84 +63,79 @@ std::string XMLHandler::getAttributeAsString(const std::string name) const
}
return
temp
;
}
double
XMLHandler
::
getAttributeAsDouble
(
const
std
::
string
name
)
const
{
double
res
=
0.
;
bool
isPresent
{
false
};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
!
isPresent
)
{
double
XMLHandler
::
getAttributeAsDouble
(
const
std
::
string
&
name
)
const
{
double
res
=
0.
;
bool
isPresent
{
false
};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
!
isPresent
)
{
THROW_EXCEPTION
(
"--> Attribute '"
<<
name
<<
"' is not present! Check your data!"
);
}
res
=
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
temp
.
c_str
());
return
res
;
res
=
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
temp
.
c_str
());
return
res
;
}
float
XMLHandler
::
getAttributeAsFloat
(
const
std
::
string
name
)
const
{
float
res
=
0.
;
bool
isPresent
{
false
};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
float
XMLHandler
::
getAttributeAsFloat
(
const
std
::
string
&
name
)
const
{
float
res
=
0.
;
bool
isPresent
{
false
};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
!
isPresent
)
{
THROW_EXCEPTION
(
"--> Attribute '"
<<
name
<<
"' is not present! Check your data!"
);
}
res
=
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
temp
.
c_str
());
return
res
;
res
=
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
temp
.
c_str
());
return
res
;
}
int
XMLHandler
::
getAttributeAsInt
(
const
std
::
string
name
)
const
{
int
res
=
0
;
bool
isPresent
{
false
};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
int
XMLHandler
::
getAttributeAsInt
(
const
std
::
string
&
name
)
const
{
int
res
=
0
;
bool
isPresent
{
false
};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
!
isPresent
)
{
THROW_EXCEPTION
(
"--> Attribute '"
<<
name
<<
"' is not present! Check your data!"
);
}
res
=
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
temp
.
c_str
());
return
res
;
res
=
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
temp
.
c_str
());
return
res
;
}
long
XMLHandler
::
getAttributeAsLong
(
const
std
::
string
name
)
const
{
long
res
=
0
;
bool
isPresent
{
false
};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
long
XMLHandler
::
getAttributeAsLong
(
const
std
::
string
&
name
)
const
{
long
res
=
0
;
bool
isPresent
{
false
};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
!
isPresent
)
{
THROW_EXCEPTION
(
"--> Attribute '"
<<
name
<<
"' is not present! Check your data!"
);
}
res
=
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
temp
.
c_str
());
return
res
;
res
=
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
temp
.
c_str
());
return
res
;
}
std
::
vector
<
double
>
XMLHandler
::
getAttributeAsVector
(
const
std
::
string
name
)
const
{
bool
isPresent
{
false
};
std
::
vector
<
double
>
vect
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
!
isPresent
)
{
std
::
vector
<
double
>
XMLHandler
::
getAttributeAsVector
(
const
std
::
string
&
name
)
const
{
bool
isPresent
{
false
};
std
::
vector
<
double
>
vect
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
!
isPresent
)
{
THROW_EXCEPTION
(
"--> Attribute '"
<<
name
<<
"' is not present! Check your data!"
);
}
std
::
vector
<
std
::
string
>
v
=
GeoStrUtils
::
tokenize
(
temp
,
";"
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
vect
.
push_back
(
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
v
[
i
].
c_str
()));
}
return
vect
;
std
::
vector
<
std
::
string
>
v
=
GeoStrUtils
::
tokenize
(
temp
,
";"
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
vect
.
push_back
(
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
v
[
i
].
c_str
()));
}
return
vect
;
}
std
::
vector
<
int
>
XMLHandler
::
getAttributeAsIntVector
(
const
std
::
string
name
)
const
{
bool
isPresent
{
false
};
std
::
vector
<
int
>
vect
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
!
isPresent
)
{
std
::
vector
<
int
>
XMLHandler
::
getAttributeAsIntVector
(
const
std
::
string
&
name
)
const
{
bool
isPresent
{
false
};
std
::
vector
<
int
>
vect
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
!
isPresent
)
{
THROW_EXCEPTION
(
"--> Attribute '"
<<
name
<<
"' is not present! Check your data!"
);
}
std
::
vector
<
std
::
string
>
v
=
GeoStrUtils
::
tokenize
(
temp
,
";"
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
vect
.
push_back
(
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
v
[
i
].
c_str
()));
}
return
vect
;
std
::
vector
<
std
::
string
>
v
=
GeoStrUtils
::
tokenize
(
temp
,
";"
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
vect
.
push_back
(
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
v
[
i
].
c_str
()));
}
return
vect
;
}
std
::
string
XMLHandler
::
getAttributeAsString
(
const
std
::
string
name
,
bool
&
isPresent
)
const
{
std
::
string
XMLHandler
::
getAttributeAsString
(
const
std
::
string
&
name
,
bool
&
isPresent
)
const
{
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
return
temp
;
}
double
XMLHandler
::
getAttributeAsDouble
(
const
std
::
string
name
,
bool
&
isPresent
)
const
{
double
XMLHandler
::
getAttributeAsDouble
(
const
std
::
string
&
name
,
bool
&
isPresent
)
const
{
double
res
=
0.
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
isPresent
)
{
...
...
@@ -158,15 +143,15 @@ double XMLHandler::getAttributeAsDouble(const std::string name, bool& isPresent)
}
return
res
;
}
float
XMLHandler
::
getAttributeAsFloat
(
const
std
::
string
name
,
bool
&
isPresent
)
const
{
float
XMLHandler
::
getAttributeAsFloat
(
const
std
::
string
&
name
,
bool
&
isPresent
)
const
{
float
res
=
0.
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
isPresent
)
{
res
=
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
temp
.
c_str
());
res
=
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
temp
.
c_str
());
}
return
res
;
}
int
XMLHandler
::
getAttributeAsInt
(
const
std
::
string
name
,
bool
&
isPresent
)
const
{
int
XMLHandler
::
getAttributeAsInt
(
const
std
::
string
&
name
,
bool
&
isPresent
)
const
{
int
res
=
0
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
isPresent
)
{
...
...
@@ -174,7 +159,7 @@ int XMLHandler::getAttributeAsInt(const std::string name, bool& isPresent) const
}
return
res
;
}
long
XMLHandler
::
getAttributeAsLong
(
const
std
::
string
name
,
bool
&
isPresent
)
const
{
long
XMLHandler
::
getAttributeAsLong
(
const
std
::
string
&
name
,
bool
&
isPresent
)
const
{
long
res
=
0
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
isPresent
)
{
...
...
@@ -182,11 +167,10 @@ long XMLHandler::getAttributeAsLong(const std::string name, bool& isPresent) con
}
return
res
;
}
std
::
vector
<
double
>
XMLHandler
::
getAttributeAsVector
(
const
std
::
string
name
,
bool
&
isPresent
)
const
{
std
::
vector
<
double
>
XMLHandler
::
getAttributeAsVector
(
const
std
::
string
&
name
,
bool
&
isPresent
)
const
{
std
::
vector
<
double
>
vect
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
isPresent
)
{
if
(
isPresent
)
{
std
::
vector
<
std
::
string
>
v
=
GeoStrUtils
::
tokenize
(
temp
,
";"
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
vect
.
push_back
(
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
v
[
i
].
c_str
()));
...
...
@@ -195,25 +179,25 @@ std::vector<double> XMLHandler::getAttributeAsVector(const std::string name, boo
return
vect
;
}
std
::
vector
<
int
>
XMLHandler
::
getAttributeAsIntVector
(
const
std
::
string
name
,
bool
&
isPresent
)
const
{
std
::
vector
<
int
>
XMLHandler
::
getAttributeAsIntVector
(
const
std
::
string
&
name
,
bool
&
isPresent
)
const
{
std
::
vector
<
int
>
vect
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
isPresent
)
{
std
::
vector
<
std
::
string
>
v
=
GeoStrUtils
::
tokenize
(
temp
,
";"
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
vect
.
push_back
(
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
v
[
i
].
c_str
()));
}
std
::
vector
<
std
::
string
>
v
=
GeoStrUtils
::
tokenize
(
temp
,
";"
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
vect
.
push_back
(
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
v
[
i
].
c_str
()));
}
}
return
vect
;
}
std
::
string
XMLHandler
::
getAttributeAsString
(
const
std
::
string
name
,
const
std
::
string
def
)
const
{
std
::
string
XMLHandler
::
getAttributeAsString
(
const
std
::
string
&
name
,
const
std
::
string
&
def
)
const
{
bool
isPresent
{
false
};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
isPresent
)
return
temp
;
else
return
def
;
}
double
XMLHandler
::
getAttributeAsDouble
(
const
std
::
string
name
,
const
double
def
)
const
{
double
XMLHandler
::
getAttributeAsDouble
(
const
std
::
string
&
name
,
const
double
def
)
const
{
bool
isPresent
{
false
};
double
res
=
0.
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
...
...
@@ -223,7 +207,7 @@ double XMLHandler::getAttributeAsDouble(const std::string name, const double def
}
return
def
;
}
float
XMLHandler
::
getAttributeAsFloat
(
const
std
::
string
name
,
const
float
def
)
const
{
float
XMLHandler
::
getAttributeAsFloat
(
const
std
::
string
&
name
,
const
float
def
)
const
{
bool
isPresent
{
false
};
float
res
=
0.
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
...
...
@@ -233,7 +217,7 @@ float XMLHandler::getAttributeAsFloat(const std::string name, const float def) c
}
return
def
;
}
int
XMLHandler
::
getAttributeAsInt
(
const
std
::
string
name
,
const
int
def
)
const
{
int
XMLHandler
::
getAttributeAsInt
(
const
std
::
string
&
name
,
const
int
def
)
const
{
bool
isPresent
{
false
};
int
res
=
0
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
...
...
@@ -243,7 +227,7 @@ int XMLHandler::getAttributeAsInt(const std::string name, const int def) const {
}
return
def
;
}
long
XMLHandler
::
getAttributeAsLong
(
const
std
::
string
name
,
const
long
def
)
const
{
long
XMLHandler
::
getAttributeAsLong
(
const
std
::
string
&
name
,
const
long
def
)
const
{
bool
isPresent
{
false
};
long
res
=
0
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
...
...
@@ -253,7 +237,7 @@ long XMLHandler::getAttributeAsLong(const std::string name, const long def) cons
}
return
def
;
}
std
::
vector
<
double
>
XMLHandler
::
getAttributeAsVector
(
const
std
::
string
name
,
const
std
::
vector
<
double
>
def
)
const
{
std
::
vector
<
double
>
XMLHandler
::
getAttributeAsVector
(
const
std
::
string
&
name
,
const
std
::
vector
<
double
>
&
def
)
const
{
bool
isPresent
{
false
};
std
::
vector
<
double
>
vect
{};
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
...
...
@@ -267,16 +251,16 @@ std::vector<double> XMLHandler::getAttributeAsVector(const std::string name, con
return
def
;
}
std
::
vector
<
int
>
XMLHandler
::
getAttributeAsIntVector
(
const
std
::
string
name
,
const
std
::
vector
<
int
>
def
)
const
{
bool
isPresent
{
false
};
std
::
vector
<
int
>
vect
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
isPresent
)
{
std
::
vector
<
std
::
string
>
v
=
GeoStrUtils
::
tokenize
(
temp
,
";"
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
vect
.
push_back
(
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
v
[
i
].
c_str
()));
}
return
vect
;
}
return
def
;
std
::
vector
<
int
>
XMLHandler
::
getAttributeAsIntVector
(
const
std
::
string
&
name
,
const
std
::
vector
<
int
>
&
def
)
const
{
bool
isPresent
{
false
};
std
::
vector
<
int
>
vect
;
std
::
string
temp
=
getAttribute
(
name
,
isPresent
);
if
(
isPresent
)
{
std
::
vector
<
std
::
string
>
v
=
GeoStrUtils
::
tokenize
(
temp
,
";"
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
vect
.
push_back
(
ExpressionEvaluator
::
GetEvaluator
()
->
Eval
(
v
[
i
].
c_str
()));
}
return
vect
;
}
return
def
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment