Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
9650bf7f
Commit
9650bf7f
authored
13 years ago
by
Paweł Kędzia
Browse files
Options
Downloads
Patches
Plain Diff
Renamed removing variable method to del_variable.
parent
fb6645c2
Branches
Branches containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
libwccl/variables.cpp
+1
-1
1 addition, 1 deletion
libwccl/variables.cpp
libwccl/variables.h
+4
-4
4 additions, 4 deletions
libwccl/variables.h
swig/libcclvariables.i
+6
-8
6 additions, 8 deletions
swig/libcclvariables.i
tests/variables.cpp
+7
-7
7 additions, 7 deletions
tests/variables.cpp
with
18 additions
and
20 deletions
libwccl/variables.cpp
+
1
−
1
View file @
9650bf7f
...
...
@@ -22,7 +22,7 @@ struct delhelper
template
<
typename
T
>
void
operator
()(
const
boost
::
mpl
::
always
<
T
>&
)
{
r
=
v
.
del
<
T
>
(
s
)
||
r
;
r
=
v
.
del
_variable
<
T
>
(
s
)
||
r
;
}
};
}
/* end anon ns */
...
...
This diff is collapsed.
Click to expand it.
libwccl/variables.h
+
4
−
4
View file @
9650bf7f
...
...
@@ -339,11 +339,11 @@ public:
* @returns true if the variable was removed, false otherwise
*/
template
<
typename
T
>
bool
del
(
const
std
::
string
&
s
);
bool
del
_variable
(
const
std
::
string
&
s
);
/** Remove a variable regardless of it's type.
*
* Prefer del<T> with a concrete T as it will be faster.
* Prefer del
_variable
<T> with a concrete T as it will be faster.
*
* @returns true if the variable was removed, false otherwise
*/
...
...
@@ -435,7 +435,7 @@ void Variables::put(const std::string& s, const boost::shared_ptr<T>& v) {
}
template
<
typename
T
>
inline
bool
Variables
::
del
(
const
std
::
string
&
s
)
bool
Variables
::
del
_variable
(
const
std
::
string
&
s
)
{
BOOST_MPL_ASSERT
((
boost
::
mpl
::
count
<
types
,
T
>
));
if
(
detail
::
Vmap
<
T
>::
map_
.
erase
(
s
))
{
...
...
@@ -448,7 +448,7 @@ bool Variables::del(const std::string &s)
}
template
<
>
inline
bool
Variables
::
del
<
Value
>
(
const
std
::
string
&
s
)
bool
Variables
::
del
_variable
<
Value
>
(
const
std
::
string
&
s
)
{
return
del_any
(
s
);
}
...
...
This diff is collapsed.
Click to expand it.
swig/libcclvariables.i
+
6
−
8
View file @
9650bf7f
...
...
@@ -128,14 +128,12 @@ namespace Wccl {
void put_any(const std::string& s, const boost::shared_ptr<Value>& v);
/*
template<typename T> bool del(const std::string& s);
%template(del_bool) del<Bool>;
%template(del_tset) del<TSet>;
%template(del_strset) del<StrSet>;
%template(del_position) del<Position>;
%template(del_match) del<Match>;
*/
template<typename T> bool del_variable(const std::string& s);
%template(del_bool) del_variable<Bool>;
%template(del_tset) del_variable<TSet>;
%template(del_strset) del_variable<StrSet>;
%template(del_position) del_variable<Position>;
%template(del_match) del_variable<Match>;
bool del_any(const std::string& s);
...
...
This diff is collapsed.
Click to expand it.
tests/variables.cpp
+
7
−
7
View file @
9650bf7f
...
...
@@ -29,9 +29,9 @@ BOOST_AUTO_TEST_CASE(v_basic)
b
=
v
.
get
<
Bool
>
(
"a"
);
BOOST_REQUIRE
(
b
);
BOOST_CHECK_EQUAL
(
b
->
get_value
(),
false
);
v
.
del
<
Position
>
(
"a"
);
v
.
del
_variable
<
Position
>
(
"a"
);
BOOST_CHECK
(
v
.
get
<
Bool
>
(
"a"
));
v
.
del
<
Bool
>
(
"a"
);
v
.
del
_variable
<
Bool
>
(
"a"
);
BOOST_CHECK
(
!
v
.
get
<
Bool
>
(
"a"
));
}
...
...
@@ -40,10 +40,10 @@ BOOST_AUTO_TEST_CASE(v_del_any)
Variables
v
;
v
.
put
(
"a"
,
new
Bool
(
true
));
v
.
put
(
"b"
,
new
Bool
(
true
));
v
.
del
<
Bool
>
(
"a"
);
v
.
del
_variable
<
Bool
>
(
"a"
);
BOOST_CHECK
(
!
v
.
get
<
Value
>
(
"a"
));
v
.
put
(
"a"
,
new
Bool
(
true
));
v
.
del
<
Value
>
(
"a"
);
v
.
del
_variable
<
Value
>
(
"a"
);
BOOST_CHECK
(
!
v
.
get
<
Value
>
(
"a"
));
BOOST_CHECK
(
v
.
get
<
Value
>
(
"b"
));
}
...
...
@@ -136,11 +136,11 @@ BOOST_FIXTURE_TEST_CASE(set_bad, Vfix)
BOOST_CHECK_THROW
(
v
.
set
(
"p1"
,
Bool
(
true
)),
VariableTypeMismatch
);
}
BOOST_FIXTURE_TEST_CASE
(
del
,
Vfix
)
BOOST_FIXTURE_TEST_CASE
(
del
_variable
,
Vfix
)
{
v
.
del
<
Bool
>
(
"b1"
);
v
.
del
_variable
<
Bool
>
(
"b1"
);
BOOST_CHECK
(
!
v
.
get
<
Bool
>
(
"b1"
));
v
.
del
<
Bool
>
(
"p2"
);
v
.
del
_variable
<
Bool
>
(
"p2"
);
BOOST_CHECK
(
v
.
get
<
Value
>
(
"p2"
));
v
.
del_any
(
"p2"
);
BOOST_CHECK
(
!
v
.
get
<
Value
>
(
"p2"
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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