allow to clear the session wide registration for defaults
This commit is contained in:
parent
41f2820781
commit
aadc7ec7f8
2 changed files with 18 additions and 7 deletions
|
|
@ -64,9 +64,9 @@ namespace query {
|
|||
|
||||
/** initialise the most basic internal defaults. */
|
||||
DefsManager::DefsManager () throw()
|
||||
: defsRegistry(new DefsRegistry)
|
||||
: defsRegistry_(new DefsRegistry)
|
||||
{
|
||||
TODO ("setup basic defaults of the session");
|
||||
TODO ("setup basic technical defaults of the session?");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -76,6 +76,13 @@ namespace query {
|
|||
DefsManager::~DefsManager() {}
|
||||
|
||||
|
||||
void
|
||||
DefsManager::clear()
|
||||
{
|
||||
defsRegistry_.reset(new DefsRegistry);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class TAR>
|
||||
P<TAR>
|
||||
|
|
@ -83,7 +90,7 @@ namespace query {
|
|||
{
|
||||
P<TAR> res;
|
||||
QueryHandler<TAR>& typeHandler = ConfigResolver::instance();
|
||||
for (DefsRegistry::Iter<TAR> i = defsRegistry->candidates(capabilities);
|
||||
for (DefsRegistry::Iter<TAR> i = defsRegistry_->candidates(capabilities);
|
||||
bool(*i) ; ++i )
|
||||
{
|
||||
res = *i;
|
||||
|
|
@ -103,7 +110,7 @@ namespace query {
|
|||
QueryHandler<TAR>& typeHandler = ConfigResolver::instance();
|
||||
typeHandler.resolve (res, capabilities);
|
||||
if (res)
|
||||
defsRegistry->put (res, capabilities);
|
||||
defsRegistry_->put (res, capabilities);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +125,7 @@ namespace query {
|
|||
if (!candidate)
|
||||
return false;
|
||||
else
|
||||
return defsRegistry->put (candidate, capabilities);
|
||||
return defsRegistry_->put (candidate, capabilities);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -126,7 +133,7 @@ namespace query {
|
|||
bool
|
||||
DefsManager::forget (const P<TAR>& defaultObj)
|
||||
{
|
||||
return defsRegistry->forget (defaultObj);
|
||||
return defsRegistry_->forget (defaultObj);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace query {
|
|||
*/
|
||||
class DefsManager : private boost::noncopyable
|
||||
{
|
||||
scoped_ptr<impl::DefsRegistry> defsRegistry;
|
||||
scoped_ptr<impl::DefsRegistry> defsRegistry_;
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -106,6 +106,10 @@ namespace query {
|
|||
bool forget (P<TAR> const&);
|
||||
|
||||
|
||||
/** @internal for session lifecycle */
|
||||
void clear();
|
||||
|
||||
|
||||
// Q: can we have something along the line of...?
|
||||
//
|
||||
// template
|
||||
|
|
|
|||
Loading…
Reference in a new issue