// Copyright (C) 2010, Guy Barrand. All rights reserved. // See the file tools.license for terms. #ifndef tools_S_STRING #define tools_S_STRING // a few place in which a cpp macro help the readability. #include #define TOOLS_CLASS_STRING(a_name)\ static const std::string& s_##a_name() {\ static const std::string s_v(#a_name);\ return s_v;\ } #define TOOLS_CLASS_STRING_VALUE(a_name,a_value)\ static const std::string& s_##a_name() {\ static const std::string s_v(#a_value);\ return s_v;\ } #define TOOLS_GLOBAL_STRING(a_name)\ inline const std::string& s_##a_name() {\ static const std::string s_v(#a_name);\ return s_v;\ } #define TOOLS_GLOBAL_STRING_VALUE(a_name,a_value)\ inline const std::string& s_##a_name() {\ static const std::string s_v(#a_value);\ return s_v;\ } #define TOOLS_GLOBAL_ARG(a_name)\ inline const std::string& s_##a_name() {\ static const std::string s_v(std::string("-")+std::string(#a_name));\ return s_v;\ } #define TOOLS_SCLASS(a_name)\ static const std::string& s_class() {\ static const std::string s_v(#a_name);\ return s_v;\ }\ static void check_class_name() {a_name::s_class();} #define TOOLS_T_SCLASS(a_T,a_name)\ static const std::string& s_class() {\ static const std::string s_v(#a_name);\ return s_v;\ }\ static void check_class_name() {a_name::s_class();} #endif