PolyBoRi
CStringLiteral.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
13 //*****************************************************************************
14 
15 #ifndef polybori_literals_CStringLiteral_h_
16 #define polybori_literals_CStringLiteral_h_
17 
18 // include basic definitions
19 #include <polybori/pbori_defs.h>
20 
21 // get standard string capability
22 #include <string>
23 
24 // get literal codes (enumeration)
25 #include "CLiteralCodes.h"
26 
28 
34 template <unsigned LitCode = CLiteralCodes::first_code>
36 public:
37 
39  typedef std::string literal_type;
40 
43 
46 
48  literal_type operator()() const;
49 };
50 
51 
52 #define GENERATE_CSTRINGLITERAL(CODE, STRING) \
53 template <> inline CStringLiteral<>::literal_type \
54 CStringLiteral<CLiteralCodes::CODE>::operator()() const{ return STRING; }
55 
59 GENERATE_CSTRINGLITERAL(term_separator, " + ")
62 GENERATE_CSTRINGLITERAL(list_separator, ", ")
63 GENERATE_CSTRINGLITERAL(default_variable_name, "x")
64 GENERATE_CSTRINGLITERAL(variable_head, "(")
65 GENERATE_CSTRINGLITERAL(variable_tail, ")")
66 GENERATE_CSTRINGLITERAL(between_list_separator, "}, {")
67 
68 #undef GENERATE_CSTRINGLITERAL
69 
70 END_NAMESPACE_PBORI
71 
72 #endif