Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
3fbc638a
Commit
3fbc638a
authored
Sep 05, 2009
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Configuration: add getPIntField, getIntProp, getPIntProp, getArgPint
parent
e3418768
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
2 deletions
+44
-2
Configuration.h
include/Configuration.h
+8
-1
Configuration.cc
src/Various/Configuration.cc
+36
-1
No files found.
include/Configuration.h
View file @
3fbc638a
...
...
@@ -71,6 +71,8 @@ namespace UniSetTypes
std
::
string
getField
(
const
std
::
string
path
);
/// ԣ path
int
getIntField
(
const
std
::
string
path
);
/// ԣ path ( def, <= 0)
int
getPIntField
(
const
std
::
string
path
,
int
def
);
xmlNode
*
findNode
(
xmlNode
*
node
,
const
std
::
string
searchnode
,
const
std
::
string
name
=
""
);
...
...
@@ -78,6 +80,8 @@ namespace UniSetTypes
xmlNode
*
getNode
(
const
std
::
string
&
path
);
//
std
::
string
getProp
(
xmlNode
*
,
const
std
::
string
name
);
int
getIntProp
(
xmlNode
*
,
const
std
::
string
name
);
int
getPIntProp
(
xmlNode
*
,
const
std
::
string
name
,
int
def
);
//
std
::
string
getPropByNodeName
(
const
std
::
string
&
nodename
,
const
std
::
string
&
prop
);
...
...
@@ -132,8 +136,11 @@ namespace UniSetTypes
/*! , */
std
::
string
getArgParam
(
const
std
::
string
name
,
const
std
::
string
defval
=
""
);
/*! , , 0 */
/*! , , 0
. , defval
*/
int
getArgInt
(
const
std
::
string
name
,
const
std
::
string
defval
=
""
);
/*! , , defval */
int
getArgPInt
(
const
std
::
string
name
,
int
defval
);
int
getArgPInt
(
const
std
::
string
name
,
const
std
::
string
strdefval
,
int
defval
);
xmlNode
*
initDebug
(
DebugStream
&
deb
,
const
std
::
string
&
nodename
);
...
...
src/Various/Configuration.cc
View file @
3fbc638a
...
...
@@ -410,6 +410,22 @@ int Configuration::getArgInt( const string name, const string defval )
return
UniSetTypes
::
uni_atoi
(
getArgParam
(
name
,
defval
));
}
int
Configuration
::
getArgPInt
(
const
string
name
,
int
defval
)
{
int
i
=
getArgInt
(
name
);
if
(
i
<=
0
)
return
defval
;
return
i
;
}
int
Configuration
::
getArgPInt
(
const
string
name
,
const
string
strdefval
,
int
defval
)
{
int
i
=
getArgInt
(
name
,
strdefval
);
if
(
i
<=
0
)
return
defval
;
return
i
;
}
// -------------------------------------------------------------------------
// ????????????? ????????... (??? ???????????)
...
...
@@ -569,13 +585,23 @@ xmlNode* Configuration::getNode(const string& path)
// -------------------------------------------------------------------------
string
Configuration
::
getProp
(
xmlNode
*
node
,
const
string
name
)
{
return
UniXML
::
getProp
(
node
,
name
);
return
UniXML
::
getProp
(
node
,
name
);
}
int
Configuration
::
getIntProp
(
xmlNode
*
node
,
const
string
name
)
{
return
UniXML
::
getIntProp
(
node
,
name
);
}
int
Configuration
::
getPIntProp
(
xmlNode
*
node
,
const
string
name
,
int
def
)
{
return
UniXML
::
getPIntProp
(
node
,
name
,
def
);
}
// -------------------------------------------------------------------------
string
Configuration
::
getField
(
const
string
path
)
{
return
getProp
(
getNode
(
path
),
"name"
);
}
// -------------------------------------------------------------------------
int
Configuration
::
getIntField
(
const
std
::
string
path
)
{
...
...
@@ -583,6 +609,15 @@ int Configuration::getIntField(const std::string path)
}
// -------------------------------------------------------------------------
int
Configuration
::
getPIntField
(
const
std
::
string
path
,
int
def
)
{
int
i
=
getIntField
(
path
);;
if
(
i
<=
0
)
return
def
;
return
i
;
}
// -------------------------------------------------------------------------
xmlNode
*
Configuration
::
findNode
(
xmlNode
*
node
,
const
std
::
string
snode
,
const
std
::
string
sname
)
{
if
(
!
unixml
.
isOpen
()
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment