123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #pragma once
- #include <string>
- #include <map>
- #include <stack>
- //#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 ();
- };
- };
- };
|