proxygen
testing::internal::String Class Reference

#include <gtest-string.h>

Static Public Member Functions

static const char * CloneCString (const char *c_str)
 
static bool CStringEquals (const char *lhs, const char *rhs)
 
static std::string ShowWideCString (const wchar_t *wide_c_str)
 
static bool WideCStringEquals (const wchar_t *lhs, const wchar_t *rhs)
 
static bool CaseInsensitiveCStringEquals (const char *lhs, const char *rhs)
 
static bool CaseInsensitiveWideCStringEquals (const wchar_t *lhs, const wchar_t *rhs)
 
static bool EndsWithCaseInsensitive (const std::string &str, const std::string &suffix)
 
static std::string FormatIntWidth2 (int value)
 
static std::string FormatHexInt (int value)
 
static std::string FormatByte (unsigned char value)
 
static const char * CloneCString (const char *c_str)
 
static bool CStringEquals (const char *lhs, const char *rhs)
 
static std::string ShowWideCString (const wchar_t *wide_c_str)
 
static bool WideCStringEquals (const wchar_t *lhs, const wchar_t *rhs)
 
static bool CaseInsensitiveCStringEquals (const char *lhs, const char *rhs)
 
static bool CaseInsensitiveWideCStringEquals (const wchar_t *lhs, const wchar_t *rhs)
 
static bool EndsWithCaseInsensitive (const std::string &str, const std::string &suffix)
 
static std::string FormatIntWidth2 (int value)
 
static std::string FormatHexInt (int value)
 
static std::string FormatByte (unsigned char value)
 
static const char * CloneCString (const char *c_str)
 
static bool CStringEquals (const char *lhs, const char *rhs)
 
static std::string ShowWideCString (const wchar_t *wide_c_str)
 
static bool WideCStringEquals (const wchar_t *lhs, const wchar_t *rhs)
 
static bool CaseInsensitiveCStringEquals (const char *lhs, const char *rhs)
 
static bool CaseInsensitiveWideCStringEquals (const wchar_t *lhs, const wchar_t *rhs)
 
static bool EndsWithCaseInsensitive (const std::string &str, const std::string &suffix)
 
static std::string FormatIntWidth2 (int value)
 
static std::string FormatHexInt (int value)
 
static std::string FormatByte (unsigned char value)
 

Private Member Functions

 String ()
 
 String ()
 
 String ()
 

Detailed Description

Definition at line 58 of file gtest-string.h.

Constructor & Destructor Documentation

testing::internal::String::String ( )
private
testing::internal::String::String ( )
private
testing::internal::String::String ( )
private

Member Function Documentation

bool testing::internal::String::CaseInsensitiveCStringEquals ( const char *  lhs,
const char *  rhs 
)
static

Definition at line 1905 of file gtest.cc.

References testing::internal::posix::StrCaseCmp().

1905  {
1906  if (lhs == NULL)
1907  return rhs == NULL;
1908  if (rhs == NULL)
1909  return false;
1910  return posix::StrCaseCmp(lhs, rhs) == 0;
1911 }
FOLLY_PUSH_WARNING RHS rhs
Definition: Traits.h:649
int StrCaseCmp(const char *s1, const char *s2)
Definition: gtest-port.h:2343
static bool testing::internal::String::CaseInsensitiveCStringEquals ( const char *  lhs,
const char *  rhs 
)
static
static bool testing::internal::String::CaseInsensitiveCStringEquals ( const char *  lhs,
const char *  rhs 
)
static
static bool testing::internal::String::CaseInsensitiveWideCStringEquals ( const wchar_t *  lhs,
const wchar_t *  rhs 
)
static
static bool testing::internal::String::CaseInsensitiveWideCStringEquals ( const wchar_t *  lhs,
const wchar_t *  rhs 
)
static
bool testing::internal::String::CaseInsensitiveWideCStringEquals ( const wchar_t *  lhs,
const wchar_t *  rhs 
)
static

Definition at line 1925 of file gtest.cc.

Referenced by operator<<().

1926  {
1927  if (lhs == NULL) return rhs == NULL;
1928 
1929  if (rhs == NULL) return false;
1930 
1931 #if GTEST_OS_WINDOWS
1932  return _wcsicmp(lhs, rhs) == 0;
1933 #elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID
1934  return wcscasecmp(lhs, rhs) == 0;
1935 #else
1936  // Android, Mac OS X and Cygwin don't define wcscasecmp.
1937  // Other unknown OSes may not define it either.
1938  wint_t left, right;
1939  do {
1940  left = towlower(*lhs++);
1941  right = towlower(*rhs++);
1942  } while (left && left == right);
1943  return left == right;
1944 #endif // OS selector
1945 }
FOLLY_PUSH_WARNING RHS rhs
Definition: Traits.h:649
static const char* testing::internal::String::CloneCString ( const char *  c_str)
static
static const char* testing::internal::String::CloneCString ( const char *  c_str)
static
static const char* testing::internal::String::CloneCString ( const char *  c_str)
static
bool testing::internal::String::CStringEquals ( const char *  lhs,
const char *  rhs 
)
static

