paludis Version 3.0.2
The one true package mangler
paludis::KeyValueConfigFile Class Reference

#include <config_file.hh>

Inheritance diagram for paludis::KeyValueConfigFile:

Public Types

typedef std::function< std::string(const KeyValueConfigFile &, const std::string &)> DefaultFunction
typedef std::function< std::string(const KeyValueConfigFile &, const std::string &var, const std::string &old_value, const std::string &new_value)> TransformationFunction

Public Member Functions

std::string get (const std::string &) const PALUDIS_ATTRIBUTE((warn_unused_result))
const KeyValueConfigFileOptions & options () const PALUDIS_ATTRIBUTE((warn_unused_result))
const DefaultFunction & default_function () const PALUDIS_ATTRIBUTE((warn_unused_result))
const TransformationFunction & transformation_function () const PALUDIS_ATTRIBUTE((warn_unused_result))

Static Public Member Functions

static std::string no_defaults (const KeyValueConfigFile &, const std::string &)
static std::string no_transformation (const KeyValueConfigFile &, const std::string &, const std::string &, const std::string &)

Iterate over our keys

typedef WrappedForwardIterator< ConstIteratorTag, const std::pair< const std::string, std::string > > ConstIterator
ConstIterator begin () const PALUDIS_ATTRIBUTE((warn_unused_result))
ConstIterator end () const PALUDIS_ATTRIBUTE((warn_unused_result))

Basic operations

 KeyValueConfigFile (const Source &, const KeyValueConfigFileOptions &, const DefaultFunction &, const TransformationFunction &)

Detailed Description

A key=value configuration file.

Various syntax options are available, and are controlled by KeyValueConfigFileOptions:

  • Unless kvcfo_disallow_continuations, line continuations via backslashes are allowed.
  • Unless kvcfo_disallow_comments, comments start with a #.
  • Unless kvcfo_disallow_space_around_equals, the equals sign can have surrounding whitespace.
  • Unless kvcfo_disallow_space_inside_unquoted_values, foo = bar baz is legal.
  • Unless kvcfo_disallow_single_quoted_strings, single quoted strings are legal.
  • Unless kvcfo_disallow_double_quoted_strings, double quoted strings are legal.
  • Unless kvcfo_disallow_unquoted_values, unquoted values are legal.
  • Unless kvcfo_disallow_variables, variables using $foo and ${foo} are expanded.
  • Unless kvcfo_disallow_source, source path is legal.
  • Unless kvcfo_preserve_whitespace, leading and trailing whitespace on values is stripped.
  • If kvcfo_allow_sections, sections in the form "[foo]" and "[foo bar]" are allowed. A key 'baz' in section "[foo]" will be treated as "foo/baz", and "[foo bar]" as "foo/bar/baz".

Constructor & Destructor Documentation

◆ KeyValueConfigFile()

paludis::KeyValueConfigFile::KeyValueConfigFile ( const Source & ,
const KeyValueConfigFileOptions & ,
const DefaultFunction & ,
const TransformationFunction &  )

Constructor.

Since
0.28

References KeyValueConfigFile(), and PALUDIS_ATTRIBUTE.

Referenced by get(), and KeyValueConfigFile().

Member Function Documentation

◆ get()

std::string paludis::KeyValueConfigFile::get ( const std::string & ) const

Fetch the value for a particular key.

References get(), KeyValueConfigFile(), PALUDIS_ATTRIBUTE, and PALUDIS_VISIBLE.

Referenced by get().


The documentation for this class was generated from the following file: