19 #ifndef INCLUDE_RCF_TOOLS_HPP 20 #define INCLUDE_RCF_TOOLS_HPP 27 #include <RCF/Config.hpp> 28 #include <RCF/Export.hpp> 32 #pragma comment(lib, "ws2_32.lib") 33 #pragma comment(lib, "mswsock.lib") 34 #pragma comment(lib, "advapi32.lib") 35 #pragma comment(lib, "user32.lib") 36 #pragma comment(lib, "crypt32.lib") 37 #pragma comment(lib, "rpcrt4.lib") 43 static const int LogNameRcf = 1;
44 static const int LogLevel_1 = 1;
45 static const int LogLevel_2 = 2;
46 static const int LogLevel_3 = 3;
47 static const int LogLevel_4 = 4;
49 #define RCF_LOG_1() UTIL_LOG(RCF::LogNameRcf, RCF::LogLevel_1) 50 #define RCF_LOG_2() UTIL_LOG(RCF::LogNameRcf, RCF::LogLevel_2) 51 #define RCF_LOG_3() UTIL_LOG(RCF::LogNameRcf, RCF::LogLevel_3) 52 #define RCF_LOG_4() UTIL_LOG(RCF::LogNameRcf, RCF::LogLevel_4) 57 RCF_EXPORT
void doAssert(
const char * szFile,
int line,
const char * szFunc,
const char * szAssertion);
59 #define RCF_ASSERT(x) if (x) ; else RCF::doAssert(__FILE__, __LINE__, __FUNCTION__, #x); 69 RCF_EXPORT
void rcfThrow(
const char * szFile,
int line,
const char * szFunc,
const Exception & e);
71 #define RCF_THROW(e) RCF::rcfThrow(__FILE__, __LINE__, __FUNCTION__, e) 72 #define RCF_VERIFY(cond, e) if (cond); else RCF_THROW(e) 84 RCF_EXPORT
void rcfDtorCatchHandler(
const std::exception & e);
87 #define RCF_DTOR_BEGIN \ 90 #define RCF_DTOR_END \ 92 catch (const std::exception &e) \ 94 RCF::rcfDtorCatchHandler(e); \ 99 template<
typename Container,
typename Element>
100 void eraseRemove(Container & container,
const Element & element)
110 RCF_EXPORT std::uint64_t fileSize(
const std::string & path);
114 inline bool operator<(
115 const std::weak_ptr<T> & lhs,
116 const std::weak_ptr<T> & rhs)
118 std::owner_less< std::weak_ptr<T> > cmp;
119 return cmp(lhs, rhs);
123 inline bool operator==(
124 const std::weak_ptr<T> & lhs,
125 const std::weak_ptr<T> & rhs)
127 return ! (lhs < rhs) && ! (rhs < lhs);
131 inline bool operator!=(
132 const std::weak_ptr<T> & lhs,
133 const std::weak_ptr<T> & rhs)
135 return ! (lhs == rhs);
143 Noncopyable(
const Noncopyable&) =
delete;
144 Noncopyable& operator=(
const Noncopyable&) =
delete;
150 ScopeGuard(std::function<
void()> func);
157 std::function<void()> m_func;
160 RCF_EXPORT
void trim(std::string& s);
161 RCF_EXPORT
void trimLeft(std::string& s);
162 RCF_EXPORT
void trimRight(std::string& s);
163 RCF_EXPORT
bool iequals(
const std::string& lhs,
const std::string& rhs);
164 RCF_EXPORT
bool istartsWith(
const std::string& s,
const std::string& startsWith);
166 template<
typename TPtr>
167 std::string getTypeName(
const TPtr & tPtr)
172 return typeid(t).name();
181 typedef RCF::Noncopyable Noncopyable;
185 #define RCF_UNUSED_VARIABLE(x) ((void) x) 188 #define RCF_MIN (std::min) 189 #define RCF_MAX (std::max) 194 #define SF_FOR_EACH_FUNDAMENTAL_TYPE_(arg) \ 202 arg(unsigned short) \ 212 #define SF_FOR_EACH_FUNDAMENTAL_TYPE(arg) \ 213 SF_FOR_EACH_FUNDAMENTAL_TYPE_(arg) \ 215 arg(unsigned __int64) 219 #define SF_FOR_EACH_FUNDAMENTAL_TYPE(arg) \ 220 SF_FOR_EACH_FUNDAMENTAL_TYPE_(arg) \ 222 arg(unsigned long long) 226 #endif // ! INCLUDE_RCF_TOOLS_HPP Definition: ByteBuffer.hpp:189
Definition: AmiIoHandler.hpp:24