gtest-string.h (googletest-release-1.11.0) | : | gtest-string.h (googletest-release-1.12.0) | ||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
// | ||||
// The Google C++ Testing and Mocking Framework (Google Test) | // The Google C++ Testing and Mocking Framework (Google Test) | |||
// | // | |||
// This header file declares the String class and functions used internally by | // This header file declares the String class and functions used internally by | |||
// Google Test. They are subject to change without notice. They should not used | // Google Test. They are subject to change without notice. They should not used | |||
// by code external to Google Test. | // by code external to Google Test. | |||
// | // | |||
// This header file is #included by gtest-internal.h. | // This header file is #included by gtest-internal.h. | |||
// It should not be #included by other files. | // It should not be #included by other files. | |||
// GOOGLETEST_CM0001 DO NOT DELETE | // IWYU pragma: private, include "gtest/gtest.h" | |||
// IWYU pragma: friend gtest/.* | ||||
// IWYU pragma: friend gmock/.* | ||||
#ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ | |||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ | |||
#ifdef __BORLANDC__ | #ifdef __BORLANDC__ | |||
// string.h is not guaranteed to provide strcpy on C++ Builder. | // string.h is not guaranteed to provide strcpy on C++ Builder. | |||
# include <mem.h> | #include <mem.h> | |||
#endif | #endif | |||
#include <string.h> | #include <string.h> | |||
#include <cstdint> | #include <cstdint> | |||
#include <string> | #include <string> | |||
#include "gtest/internal/gtest-port.h" | #include "gtest/internal/gtest-port.h" | |||
namespace testing { | namespace testing { | |||
namespace internal { | namespace internal { | |||
// String - an abstract class holding static string utilities. | // String - an abstract class holding static string utilities. | |||
class GTEST_API_ String { | class GTEST_API_ String { | |||
skipping to change at line 126 | skipping to change at line 129 | |||
// NULL C string is considered different to any non-NULL C string, | // NULL C string is considered different to any non-NULL C string, | |||
// including the empty string. | // including the empty string. | |||
static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); | static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs); | |||
// Compares two C strings, ignoring case. Returns true if and only if | // Compares two C strings, ignoring case. Returns true if and only if | |||
// they have the same content. | // they have the same content. | |||
// | // | |||
// Unlike strcasecmp(), this function can handle NULL argument(s). | // Unlike strcasecmp(), this function can handle NULL argument(s). | |||
// A NULL C string is considered different to any non-NULL C string, | // A NULL C string is considered different to any non-NULL C string, | |||
// including the empty string. | // including the empty string. | |||
static bool CaseInsensitiveCStringEquals(const char* lhs, | static bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs); | |||
const char* rhs); | ||||
// Compares two wide C strings, ignoring case. Returns true if and only if | // Compares two wide C strings, ignoring case. Returns true if and only if | |||
// they have the same content. | // they have the same content. | |||
// | // | |||
// Unlike wcscasecmp(), this function can handle NULL argument(s). | // Unlike wcscasecmp(), this function can handle NULL argument(s). | |||
// A NULL C string is considered different to any non-NULL wide C string, | // A NULL C string is considered different to any non-NULL wide C string, | |||
// including the empty string. | // including the empty string. | |||
// NB: The implementations on different platforms slightly differ. | // NB: The implementations on different platforms slightly differ. | |||
// On windows, this method uses _wcsicmp which compares according to LC_CTYPE | // On windows, this method uses _wcsicmp which compares according to LC_CTYPE | |||
// environment variable. On GNU platform this method uses wcscasecmp | // environment variable. On GNU platform this method uses wcscasecmp | |||
// which compares according to LC_CTYPE category of the current locale. | // which compares according to LC_CTYPE category of the current locale. | |||
// On MacOS X, it uses towlower, which also uses LC_CTYPE category of the | // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the | |||
// current locale. | // current locale. | |||
static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs, | static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs, | |||
const wchar_t* rhs); | const wchar_t* rhs); | |||
// Returns true if and only if the given string ends with the given suffix, | // Returns true if and only if the given string ends with the given suffix, | |||
// ignoring case. Any string is considered to end with an empty suffix. | // ignoring case. Any string is considered to end with an empty suffix. | |||
static bool EndsWithCaseInsensitive( | static bool EndsWithCaseInsensitive(const std::string& str, | |||
const std::string& str, const std::string& suffix); | const std::string& suffix); | |||
// Formats an int value as "%02d". | // Formats an int value as "%02d". | |||
static std::string FormatIntWidth2(int value); // "%02d" for width == 2 | static std::string FormatIntWidth2(int value); // "%02d" for width == 2 | |||
// Formats an int value to given width with leading zeros. | // Formats an int value to given width with leading zeros. | |||
static std::string FormatIntWidthN(int value, int width); | static std::string FormatIntWidthN(int value, int width); | |||
// Formats an int value as "%X". | // Formats an int value as "%X". | |||
static std::string FormatHexInt(int value); | static std::string FormatHexInt(int value); | |||
// Formats an int value as "%X". | // Formats an int value as "%X". | |||
static std::string FormatHexUInt32(uint32_t value); | static std::string FormatHexUInt32(uint32_t value); | |||
// Formats a byte as "%02X". | // Formats a byte as "%02X". | |||
static std::string FormatByte(unsigned char value); | static std::string FormatByte(unsigned char value); | |||
private: | private: | |||
String(); // Not meant to be instantiated. | String(); // Not meant to be instantiated. | |||
}; // class String | }; // class String | |||
// Gets the content of the stringstream's buffer as an std::string. Each '\0' | // Gets the content of the stringstream's buffer as an std::string. Each '\0' | |||
// character in the buffer is replaced with "\\0". | // character in the buffer is replaced with "\\0". | |||
GTEST_API_ std::string StringStreamToString(::std::stringstream* stream); | GTEST_API_ std::string StringStreamToString(::std::stringstream* stream); | |||
} // namespace internal | } // namespace internal | |||
} // namespace testing | } // namespace testing | |||
#endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_ | |||
End of changes. 7 change blocks. | ||||
8 lines changed or deleted | 10 lines changed or added |