00001
00002
00013
00014
00015 #ifndef polybori_literals_CStringLiteral_h_
00016 #define polybori_literals_CStringLiteral_h_
00017
00018
00019 #include <polybori/pbori_defs.h>
00020
00021
00022 #include <string>
00023
00024
00025 #include "CLiteralCodes.h"
00026
00027 BEGIN_NAMESPACE_PBORI
00028
00034 template <unsigned LitCode = CLiteralCodes::first_code>
00035 class CStringLiteral {
00036 public:
00037
00039 typedef std::string literal_type;
00040
00042 CStringLiteral() {};
00043
00045 ~CStringLiteral() {};
00046
00048 literal_type operator()() const;
00049 };
00050
00051
00052 #define GENERATE_CSTRINGLITERAL(CODE, STRING) \
00053 template <> inline CStringLiteral<>::literal_type \
00054 CStringLiteral<CLiteralCodes::CODE>::operator()() const{ return STRING; }
00055
00056 GENERATE_CSTRINGLITERAL(empty, "")
00057 GENERATE_CSTRINGLITERAL(space, " ")
00058 GENERATE_CSTRINGLITERAL(plus, "+")
00059 GENERATE_CSTRINGLITERAL(term_separator, " + ")
00060 GENERATE_CSTRINGLITERAL(times, "*")
00061 GENERATE_CSTRINGLITERAL(comma, ",")
00062 GENERATE_CSTRINGLITERAL(list_separator, ", ")
00063 GENERATE_CSTRINGLITERAL(default_variable_name, "x")
00064 GENERATE_CSTRINGLITERAL(variable_head, "(")
00065 GENERATE_CSTRINGLITERAL(variable_tail, ")")
00066 GENERATE_CSTRINGLITERAL(between_list_separator, "}, {")
00067
00068 #undef GENERATE_CSTRINGLITERAL
00069
00070 END_NAMESPACE_PBORI
00071
00072 #endif