Definition at line 894 of file gtest.cc.

References i.

Referenced by testing::internal::PrettyUnitTestResultPrinter::OnTestProgramEnd(), and testing::internal::ShouldRunTestCase().

894  {
895  if ( lhs == NULL ) return rhs == NULL;
896 
897  if ( rhs == NULL ) return false;
898 
899  return strcmp(lhs, rhs) == 0;
900 }
FOLLY_PUSH_WARNING RHS rhs
Definition: Traits.h:649
static bool testing::internal::String::CStringEquals ( const char *  lhs,
const char *  rhs 
)
static
static bool testing::internal::String::CStringEquals ( const char *  lhs,
const char *  rhs 
)
static
static bool testing::internal::String::EndsWithCaseInsensitive ( const std::string str,
const std::string suffix 
)
static
static bool testing::internal::String::EndsWithCaseInsensitive ( const std::string str,
const std::string suffix 
)
static
bool testing::internal::String::EndsWithCaseInsensitive ( const std::string str,
const std::string suffix 
)
static

Definition at line 1949 of file gtest.cc.

References testing::internal::CaseInsensitiveCStringEquals().

Referenced by testing::internal::IsPathSeparator(), operator<<(), and testing::internal::FilePath::RemoveExtension().

1950  {
1951  const size_t str_len = str.length();
1952  const size_t suffix_len = suffix.length();
1953  return (str_len >= suffix_len) &&
1954  CaseInsensitiveCStringEquals(str.c_str() + str_len - suffix_len,
1955  suffix.c_str());
1956 }
const char * suffix
Definition: String.cpp:272
static bool CaseInsensitiveCStringEquals(const char *lhs, const char *rhs)
Definition: gtest.cc:1905
static std::string testing::internal::String::FormatByte ( unsigned char  value)
static
std::string testing::internal::String::FormatByte ( unsigned char  value)
static

Definition at line 1973 of file gtest.cc.

References value.

Referenced by testing::internal::XmlUnitTestResultPrinter::EscapeXml(), testing::internal::XmlUnitTestResultPrinter::EscapeXmlText(), testing::internal::PortableLocaltime(), and testing::internal::XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes().

1973  {
1974  std::stringstream ss;
1975  ss << std::setfill('0') << std::setw(2) << std::hex << std::uppercase
1976  << static_cast<unsigned int>(value);
1977  return ss.str();
1978 }
static const char *const value
Definition: Conv.cpp:50
static std::string testing::internal::String::FormatByte ( unsigned char  value)
static
std::string testing::internal::String::FormatHexInt ( int  value)
static

Definition at line 1966 of file gtest.cc.

References value.

1966  {
1967  std::stringstream ss;
1968  ss << std::hex << std::uppercase << value;
1969  return ss.str();
1970 }
static const char *const value
Definition: Conv.cpp:50
static std::string testing::internal::String::FormatHexInt ( int  value)
static
static std::string testing::internal::String::FormatHexInt ( int  value)
static
static std::string testing::internal::String::FormatIntWidth2 ( int  value)
static
std::string testing::internal::String::FormatIntWidth2 ( int  value)
static

Definition at line 1959 of file gtest.cc.

References value.

Referenced by testing::internal::FormatEpochTimeInMillisAsIso8601(), and testing::internal::PortableLocaltime().

1959  {
1960  std::stringstream ss;
1961  ss << std::setfill('0') << std::setw(2) << value;
1962  return ss.str();
1963 }
static const char *const value
Definition: Conv.cpp:50
static std::string testing::internal::String::FormatIntWidth2 ( int  value)
static
static std::string testing::internal::String::ShowWideCString ( const wchar_t *  wide_c_str)
static
std::string testing::internal::String::ShowWideCString ( const wchar_t *  wide_c_str)
static

Definition at line 1848 of file gtest.cc.

References testing::internal::WideStringToUtf8().

Referenced by testing::Message::operator<<(), operator<<(), and testing::internal::ShouldRunTestCase().

1848  {
1849  if (wide_c_str == NULL) return "(null)";
1850 
1851  return internal::WideStringToUtf8(wide_c_str, -1);
1852 }
GTEST_API_ std::string WideStringToUtf8(const wchar_t *str, int num_chars)
Definition: gtest.cc:1823
static std::string testing::internal::String::ShowWideCString ( const wchar_t *  wide_c_str)
static
static bool testing::internal::String::WideCStringEquals ( const wchar_t *  lhs,
const wchar_t *  rhs 
)
static
bool testing::internal::String::WideCStringEquals ( const wchar_t *  lhs,
const wchar_t *  rhs 
)
static

Definition at line 1860 of file gtest.cc.

1860  {
1861  if (lhs == NULL) return rhs == NULL;
1862 
1863  if (rhs == NULL) return false;
1864 
1865  return wcscmp(lhs, rhs) == 0;
1866 }
FOLLY_PUSH_WARNING RHS rhs
Definition: Traits.h:649
static bool testing::internal::String::WideCStringEquals ( const wchar_t *  lhs,
const wchar_t *  rhs 
)
static

The documentation for this class was generated from the following files: