Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Chaofan Chen
ogs
Commits
ee6df01b
Commit
ee6df01b
authored
9 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[BL] fixed indentation
parent
d9b2a076
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
BaseLib/ConfigTreeNew.cpp
+47
-47
47 additions, 47 deletions
BaseLib/ConfigTreeNew.cpp
with
47 additions
and
47 deletions
BaseLib/ConfigTreeNew.cpp
+
47
−
47
View file @
ee6df01b
...
...
@@ -43,50 +43,50 @@ ConfigTreeNew(PTree const& tree, ConfigTreeNew const& parent,
ConfigTreeNew
::
ConfigTreeNew
(
ConfigTreeNew
&&
other
)
:
_tree
(
other
.
_tree
)
,
_path
(
other
.
_path
)
,
_visited_params
(
std
::
move
(
other
.
_visited_params
))
,
_onerror
(
other
.
_onerror
)
,
_onwarning
(
other
.
_onwarning
)
:
_tree
(
other
.
_tree
)
,
_path
(
other
.
_path
)
,
_visited_params
(
std
::
move
(
other
.
_visited_params
))
,
_onerror
(
other
.
_onerror
)
,
_onwarning
(
other
.
_onwarning
)
{
other
.
_tree
=
nullptr
;
other
.
_tree
=
nullptr
;
}
ConfigTreeNew
::~
ConfigTreeNew
()
{
if
(
!
_tree
)
return
;
if
(
!
_tree
)
return
;
for
(
auto
const
&
p
:
*
_tree
)
{
markVisitedDecrement
(
p
.
first
);
}
for
(
auto
const
&
p
:
*
_tree
)
{
markVisitedDecrement
(
p
.
first
);
}
for
(
auto
const
&
p
:
_visited_params
)
{
if
(
p
.
second
.
count
>
0
)
{
warning
(
"Key <"
+
p
.
first
+
"> has been read "
+
std
::
to_string
(
p
.
second
.
count
)
+
" time(s) more than it was present in the configuration tree."
);
}
else
if
(
p
.
second
.
count
<
0
)
{
warning
(
"Key <"
+
p
.
first
+
"> has been read "
+
std
::
to_string
(
-
p
.
second
.
count
)
+
" time(s) less than it was present in the configuration tree."
);
}
}
for
(
auto
const
&
p
:
_visited_params
)
{
if
(
p
.
second
.
count
>
0
)
{
warning
(
"Key <"
+
p
.
first
+
"> has been read "
+
std
::
to_string
(
p
.
second
.
count
)
+
" time(s) more than it was present in the configuration tree."
);
}
else
if
(
p
.
second
.
count
<
0
)
{
warning
(
"Key <"
+
p
.
first
+
"> has been read "
+
std
::
to_string
(
-
p
.
second
.
count
)
+
" time(s) less than it was present in the configuration tree."
);
}
}
}
ConfigTreeNew
&
ConfigTreeNew
::
operator
=
(
ConfigTreeNew
&&
other
)
{
_tree
=
other
.
_tree
;
other
.
_tree
=
nullptr
;
_path
=
other
.
_path
;
_visited_params
=
std
::
move
(
other
.
_visited_params
);
_tree
=
other
.
_tree
;
other
.
_tree
=
nullptr
;
_path
=
other
.
_path
;
_visited_params
=
std
::
move
(
other
.
_visited_params
);
// TODO Caution: That might be a very nontrivial operation (copying a std::function).
_onerror
=
other
.
_onerror
;
_onwarning
=
other
.
_onwarning
;
// TODO Caution: That might be a very nontrivial operation (copying a std::function).
_onerror
=
other
.
_onerror
;
_onwarning
=
other
.
_onwarning
;
return
*
this
;
return
*
this
;
}
ConfigTreeNew
...
...
@@ -154,12 +154,12 @@ void ConfigTreeNew::ignoreConfParamAll(const std::string ¶m) const
void
ConfigTreeNew
::
error
(
const
std
::
string
&
message
)
const
{
_onerror
(
_path
,
message
);
_onerror
(
_path
,
message
);
}
void
ConfigTreeNew
::
warning
(
const
std
::
string
&
message
)
const
{
_onwarning
(
_path
,
message
);
_onwarning
(
_path
,
message
);
}
...
...
@@ -186,34 +186,34 @@ std::string ConfigTreeNew::shortString(const std::string &s)
void
ConfigTreeNew
::
checkKeyname
(
std
::
string
const
&
key
)
const
{
if
(
key
.
empty
())
{
error
(
"Search for empty key."
);
}
else
if
(
key_chars_start
.
find
(
key
.
front
())
==
std
::
string
::
npos
)
{
error
(
"Key <"
+
key
+
"> starts with an illegal character."
);
}
else
if
(
key
.
find_first_not_of
(
key_chars
,
1
)
!=
std
::
string
::
npos
)
{
error
(
"Key <"
+
key
+
"> contains illegal characters."
);
}
if
(
key
.
empty
())
{
error
(
"Search for empty key."
);
}
else
if
(
key_chars_start
.
find
(
key
.
front
())
==
std
::
string
::
npos
)
{
error
(
"Key <"
+
key
+
"> starts with an illegal character."
);
}
else
if
(
key
.
find_first_not_of
(
key_chars
,
1
)
!=
std
::
string
::
npos
)
{
error
(
"Key <"
+
key
+
"> contains illegal characters."
);
}
}
std
::
string
ConfigTreeNew
::
joinPaths
(
const
std
::
string
&
p1
,
const
std
::
string
&
p2
)
const
{
if
(
p2
.
empty
())
{
error
(
"Second path to be joined is empty."
);
}
if
(
p2
.
empty
())
{
error
(
"Second path to be joined is empty."
);
}
if
(
p1
.
empty
())
return
p2
;
if
(
p1
.
empty
())
return
p2
;
return
p1
+
pathseparator
+
p2
;
return
p1
+
pathseparator
+
p2
;
}
void
ConfigTreeNew
::
checkUnique
(
const
std
::
string
&
key
)
const
{
checkKeyname
(
key
);
checkKeyname
(
key
);
if
(
_visited_params
.
find
(
key
)
!=
_visited_params
.
end
())
{
error
(
"Key <"
+
key
+
"> has already been processed."
);
}
if
(
_visited_params
.
find
(
key
)
!=
_visited_params
.
end
())
{
error
(
"Key <"
+
key
+
"> has already been processed."
);
}
}
ConfigTreeNew
::
CountType
&
...
...
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