Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
85b06e8c
Commit
85b06e8c
authored
Jun 19, 2011
by
Michal 'vorner' Vaner
Browse files
[trac978] Pass the loader to creator
parent
70af8c7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/acl/loader.h
View file @
85b06e8c
...
...
@@ -190,9 +190,12 @@ public:
* parameters might look like, they are not checked in any way.
* Therefore it's up to the creator (or the check being created)
* to validate the data and throw if it is bad.
* \param Current loader calling this creator. This can be used
* to load subexpressions in case of compound check.
*/
virtual
boost
::
shared_ptr
<
Check
<
Context
>
>
create
(
const
std
::
string
&
name
,
data
::
ConstElementPtr
definition
)
=
0
;
const
std
::
string
&
name
,
data
::
ConstElementPtr
definition
,
const
Loader
<
Context
,
Action
>&
loader
)
=
0
;
/**
* \brief Is list or-abbreviation allowed?
*
...
...
@@ -369,7 +372,8 @@ private:
checkDesc
->
second
);
}
// Create the check and return it
return
(
creatorIt
->
second
->
create
(
name
,
checkDesc
->
second
));
return
(
creatorIt
->
second
->
create
(
name
,
checkDesc
->
second
,
*
this
));
}
default:
isc_throw_1
(
LoaderError
,
...
...
src/lib/acl/tests/loader_test.cc
View file @
85b06e8c
...
...
@@ -89,8 +89,8 @@ public:
vector
<
string
>
names
()
const
{
return
(
names_
);
}
shared_ptr
<
Check
<
Log
>
>
create
(
const
string
&
name
,
ConstElementPtr
data
)
shared_ptr
<
Check
<
Log
>
>
create
(
const
string
&
name
,
ConstElementPtr
data
,
const
Loader
<
Log
>&
)
{
bool
found
(
false
);
for
(
vector
<
string
>::
const_iterator
i
(
names_
.
begin
());
...
...
@@ -123,7 +123,9 @@ public:
result
.
push_back
(
"throw"
);
return
(
result
);
}
shared_ptr
<
Check
<
Log
>
>
create
(
const
string
&
,
ConstElementPtr
)
{
shared_ptr
<
Check
<
Log
>
>
create
(
const
string
&
,
ConstElementPtr
,
const
Loader
<
Log
>&
)
{
throw
TestCreatorError
();
}
};
...
...
@@ -144,7 +146,9 @@ public:
result
.
push_back
(
"throwcheck"
);
return
(
result
);
}
shared_ptr
<
Check
<
Log
>
>
create
(
const
string
&
,
ConstElementPtr
)
{
shared_ptr
<
Check
<
Log
>
>
create
(
const
string
&
,
ConstElementPtr
,
const
Loader
<
Log
>&
)
{
return
(
shared_ptr
<
Check
<
Log
>
>
(
new
ThrowCheck
()));
}
};
...
...
@@ -161,8 +165,8 @@ public:
* logging cell used, the second is result of the check. No error checking
* is done, if there's bug in the test, it will throw TypeError for us.
*/
shared_ptr
<
Check
<
Log
>
>
create
(
const
string
&
,
C
onst
ElementPtr
definition
)
shared_ptr
<
Check
<
Log
>
>
create
(
const
string
&
,
ConstElementPtr
definition
,
c
onst
Loader
<
Log
>&
)
{
vector
<
ConstElementPtr
>
list
(
definition
->
listValue
());
int
logpos
(
list
[
0
]
->
intValue
());
...
...
Write
Preview
Supports
Markdown
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