| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef LIBRARIES_NACL_IO_PATH_H_ | 5 #ifndef LIBRARIES_NACL_IO_PATH_H_ |
| 6 #define LIBRARIES_NACL_IO_PATH_H_ | 6 #define LIBRARIES_NACL_IO_PATH_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 Path Parent() const; | 46 Path Parent() const; |
| 47 std::string Basename() const; | 47 std::string Basename() const; |
| 48 | 48 |
| 49 std::string Join() const; | 49 std::string Join() const; |
| 50 std::string Range(size_t start, size_t end) const; | 50 std::string Range(size_t start, size_t end) const; |
| 51 StringArray_t Split() const; | 51 StringArray_t Split() const; |
| 52 | 52 |
| 53 // Collapse the string list removing extraneous '.', '..' path components | 53 // Collapse the string list removing extraneous '.', '..' path components |
| 54 static StringArray_t Normalize(const StringArray_t& paths); | 54 static StringArray_t Normalize(const StringArray_t& paths); |
| 55 static std::string Join(const StringArray_t& paths); | 55 static std::string Join(const StringArray_t& paths); |
| 56 static std::string Range(const StringArray_t& paths, size_t start, | 56 static std::string Range(const StringArray_t& paths, |
| 57 size_t start, |
| 57 size_t end); | 58 size_t end); |
| 58 static StringArray_t Split(const std::string& paths); | 59 static StringArray_t Split(const std::string& paths); |
| 59 // Operator versions | 60 // Operator versions |
| 60 Path& operator=(const Path& p); | 61 Path& operator=(const Path& p); |
| 61 Path& operator=(const std::string& str); | 62 Path& operator=(const std::string& str); |
| 62 bool operator==(const Path& other) { return Split() == other.Split(); } | 63 bool operator==(const Path& other) { return Split() == other.Split(); } |
| 63 bool operator!=(const Path& other) { return !operator==(other); } | 64 bool operator!=(const Path& other) { return !operator==(other); } |
| 64 | 65 |
| 65 private: | 66 private: |
| 66 // Internal representation of the path stored an array of string representing | 67 // Internal representation of the path stored an array of string representing |
| 67 // the directory traversal. The first string is a "/" if this is an absolute | 68 // the directory traversal. The first string is a "/" if this is an absolute |
| 68 // path. | 69 // path. |
| 69 StringArray_t paths_; | 70 StringArray_t paths_; |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 } // namespace nacl_io | 73 } // namespace nacl_io |
| 73 | 74 |
| 74 #endif // PACKAGES_LIBRARIES_NACL_IO_PATH_H_ | 75 #endif // PACKAGES_LIBRARIES_NACL_IO_PATH_H_ |
| OLD | NEW |