36 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ 37 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ 192 # include <sys/types.h> 193 # include <sys/stat.h> 194 #endif // !_WIN32_WCE 200 #define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" 201 #define GTEST_FLAG_PREFIX_ "gtest_" 202 #define GTEST_FLAG_PREFIX_DASH_ "gtest-" 203 #define GTEST_FLAG_PREFIX_UPPER_ "GTEST_" 204 #define GTEST_NAME_ "Google Test" 205 #define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/" 210 # define GTEST_GCC_VER_ \ 211 (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__) 216 # define GTEST_OS_CYGWIN 1 217 #elif defined __SYMBIAN32__ 218 # define GTEST_OS_SYMBIAN 1 220 # define GTEST_OS_WINDOWS 1 222 # define GTEST_OS_WINDOWS_MOBILE 1 223 # elif defined(__MINGW__) || defined(__MINGW32__) 224 # define GTEST_OS_WINDOWS_MINGW 1 226 # define GTEST_OS_WINDOWS_DESKTOP 1 227 # endif // _WIN32_WCE 228 #elif defined __APPLE__ 229 # define GTEST_OS_MAC 1 230 #elif defined __linux__ 231 # define GTEST_OS_LINUX 1 233 # define GTEST_OS_LINUX_ANDROID 1 235 #elif defined __MVS__ 236 # define GTEST_OS_ZOS 1 237 #elif defined(__sun) && defined(__SVR4) 238 # define GTEST_OS_SOLARIS 1 240 # define GTEST_OS_AIX 1 241 #elif defined(__hpux) 242 # define GTEST_OS_HPUX 1 243 #elif defined __native_client__ 244 # define GTEST_OS_NACL 1 250 #if !GTEST_OS_WINDOWS 259 # include <strings.h> 261 #elif !GTEST_OS_WINDOWS_MOBILE 267 #ifndef GTEST_HAS_POSIX_RE 268 # define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS) 271 #if GTEST_HAS_POSIX_RE 279 # define GTEST_USES_POSIX_RE 1 281 #elif GTEST_OS_WINDOWS 285 # define GTEST_USES_SIMPLE_RE 1 291 # define GTEST_USES_SIMPLE_RE 1 293 #endif // GTEST_HAS_POSIX_RE 295 #ifndef GTEST_HAS_EXCEPTIONS 298 # if defined(_MSC_VER) || defined(__BORLANDC__) 302 # ifndef _HAS_EXCEPTIONS 303 # define _HAS_EXCEPTIONS 1 304 # endif // _HAS_EXCEPTIONS 305 # define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS 306 # elif defined(__GNUC__) && __EXCEPTIONS 308 # define GTEST_HAS_EXCEPTIONS 1 309 # elif defined(__SUNPRO_CC) 313 # define GTEST_HAS_EXCEPTIONS 1 314 # elif defined(__IBMCPP__) && __EXCEPTIONS 316 # define GTEST_HAS_EXCEPTIONS 1 317 # elif defined(__HP_aCC) 320 # define GTEST_HAS_EXCEPTIONS 1 324 # define GTEST_HAS_EXCEPTIONS 0 325 # endif // defined(_MSC_VER) || defined(__BORLANDC__) 326 #endif // GTEST_HAS_EXCEPTIONS 328 #if !defined(GTEST_HAS_STD_STRING) 331 # define GTEST_HAS_STD_STRING 1 332 #elif !GTEST_HAS_STD_STRING 334 # error "Google Test cannot be used where ::std::string isn't available." 335 #endif // !defined(GTEST_HAS_STD_STRING) 337 #ifndef GTEST_HAS_GLOBAL_STRING 341 # define GTEST_HAS_GLOBAL_STRING 0 343 #endif // GTEST_HAS_GLOBAL_STRING 345 #ifndef GTEST_HAS_STD_WSTRING 354 # define GTEST_HAS_STD_WSTRING \ 355 (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS)) 357 #endif // GTEST_HAS_STD_WSTRING 359 #ifndef GTEST_HAS_GLOBAL_WSTRING 362 # define GTEST_HAS_GLOBAL_WSTRING \ 363 (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING) 364 #endif // GTEST_HAS_GLOBAL_WSTRING 367 #ifndef GTEST_HAS_RTTI 373 # ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled. 374 # define GTEST_HAS_RTTI 1 376 # define GTEST_HAS_RTTI 0 380 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302) 383 # define GTEST_HAS_RTTI 1 385 # define GTEST_HAS_RTTI 0 386 # endif // __GXX_RTTI 390 # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) 393 # define GTEST_HAS_RTTI 1 395 # define GTEST_HAS_RTTI 0 401 # define GTEST_HAS_RTTI 1 405 #endif // GTEST_HAS_RTTI 414 #ifndef GTEST_HAS_PTHREAD 420 # define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX) 421 #endif // GTEST_HAS_PTHREAD 423 #if GTEST_HAS_PTHREAD 426 # include <pthread.h> 435 #ifndef GTEST_HAS_TR1_TUPLE 437 # define GTEST_HAS_TR1_TUPLE 1 438 #endif // GTEST_HAS_TR1_TUPLE 442 #ifndef GTEST_USE_OWN_TR1_TUPLE 452 # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \ 454 # define GTEST_USE_OWN_TR1_TUPLE 0 456 # define GTEST_USE_OWN_TR1_TUPLE 1 459 #endif // GTEST_USE_OWN_TR1_TUPLE 464 #if GTEST_HAS_TR1_TUPLE 466 # if GTEST_USE_OWN_TR1_TUPLE 468 # elif GTEST_OS_SYMBIAN 475 # ifdef BOOST_HAS_TR1_TUPLE 476 # undef BOOST_HAS_TR1_TUPLE 477 # endif // BOOST_HAS_TR1_TUPLE 481 # define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED 484 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) 488 # if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 494 # define _TR1_FUNCTIONAL 1 495 # include <tr1/tuple> 496 # undef _TR1_FUNCTIONAL // Allows the user to #include 499 # include <tr1/tuple> 500 # endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 506 # endif // GTEST_USE_OWN_TR1_TUPLE 508 #endif // GTEST_HAS_TR1_TUPLE 514 #ifndef GTEST_HAS_CLONE 517 # if GTEST_OS_LINUX && !defined(__ia64__) 518 # define GTEST_HAS_CLONE 1 520 # define GTEST_HAS_CLONE 0 521 # endif // GTEST_OS_LINUX && !defined(__ia64__) 523 #endif // GTEST_HAS_CLONE 527 #ifndef GTEST_HAS_STREAM_REDIRECTION 530 # if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN 531 # define GTEST_HAS_STREAM_REDIRECTION 0 533 # define GTEST_HAS_STREAM_REDIRECTION 1 534 # endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN 535 #endif // GTEST_HAS_STREAM_REDIRECTION 541 #if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \ 542 (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \ 543 GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX) 544 # define GTEST_HAS_DEATH_TEST 1 551 #define GTEST_HAS_PARAM_TEST 1 557 #if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \ 558 defined(__IBMCPP__) || defined(__HP_aCC) 559 # define GTEST_HAS_TYPED_TEST 1 560 # define GTEST_HAS_TYPED_TEST_P 1 567 #if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC) 568 # define GTEST_HAS_COMBINE 1 572 #define GTEST_WIDE_STRING_USES_UTF16_ \ 573 (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX) 577 # define GTEST_CAN_STREAM_RESULTS_ 1 590 #ifdef __INTEL_COMPILER 591 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ 593 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT 607 #if defined(__GNUC__) && !defined(COMPILER_ICC) 608 # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) 610 # define GTEST_ATTRIBUTE_UNUSED_ 615 #define GTEST_DISALLOW_ASSIGN_(type)\ 616 void operator=(type const &) 620 #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\ 622 GTEST_DISALLOW_ASSIGN_(type) 629 #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC) 630 # define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result)) 632 # define GTEST_MUST_USE_RESULT_ 633 #endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC 638 #ifndef GTEST_HAS_SEH 641 # if defined(_MSC_VER) || defined(__BORLANDC__) 643 # define GTEST_HAS_SEH 1 646 # define GTEST_HAS_SEH 0 649 #endif // GTEST_HAS_SEH 653 # if GTEST_LINKED_AS_SHARED_LIBRARY 654 # define GTEST_API_ __declspec(dllimport) 655 # elif GTEST_CREATE_SHARED_LIBRARY 656 # define GTEST_API_ __declspec(dllexport) 667 # define GTEST_NO_INLINE_ __attribute__((noinline)) 669 # define GTEST_NO_INLINE_ 699 #define GTEST_COMPILE_ASSERT_(expr, msg) \ 700 typedef ::testing::internal::CompileAssert<(bool(expr))> \ 701 msg[bool(expr) ? 1 : -1] 747 template <
typename T1,
typename T2>
750 template <
typename T>
753 #if GTEST_HAS_GLOBAL_STRING 757 #endif // GTEST_HAS_GLOBAL_STRING 759 #if GTEST_HAS_GLOBAL_WSTRING 761 #elif GTEST_HAS_STD_WSTRING 763 #endif // GTEST_HAS_GLOBAL_WSTRING 773 template <
typename T>
783 T*
get()
const {
return ptr_; }
793 if (
IsTrue(
sizeof(T) > 0)) {
818 #if GTEST_HAS_GLOBAL_STRING 822 #endif // GTEST_HAS_GLOBAL_STRING 824 RE(
const char* regex) { Init(regex); }
828 const char*
pattern()
const {
return pattern_; }
838 return FullMatch(str.c_str(), re);
841 return PartialMatch(str.c_str(), re);
844 #if GTEST_HAS_GLOBAL_STRING 847 return FullMatch(str.c_str(), re);
850 return PartialMatch(str.c_str(), re);
853 #endif // GTEST_HAS_GLOBAL_STRING 855 static bool FullMatch(
const char* str,
const RE& re);
856 static bool PartialMatch(
const char* str,
const RE& re);
859 void Init(
const char* regex);
868 #if GTEST_USES_POSIX_RE 873 #else // GTEST_USES_SIMPLE_RE 875 const char* full_pattern_;
923 #define GTEST_LOG_(severity) \ 924 ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \ 925 __FILE__, __LINE__).GetStream() 944 #define GTEST_CHECK_(condition) \ 945 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ 946 if (::testing::internal::IsTrue(condition)) \ 949 GTEST_LOG_(FATAL) << "Condition " #condition " failed. " 956 #define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \ 957 if (const int gtest_error = (posix_call)) \ 958 GTEST_LOG_(FATAL) << #posix_call << "failed with error " \ 981 template<
typename To>
1005 template<
typename To,
typename From>
1013 ::testing::internal::ImplicitCast_<From*>(to);
1018 GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);
1020 return static_cast<To
>(f);
1028 template <
class Derived,
class Base>
1032 return dynamic_cast<Derived*
>(base);
1034 return static_cast<Derived*
>(base);
1038 #if GTEST_HAS_STREAM_REDIRECTION 1051 #endif // GTEST_HAS_STREAM_REDIRECTION 1054 #if GTEST_HAS_DEATH_TEST 1057 extern ::std::vector<String> g_argvs;
1060 const ::std::vector<String>& GetArgvs();
1062 #endif // GTEST_HAS_DEATH_TEST 1066 #if GTEST_HAS_PTHREAD 1071 inline void SleepMilliseconds(
int n) {
1072 const timespec time = {
1076 nanosleep(&time, NULL);
1085 class Notification {
1087 Notification() : notified_(
false) {}
1091 void Notify() { notified_ =
true; }
1095 void WaitForNotification() {
1097 SleepMilliseconds(10);
1102 volatile bool notified_;
1112 class ThreadWithParamBase {
1114 virtual ~ThreadWithParamBase() {}
1115 virtual void Run() = 0;
1124 extern "C" inline void* ThreadFuncWithCLinkage(
void* thread) {
1125 static_cast<ThreadWithParamBase*
>(thread)->Run();
1141 template <
typename T>
1142 class ThreadWithParam :
public ThreadWithParamBase {
1144 typedef void (*UserThreadFunc)(
T);
1147 UserThreadFunc func, T param, Notification* thread_can_start)
1150 thread_can_start_(thread_can_start),
1152 ThreadWithParamBase*
const base =
this;
1156 pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
1158 ~ThreadWithParam() { Join(); }
1167 virtual void Run() {
1168 if (thread_can_start_ != NULL)
1169 thread_can_start_->WaitForNotification();
1174 const UserThreadFunc func_;
1178 Notification*
const thread_can_start_;
1209 owner_ = pthread_self();
1223 void AssertHeld()
const {
1225 <<
"The current thread is not holding the mutex @" <<
this;
1234 pthread_mutex_t mutex_;
1239 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ 1240 extern ::testing::internal::MutexBase mutex 1243 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ 1244 ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, 0 } 1248 class Mutex :
public MutexBase {
1268 : mutex_(mutex) { mutex_->Lock(); }
1273 MutexBase*
const mutex_;
1286 class ThreadLocalValueHolderBase {
1288 virtual ~ThreadLocalValueHolderBase() {}
1293 extern "C" inline void DeleteThreadLocalValue(
void* value_holder) {
1294 delete static_cast<ThreadLocalValueHolderBase*
>(value_holder);
1326 template <
typename T>
1331 explicit ThreadLocal(
const T& value) : key_(CreateKey()),
1336 DeleteThreadLocalValue(pthread_getspecific(key_));
1343 T* pointer() {
return GetOrCreateValue(); }
1344 const T* pointer()
const {
return GetOrCreateValue(); }
1345 const T&
get()
const {
return *pointer(); }
1346 void set(
const T& value) { *pointer() = value; }
1350 class ValueHolder :
public ThreadLocalValueHolderBase {
1352 explicit ValueHolder(
const T& value) : value_(value) {}
1354 T* pointer() {
return &value_; }
1361 static pthread_key_t CreateKey() {
1366 pthread_key_create(&key, &DeleteThreadLocalValue));
1370 T* GetOrCreateValue()
const {
1371 ThreadLocalValueHolderBase*
const holder =
1372 static_cast<ThreadLocalValueHolderBase*
>(pthread_getspecific(key_));
1373 if (holder != NULL) {
1374 return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
1377 ValueHolder*
const new_holder =
new ValueHolder(default_);
1378 ThreadLocalValueHolderBase*
const holder_base = new_holder;
1380 return new_holder->pointer();
1384 const pthread_key_t key_;
1390 # define GTEST_IS_THREADSAFE 1 1392 #else // GTEST_HAS_PTHREAD 1405 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ 1406 extern ::testing::internal::Mutex mutex 1408 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex 1417 template <
typename T>
1424 const T&
get()
const {
return value_; }
1425 void set(
const T& value) { value_ = value; }
1432 # define GTEST_IS_THREADSAFE 0 1434 #endif // GTEST_HAS_PTHREAD 1446 #if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC) 1449 # define GTEST_ELLIPSIS_NEEDS_POD_ 1 1451 # define GTEST_CAN_COMPARE_NULL 1 1458 #if defined(__SYMBIAN32__) || defined(__IBMCPP__) 1459 # define GTEST_NEEDS_IS_POINTER_ 1 1462 template <
bool bool_value>
1465 static const bool value = bool_value;
1472 template <
typename T>
1475 template <
typename T>
1478 template <
typename Iterator>
1483 template <
typename T>
1488 template <
typename T>
1493 #if GTEST_OS_WINDOWS 1494 # define GTEST_PATH_SEP_ "\\" 1495 # define GTEST_HAS_ALT_PATH_SEP_ 1 1499 # define GTEST_PATH_SEP_ "/" 1500 # define GTEST_HAS_ALT_PATH_SEP_ 0 1502 #endif // GTEST_OS_WINDOWS 1512 return isalpha(static_cast<unsigned char>(ch)) != 0;
1515 return isalnum(static_cast<unsigned char>(ch)) != 0;
1518 return isdigit(static_cast<unsigned char>(ch)) != 0;
1521 return islower(static_cast<unsigned char>(ch)) != 0;
1524 return isspace(static_cast<unsigned char>(ch)) != 0;
1527 return isupper(static_cast<unsigned char>(ch)) != 0;
1530 return isxdigit(static_cast<unsigned char>(ch)) != 0;
1534 return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
1537 return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
1550 #if GTEST_OS_WINDOWS 1552 typedef struct _stat StatStruct;
1554 # ifdef __BORLANDC__ 1555 inline int IsATTY(
int fd) {
return isatty(fd); }
1556 inline int StrCaseCmp(
const char* s1,
const char* s2) {
1557 return stricmp(s1, s2);
1559 inline char*
StrDup(
const char* src) {
return strdup(src); }
1560 # else // !__BORLANDC__ 1561 # if GTEST_OS_WINDOWS_MOBILE 1562 inline int IsATTY(
int ) {
return 0; }
1564 inline int IsATTY(
int fd) {
return _isatty(fd); }
1565 # endif // GTEST_OS_WINDOWS_MOBILE 1566 inline int StrCaseCmp(
const char* s1,
const char* s2) {
1567 return _stricmp(s1, s2);
1569 inline char*
StrDup(
const char* src) {
return _strdup(src); }
1570 # endif // __BORLANDC__ 1572 # if GTEST_OS_WINDOWS_MOBILE 1573 inline int FileNo(FILE* file) {
return reinterpret_cast<int>(_fileno(file)); }
1577 inline int FileNo(FILE* file) {
return _fileno(file); }
1578 inline int Stat(
const char*
path, StatStruct* buf) {
return _stat(path, buf); }
1579 inline int RmDir(
const char* dir) {
return _rmdir(dir); }
1580 inline bool IsDir(
const StatStruct& st) {
1581 return (_S_IFDIR & st.st_mode) != 0;
1583 # endif // GTEST_OS_WINDOWS_MOBILE 1587 typedef struct stat StatStruct;
1589 inline int FileNo(FILE* file) {
return fileno(file); }
1590 inline int IsATTY(
int fd) {
return isatty(fd); }
1591 inline int Stat(
const char* path, StatStruct* buf) {
return stat(path, buf); }
1593 return strcasecmp(s1, s2);
1595 inline char*
StrDup(
const char* src) {
return strdup(src); }
1596 inline int RmDir(
const char* dir) {
return rmdir(dir); }
1597 inline bool IsDir(
const StatStruct& st) {
return S_ISDIR(st.st_mode); }
1599 #endif // GTEST_OS_WINDOWS 1605 # pragma warning(push) 1606 # pragma warning(disable:4996) 1609 inline const char*
StrNCpy(
char* dest,
const char* src,
size_t n) {
1610 return strncpy(dest, src, n);
1617 #if !GTEST_OS_WINDOWS_MOBILE 1618 inline int ChDir(
const char* dir) {
return chdir(dir); }
1620 inline FILE*
FOpen(
const char* path,
const char* mode) {
1621 return fopen(path, mode);
1623 #if !GTEST_OS_WINDOWS_MOBILE 1624 inline FILE *
FReopen(
const char* path,
const char* mode, FILE* stream) {
1625 return freopen(path, mode, stream);
1627 inline FILE*
FDOpen(
int fd,
const char* mode) {
return fdopen(fd, mode); }
1629 inline int FClose(FILE* fp) {
return fclose(fp); }
1630 #if !GTEST_OS_WINDOWS_MOBILE 1631 inline int Read(
int fd,
void* buf,
unsigned int count) {
1632 return static_cast<int>(
read(fd, buf, count));
1634 inline int Write(
int fd,
const void* buf,
unsigned int count) {
1635 return static_cast<int>(
write(fd, buf, count));
1637 inline int Close(
int fd) {
return close(fd); }
1638 inline const char*
StrError(
int errnum) {
return strerror(errnum); }
1640 inline const char*
GetEnv(
const char* name) {
1641 #if GTEST_OS_WINDOWS_MOBILE 1644 #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9) 1647 const char*
const env = getenv(name);
1648 return (env != NULL && env[0] !=
'\0') ? env : NULL;
1650 return getenv(name);
1655 # pragma warning(pop) // Restores the warning state. 1658 #if GTEST_OS_WINDOWS_MOBILE 1665 #endif // GTEST_OS_WINDOWS_MOBILE 1677 ~(
static_cast<BiggestInt
>(1) << (8*
sizeof(BiggestInt) - 1));
1697 template <
size_t size>
1722 #if GTEST_OS_WINDOWS 1723 typedef __int64
Int;
1724 typedef unsigned __int64
UInt;
1728 #endif // GTEST_OS_WINDOWS 1741 #define GTEST_FLAG(name) FLAGS_gtest_##name 1744 #define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name) 1745 #define GTEST_DECLARE_int32_(name) \ 1746 GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name) 1747 #define GTEST_DECLARE_string_(name) \ 1748 GTEST_API_ extern ::testing::internal::String GTEST_FLAG(name) 1751 #define GTEST_DEFINE_bool_(name, default_val, doc) \ 1752 GTEST_API_ bool GTEST_FLAG(name) = (default_val) 1753 #define GTEST_DEFINE_int32_(name, default_val, doc) \ 1754 GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val) 1755 #define GTEST_DEFINE_string_(name, default_val, doc) \ 1756 GTEST_API_ ::testing::internal::String GTEST_FLAG(name) = (default_val) 1764 bool ParseInt32(
const Message& src_text,
const char* str, Int32* value);
1775 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ bool IsXDigit(char ch)
Definition: gtest-port.h:1529
FILE * FReopen(const char *path, const char *mode, FILE *stream)
Definition: gtest-port.h:1624
scoped_ptr(T *p=NULL)
Definition: gtest-port.h:778
GTEST_API_ Int32 Int32FromGTestEnv(const char *flag, Int32 default_val)
Definition: gtest-port.cc:717
std::string read(const std::string &filename)
Reads text from a file.
Definition: ConsoleCommandCompilation.cc:241
GTEST_API_ bool IsTrue(bool condition)
Definition: gtest.cc:4531
basic_path< std::string, path_traits > path
Definition: CorePrereqs.h:316
Definition: gtest-port.h:1410
To ImplicitCast_(To x)
Definition: gtest-port.h:982
GTEST_API_ String GetCapturedStdout()
Definition: gmock-actions.h:49
void reset(T *p=NULL)
Definition: gtest-port.h:791
int FClose(FILE *fp)
Definition: gtest-port.h:1629
void write(const std::string &filename, const std::string &text)
Writes text to a file.
Definition: ConsoleCommandCompilation.cc:205
ENet time constants and macros.
static bool PartialMatch(const ::std::string &str, const RE &re)
Definition: gtest-port.h:840
T value_
Definition: gtest-port.h:1427
Definition: gtest-port.h:900
const char * StringFromGTestEnv(const char *flag, const char *default_val)
Definition: gtest-port.cc:739
unsigned long long UInt
Definition: gtest-port.h:1727
GTEST_API_::std::string FormatFileLocation(const char *file, int line)
Definition: gtest-port.cc:431
Definition: gtest-port.h:908
regex_t full_regex_
Definition: gtest-port.h:870
int IsATTY(int fd)
Definition: gtest-port.h:1590
::std::string string
Definition: gtest-port.h:756
bool_constant< bool_value > type
Definition: gtest-port.h:1464
const char * pattern() const
Definition: gtest-port.h:828
regex_t partial_regex_
Definition: gtest-port.h:871
void UInt
Definition: gtest-port.h:1702
Definition: gtest-port.h:1473
bool ParseInt32(const Message &src_text, const char *str, Int32 *value)
Definition: gtest-port.cc:665
Definition: gtest-port.h:1479
::std::wstring wstring
Definition: gtest-port.h:762
RE(const char *regex)
Definition: gtest-port.h:824
GTEST_API_ size_t GetThreadCount()
Definition: gtest-port.cc:103
bool IsDigit(char ch)
Definition: gtest-port.h:1517
Definition: gtest-port.h:902
int Stat(const char *path, StatStruct *buf)
Definition: gtest-port.h:1591
T * release()
Definition: gtest-port.h:785
int ChDir(const char *dir)
Definition: gtest-port.h:1618
const char * GetEnv(const char *name)
Definition: gtest-port.h:1640
#define GTEST_API_
Definition: gtest-port.h:662
const char * pattern_
Definition: gtest-port.h:865
GTEST_API_ void CaptureStdout()
GTEST_API_ String GetCapturedStderr()
const GTestLogSeverity severity_
Definition: gtest-port.h:918
TypeWithSize< 8 >::Int TimeInMillis
Definition: gtest-port.h:1736
~scoped_ptr()
Definition: gtest-port.h:779
GTestLogSeverity
Definition: gtest-port.h:898
bool_constant< true > true_type
Definition: gtest-port.h:1470
ThreadLocal(const T &value)
Definition: gtest-port.h:1421
To DownCast_(From *f)
Definition: gtest-port.h:1006
#define GTEST_DISALLOW_ASSIGN_(type)
Definition: gtest-port.h:615
bool_constant< false > false_type
Definition: gtest-port.h:1469
typedef void(ENET_CALLBACK *ENetPacketFreeCallback)(struct _ENetPacket *)
TypeWithSize< 4 >::UInt UInt32
Definition: gtest-port.h:1733
int Write(int fd, const void *buf, unsigned int count)
Definition: gtest-port.h:1634
char ToLower(char ch)
Definition: gtest-port.h:1533
Mutex()
Definition: gtest-port.h:1401
const T * pointer() const
Definition: gtest-port.h:1423
TypeWithSize< 4 >::Int Int32
Definition: gtest-port.h:1732
bool IsSpace(char ch)
Definition: gtest-port.h:1523
::std::ostream & GetStream()
Definition: gtest-port.h:915
int RmDir(const char *dir)
Definition: gtest-port.h:1596
T * operator->() const
Definition: gtest-port.h:782
#define GTEST_CHECK_(condition)
Definition: gtest-port.h:944
static bool FullMatch(const ::std::string &str, const RE &re)
Definition: gtest-port.h:837
Definition: gtest-port.h:748
void LogToStderr()
Definition: gtest-port.h:927
int Read(int fd, void *buf, unsigned int count)
Definition: gtest-port.h:1631
GTestMutexLock MutexLock
Definition: gtest-port.h:1415
T value_type
Definition: gtest-port.h:1490
Definition: gtest-port.h:901
Definition: gtest-string.h:81
int StrCaseCmp(const char *s1, const char *s2)
Definition: gtest-port.h:1592
Definition: InputPrereqs.h:96
long long BiggestInt
Definition: gtest-port.h:1501
Definition: gtest-port.h:809
bool IsDir(const StatStruct &st)
Definition: gtest-port.h:1597
Definition: gtest-port.h:1698
bool IsAlpha(char ch)
Definition: gtest-port.h:1511
#define GTEST_CHECK_POSIX_SUCCESS_(posix_call)
Definition: gtest-port.h:956
bool is_valid_
Definition: gtest-port.h:866
Definition: InputPrereqs.h:78
Definition: gtest-port.h:1463
unsigned int UInt
Definition: gtest-port.h:1714
int FileNo(FILE *file)
Definition: gtest-port.h:1589
GTEST_API_::std::string FormatCompilerIndependentFileLocation(const char *file, int line)
Definition: gtest-port.cc:449
Definition: gtest-port.h:899
bool BoolFromGTestEnv(const char *flag, bool default_val)
Definition: gtest-port.cc:707
FILE * FOpen(const char *path, const char *mode)
Definition: gtest-port.h:1620
bool IsLower(char ch)
Definition: gtest-port.h:1520
int Close(int fd)
Definition: gtest-port.h:1637
RE(const RE &other)
Definition: gtest-port.h:813
char ToUpper(char ch)
Definition: gtest-port.h:1536
void AssertHeld() const
Definition: gtest-port.h:1402
GTEST_API_ void CaptureStderr()
void Abort()
Definition: gtest-port.h:1664
Definition: gtest-port.h:1418
T value_type
Definition: gtest-port.h:1485
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
Definition: gtest-port.h:620
void FlushInfoLog()
Definition: gtest-port.h:928
const char * StrNCpy(char *dest, const char *src, size_t n)
Definition: gtest-port.h:1609
TypeWithSize< 8 >::UInt UInt64
Definition: gtest-port.h:1735
bool IsUpper(char ch)
Definition: gtest-port.h:1526
GTestMutexLock(Mutex *)
Definition: gtest-port.h:1412
RE(const ::std::string ®ex)
Definition: gtest-port.h:816
Definition: gtest-port.h:1399
Definition: gtest-port.h:696
TypeWithSize< 8 >::Int Int64
Definition: gtest-port.h:1734
int Int
Definition: gtest-port.h:1713
Iterator::value_type value_type
Definition: gtest-port.h:1480
Definition: gtest-port.h:774
long long Int
Definition: gtest-port.h:1726
ThreadLocal()
Definition: gtest-port.h:1420
FILE * FDOpen(int fd, const char *mode)
Definition: gtest-port.h:1627
const BiggestInt kMaxBiggestInt
Definition: gtest-port.h:1676
char * StrDup(const char *src)
Definition: gtest-port.h:1595
const char * StrError(int errnum)
Definition: gtest-port.h:1638
Derived * CheckedDowncastToActualType(Base *base)
Definition: gtest-port.h:1029
T & operator*() const
Definition: gtest-port.h:781
T * ptr_
Definition: gtest-port.h:800
T * pointer()
Definition: gtest-port.h:1422
T element_type
Definition: gtest-port.h:776
bool IsAlNum(char ch)
Definition: gtest-port.h:1514