Ejemplo n.º 1
0
/*!

\brief Removes config contexts found at the specified scope path.
\param[in] Scope String containing scope to use when overwriting.
\return Returns dmz::True if config context was successfully removed.

*/
dmz::Boolean
dmz::Config::remove_config (const String &Scope) {

   Boolean result = False;

   if (Scope) {

      result = True;

      String value, remainder;

      if (pop_last_config_scope_element (Scope, value, remainder)) {

         Config list;

         lookup_all_config (remainder, list);

         ConfigIterator it;
         Config cd;

         while (list.get_next_config (it, cd)) {

            ConfigContext *context (cd.get_config_context ());

            if (context) { context->remove_config (value); }
         }
      }
      else if (_state.context) { _state.context->remove_config (Scope); }
   }

   return result;
}
Ejemplo n.º 2
0
/*!

\brief Overwrites config contexts found at the specified scope path.
\param[in] Scope String containing scope to use when overwriting.
\param[in] Data Config containing config context to use in the over write.
\return Returns dmz::True if config context was successfully overwritten.

*/
dmz::Boolean
dmz::Config::overwrite_config (const String &Scope, const Config &Data) {

   if (!Scope) {

      if (_state.context) { _state.context->remove_config (Data.get_name ()); }
   }
   else {

      Config list;

      lookup_all_config (Scope, list);

      ConfigIterator it;
      Config cd;

      while (list.get_next_config (it, cd)) {

         ConfigContext *context (cd.get_config_context ());

         if (context) { context->remove_config (Data.get_name ()); }
      }
   }

   return add_config (Scope, Data);
}