#pragma once #include #include #include //#include "Hash.String.hpp" #ifdef Log4CPP_TLSLog_EXPORTS #define __Log4CPP_TLSLog_API _declspec(dllexport) #else #define __Log4CPP_TLSLog_API _declspec(dllimport) #endif //----------------------------------------------------------------------------- // Log4CPP::Context // // 改成用 Hash, 不要用字符串比较了, 性能超高 // 可以用上面的 Helper 函数来生成字符串的 Hash // 但是记得用 constexpr, 以便在编译期就能生成 Hash // 2022-05-30 //----------------------------------------------------------------------------- namespace Log4CPP { namespace ThreadContext { class __Log4CPP_TLSLog_API Map { public: static void Set (size_t hash, const std::string & value); static std::string Get (size_t hash); static void Clear (); }; class __Log4CPP_TLSLog_API Stack { public: static void Push (const std::string & value); static std::string Pop (); static std::string Peek (); static void Clear (); }; } namespace GlobalContext { class __Log4CPP_TLSLog_API Map { public: static void Set (size_t hash, const std::string & value); static std::string Get (size_t hash); }; class __Log4CPP_TLSLog_API Stack { public: static void Push (const std::string & value); static std::string Pop (); static std::string Peek (); }; }; };