substitution.h
Go to the documentation of this file.
1 // Parse the $(...) substitution args
2 // Author: Max Schwarz <max.schwarz@uni-bonn.de>
3 
4 #ifndef ROSMON_LAUNCH_SUBSTITUTION_H
5 #define ROSMON_LAUNCH_SUBSTITUTION_H
6 
7 #include <string>
8 #include <stdexcept>
9 
10 #include <fmt/format.h>
11 
12 namespace rosmon
13 {
14 namespace launch
15 {
16 
17 class ParseContext;
18 
19 class SubstitutionException : public std::exception
20 {
21 public:
22  explicit SubstitutionException(const std::string& msg)
23  : m_msg(msg)
24  {}
25 
26  virtual ~SubstitutionException() throw()
27  {}
28 
29  virtual const char* what() const noexcept override
30  { return m_msg.c_str(); }
31 
32  template<typename... Args>
33  static SubstitutionException format(const char* format, const Args& ... args)
34  {
35  return SubstitutionException(fmt::format(format, args...));
36  }
37 private:
38  std::string m_msg;
39 };
40 
41 namespace substitutions
42 {
43  std::string anon(const std::string& name, ParseContext& context);
44  std::string arg(const std::string& name, const ParseContext& context);
45  std::string dirname(const ParseContext& context);
46  std::string env(const std::string& name);
47  std::string optenv(const std::string& name, const std::string& defaultValue);
48 
50  std::string find_stupid(const std::string& name);
51 }
52 
53 std::string parseSubstitutionArgs(const std::string& input, ParseContext& context);
54 
55 }
56 }
57 
58 #endif
std::string anon(const std::string &name, ParseContext &context)
virtual const char * what() const noexceptoverride
Definition: substitution.h:29
static SubstitutionException format(const char *format, const Args &...args)
Definition: substitution.h:33
std::string dirname(const ParseContext &context)
std::string optenv(const std::string &name, const std::string &defaultValue)
std::string env(const std::string &name)
std::string arg(const std::string &name, const ParseContext &context)
std::string parseSubstitutionArgs(const std::string &input, ParseContext &context)
SubstitutionException(const std::string &msg)
Definition: substitution.h:22
std::string find_stupid(const std::string &name)
$(find ...) which always gives rospack find results


rosmon_core
Author(s): Max Schwarz
autogenerated on Wed Jul 10 2019 03:10:12