18 #ifndef INCLUDE_RCF_TOOLS_HPP 19 #define INCLUDE_RCF_TOOLS_HPP 26 #include <RCF/Config.hpp> 27 #include <RCF/Export.hpp> 31 #pragma comment(lib, "ws2_32.lib") 32 #pragma comment(lib, "mswsock.lib") 33 #pragma comment(lib, "advapi32.lib") 34 #pragma comment(lib, "user32.lib") 35 #pragma comment(lib, "crypt32.lib") 36 #pragma comment(lib, "rpcrt4.lib") 42 static const int LogNameRcf = 1;
43 static const int LogLevel_1 = 1;
44 static const int LogLevel_2 = 2;
45 static const int LogLevel_3 = 3;
46 static const int LogLevel_4 = 4;
48 #define RCF_LOG_1() UTIL_LOG(RCF::LogNameRcf, RCF::LogLevel_1) 49 #define RCF_LOG_2() UTIL_LOG(RCF::LogNameRcf, RCF::LogLevel_2) 50 #define RCF_LOG_3() UTIL_LOG(RCF::LogNameRcf, RCF::LogLevel_3) 51 #define RCF_LOG_4() UTIL_LOG(RCF::LogNameRcf, RCF::LogLevel_4) 56 RCF_EXPORT
void doAssert(
const char * szFile,
int line,
const char * szFunc,
const char * szAssertion);
58 #define RCF_ASSERT(x) if (x) ; else RCF::doAssert(__FILE__, __LINE__, __FUNCTION__, #x); 59 #define RCF_ASSERT_ALWAYS(x) RCF::doAssert(__FILE__, __LINE__, __FUNCTION__, x); 64 #define RCF_ASSERT_ALWAYS(x) 70 RCF_EXPORT
void rcfThrow(
const char * szFile,
int line,
const char * szFunc,
const Exception & e);
72 #define RCF_THROW(e) RCF::rcfThrow(__FILE__, __LINE__, __FUNCTION__, e) 73 #define RCF_VERIFY(cond, e) if (cond); else RCF_THROW(e) 85 RCF_EXPORT
void rcfDtorCatchHandler(
const std::exception & e);
88 #define RCF_DTOR_BEGIN \ 91 #define RCF_DTOR_END \ 93 catch (const std::exception &e) \ 95 RCF::rcfDtorCatchHandler(e); \ 100 template<
typename Container,
typename Element>
101 void eraseRemove(Container & container,
const Element & element)
111 RCF_EXPORT std::uint64_t fileSize(
const std::string & path);
115 inline bool operator<(
116 const std::weak_ptr<T> & lhs,
117 const std::weak_ptr<T> & rhs)
119 std::owner_less< std::weak_ptr<T> > cmp;
120 return cmp(lhs, rhs);
124 inline bool operator==(
125 const std::weak_ptr<T> & lhs,
126 const std::weak_ptr<T> & rhs)
128 return ! (lhs < rhs) && ! (rhs < lhs);
132 inline bool operator!=(
133 const std::weak_ptr<T> & lhs,
134 const std::weak_ptr<T> & rhs)
136 return ! (lhs == rhs);
144 Noncopyable(
const Noncopyable&) =
delete;
145 Noncopyable& operator=(
const Noncopyable&) =
delete;
151 ScopeGuard(std::function<
void()> func);
158 std::function<void()> m_func;
161 RCF_EXPORT
void trim(std::string& s);
162 RCF_EXPORT
void trimLeft(std::string& s);
163 RCF_EXPORT
void trimRight(std::string& s);
164 RCF_EXPORT
bool iequals(
const std::string& lhs,
const std::string& rhs);
165 RCF_EXPORT
bool istartsWith(
const std::string& s,
const std::string& startsWith);
167 template<
typename TPtr>
168 std::string getTypeName(
const TPtr & tPtr)
173 return typeid(t).name();
182 typedef RCF::Noncopyable Noncopyable;
186 #define RCF_UNUSED_VARIABLE(x) ((void) x) 189 #define RCF_MIN (std::min) 190 #define RCF_MAX (std::max) 195 #define SF_FOR_EACH_FUNDAMENTAL_TYPE_(arg) \ 203 arg(unsigned short) \ 213 #define SF_FOR_EACH_FUNDAMENTAL_TYPE(arg) \ 214 SF_FOR_EACH_FUNDAMENTAL_TYPE_(arg) \ 216 arg(unsigned __int64) 220 #define SF_FOR_EACH_FUNDAMENTAL_TYPE(arg) \ 221 SF_FOR_EACH_FUNDAMENTAL_TYPE_(arg) \ 223 arg(unsigned long long) 227 #endif // ! INCLUDE_RCF_TOOLS_HPP Definition: ByteBuffer.hpp:188
Definition: AmiIoHandler.hpp:23