Logo Search packages:      
Sourcecode: schroot version File versions  Download package

void keyfile::check_priority ( std::string const &  group,
std::string const &  key,
priority  priority,
bool  valid 
) const [private]

Check if a key is missing or present when not permitted.

Parameters:
group the group the key is in.
key the key to get.
priority the key priority.
valid true if key exists, false if not existing.

Definition at line 341 of file sbuild-keyfile.cc.

References PRIORITY_DEPRECATED, PRIORITY_DISALLOWED, PRIORITY_OBSOLETE, and PRIORITY_REQUIRED.

Referenced by get_list_value(), get_locale_string(), and get_value().

{
  if (valid == false)
    {
      switch (priority)
      {
      case PRIORITY_REQUIRED:
        {
          format fmt(_("%1% chroot: A required parameter \"%2%\" is missing."));
          fmt % group % key;
          throw error(fmt);
        }
        break;
      default:
        break;
      }
    }
  else
    {
      switch (priority)
      {
      case PRIORITY_DEPRECATED:
        log_warning()
          << format(_("%1% chroot: A deprecated parameter \"%2%\" has been specified."))
          % group % key
          << std::endl;
        log_info()
          << _("This option will be removed in the future.") << std::endl;
        break;
      case PRIORITY_OBSOLETE:
        log_warning()
          << format(_("%1% chroot: An obsolete parameter \"%2%\" has been specified."))
          % group % key
          << std::endl;
        log_info()
          << _("This option has been removed, and no longer has any effect.") << std::endl;
      case PRIORITY_DISALLOWED:
        {
          format fmt(_("%1% chroot: A disallowed parameter \"%2%\" has been specified."));
          fmt % group % key;
          throw error(fmt);
        }
        break;
          default:
            break;
      }
    }
}


Generated by  Doxygen 1.6.0   Back to index