gtest-filepath.h (googletest-release-1.11.0) | : | gtest-filepath.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. | |||
// | ||||
// Google Test filepath utilities | // Google Test filepath utilities | |||
// | // | |||
// This header file declares classes and functions used internally by | // This header file declares classes and functions used internally by | |||
// Google Test. They are subject to change without notice. | // Google Test. They are subject to change without notice. | |||
// | // | |||
// This file is #included in gtest/internal/gtest-internal.h. | // This file is #included in gtest/internal/gtest-internal.h. | |||
// Do not include this header file separately! | // Do not include this header file separately! | |||
// 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_FILEPATH_H_ | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ | |||
#define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_ | |||
#include "gtest/internal/gtest-string.h" | #include "gtest/internal/gtest-string.h" | |||
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ | GTEST_DISABLE_MSC_WARNINGS_PUSH_(4251 \ | |||
/* class A needs to have dll-interface to be used by clients of class B */) | /* class A needs to have dll-interface to be used by clients of class B */) | |||
namespace testing { | namespace testing { | |||
skipping to change at line 64 | skipping to change at line 66 | |||
// Except for Set methods, all methods are const or static, which provides an | // Except for Set methods, all methods are const or static, which provides an | |||
// "immutable value object" -- useful for peace of mind. | // "immutable value object" -- useful for peace of mind. | |||
// A FilePath with a value ending in a path separator ("like/this/") represents | // A FilePath with a value ending in a path separator ("like/this/") represents | |||
// a directory, otherwise it is assumed to represent a file. In either case, | // a directory, otherwise it is assumed to represent a file. In either case, | |||
// it may or may not represent an actual file or directory in the file system. | // it may or may not represent an actual file or directory in the file system. | |||
// Names are NOT checked for syntax correctness -- no checking for illegal | // Names are NOT checked for syntax correctness -- no checking for illegal | |||
// characters, malformed paths, etc. | // characters, malformed paths, etc. | |||
class GTEST_API_ FilePath { | class GTEST_API_ FilePath { | |||
public: | public: | |||
FilePath() : pathname_("") { } | FilePath() : pathname_("") {} | |||
FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { } | FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) {} | |||
explicit FilePath(const std::string& pathname) : pathname_(pathname) { | explicit FilePath(const std::string& pathname) : pathname_(pathname) { | |||
Normalize(); | Normalize(); | |||
} | } | |||
FilePath& operator=(const FilePath& rhs) { | FilePath& operator=(const FilePath& rhs) { | |||
Set(rhs); | Set(rhs); | |||
return *this; | return *this; | |||
} | } | |||
void Set(const FilePath& rhs) { | void Set(const FilePath& rhs) { pathname_ = rhs.pathname_; } | |||
pathname_ = rhs.pathname_; | ||||
} | ||||
const std::string& string() const { return pathname_; } | const std::string& string() const { return pathname_; } | |||
const char* c_str() const { return pathname_.c_str(); } | const char* c_str() const { return pathname_.c_str(); } | |||
// Returns the current working directory, or "" if unsuccessful. | // Returns the current working directory, or "" if unsuccessful. | |||
static FilePath GetCurrentDir(); | static FilePath GetCurrentDir(); | |||
// Given directory = "dir", base_name = "test", number = 0, | // Given directory = "dir", base_name = "test", number = 0, | |||
// extension = "xml", returns "dir/test.xml". If number is greater | // extension = "xml", returns "dir/test.xml". If number is greater | |||
// than zero (e.g., 12), returns "dir/test_12.xml". | // than zero (e.g., 12), returns "dir/test_12.xml". | |||
// On Windows platform, uses \ as the separator rather than /. | // On Windows platform, uses \ as the separator rather than /. | |||
static FilePath MakeFileName(const FilePath& directory, | static FilePath MakeFileName(const FilePath& directory, | |||
const FilePath& base_name, | const FilePath& base_name, int number, | |||
int number, | ||||
const char* extension); | const char* extension); | |||
// Given directory = "dir", relative_path = "test.xml", | // Given directory = "dir", relative_path = "test.xml", | |||
// returns "dir/test.xml". | // returns "dir/test.xml". | |||
// On Windows, uses \ as the separator rather than /. | // On Windows, uses \ as the separator rather than /. | |||
static FilePath ConcatPaths(const FilePath& directory, | static FilePath ConcatPaths(const FilePath& directory, | |||
const FilePath& relative_path); | const FilePath& relative_path); | |||
// Returns a pathname for a file that does not currently exist. The pathname | // Returns a pathname for a file that does not currently exist. The pathname | |||
// will be directory/base_name.extension or | // will be directory/base_name.extension or | |||
End of changes. 5 change blocks. | ||||
9 lines changed or deleted | 8 lines changed or added |