CStringLiteral.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_literals_CStringLiteral_h_
#define polybori_literals_CStringLiteral_h_
// include basic definitions
#include <polybori/pbori_defs.h>
// get standard string capability
#include <string>
// get literal codes (enumeration)
#include "CLiteralCodes.h"
BEGIN_NAMESPACE_PBORI
template <unsigned LitCode = CLiteralCodes::first_code>
class CStringLiteral {
public:
typedef std::string literal_type;
CStringLiteral() {};
~CStringLiteral() {};
literal_type operator()() const;
};
#define GENERATE_CSTRINGLITERAL(CODE, STRING) \
template <> inline CStringLiteral<>::literal_type \
CStringLiteral<CLiteralCodes::CODE>::operator()() const{ return STRING; }
GENERATE_CSTRINGLITERAL(empty, "")
GENERATE_CSTRINGLITERAL(space, " ")
GENERATE_CSTRINGLITERAL(plus, "+")
GENERATE_CSTRINGLITERAL(term_separator, " + ")
GENERATE_CSTRINGLITERAL(times, "*")
GENERATE_CSTRINGLITERAL(comma, ",")
GENERATE_CSTRINGLITERAL(list_separator, ", ")
GENERATE_CSTRINGLITERAL(default_variable_name, "x")
GENERATE_CSTRINGLITERAL(variable_head, "(")
GENERATE_CSTRINGLITERAL(variable_tail, ")")
GENERATE_CSTRINGLITERAL(between_list_separator, "}, {")
#undef GENERATE_CSTRINGLITERAL
END_NAMESPACE_PBORI
#endif