libzypp  17.11.4
RepoVariables.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
11 #ifndef ZYPP_REPO_VARIABLES_H_
12 #define ZYPP_REPO_VARIABLES_H_
13 
14 #include <string>
15 #include "zypp/base/Function.h"
17 #include "zypp/Url.h"
18 
20 namespace zypp
21 {
23  namespace repo
24  {
58  {
60  typedef function<const std::string * ( const std::string & )> VarRetriever;
61 
63  std::string operator()( const std::string & value_r, VarRetriever varRetriever_r ) const;
64 #ifndef SWIG // Swig treats it as syntax error
65 
66  std::string operator()( std::string && value_r, VarRetriever varRetriever_r ) const;
67 #endif
68  };
69 
106  struct RepoVariablesStringReplacer : public std::unary_function<const std::string &, std::string>
107  {
108  std::string operator()( const std::string & value_r ) const;
109 #ifndef SWIG // Swig treats it as syntax error
110 
111  std::string operator()( std::string && value_r ) const;
112 #endif
113  };
114 
121  struct RepoVariablesUrlReplacer : public std::unary_function<const Url &, Url>
122  {
123  Url operator()( const Url & url_r ) const;
124  };
125  } // namespace repo
127 
129  typedef base::ValueTransform<std::string, repo::RepoVariablesStringReplacer> RepoVariablesReplacedString;
130 
132  typedef base::ContainerTransform<std::list<std::string>, repo::RepoVariablesStringReplacer> RepoVariablesReplacedStringList;
133 
135  typedef base::ValueTransform<Url, repo::RepoVariablesUrlReplacer> RepoVariablesReplacedUrl;
136 
138  typedef base::ContainerTransform<std::list<Url>, repo::RepoVariablesUrlReplacer> RepoVariablesReplacedUrlList;
139 
140 } // namespace zypp
142 
143 #endif
base::ValueTransform< Url, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrl
base::ContainerTransform< std::list< std::string >, repo::RepoVariablesStringReplacer > RepoVariablesReplacedStringList
std::string operator()(const std::string &value_r) const
Functor expanding repo variables in a string.
Definition: RepoVariables.h:57
base::ContainerTransform< std::list< Url >, repo::RepoVariablesUrlReplacer > RepoVariablesReplacedUrlList
base::ValueTransform< std::string, repo::RepoVariablesStringReplacer > RepoVariablesReplacedString
Functor replacing repository variables.
Url operator()(const Url &url_r) const
function< const std::string *(const std::string &)> VarRetriever
Function taking a variable name and returning a pointer to the variable value or nullptr if unset...
Definition: RepoVariables.h:60
std::string operator()(const std::string &value_r, VarRetriever varRetriever_r) const
Return a copy of value_r with embedded variables expanded.
Functor replacing repository variables.
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
Url manipulation class.
Definition: Url.h:87