OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 Pathname(); | 46 Pathname(); |
47 Pathname(const Pathname&); | 47 Pathname(const Pathname&); |
48 Pathname(Pathname&&); | 48 Pathname(Pathname&&); |
49 Pathname(const std::string& pathname); | 49 Pathname(const std::string& pathname); |
50 Pathname(const std::string& folder, const std::string& filename); | 50 Pathname(const std::string& folder, const std::string& filename); |
51 | 51 |
52 Pathname& operator=(const Pathname&); | 52 Pathname& operator=(const Pathname&); |
53 Pathname& operator=(Pathname&&); | 53 Pathname& operator=(Pathname&&); |
54 | 54 |
55 // Set's the default folder delimiter for this Pathname | |
56 char folder_delimiter() const { return folder_delimiter_; } | |
57 void SetFolderDelimiter(char delimiter); | |
58 | |
59 // Normalize changes all folder delimiters to folder_delimiter() | 55 // Normalize changes all folder delimiters to folder_delimiter() |
60 void Normalize(); | 56 void Normalize(); |
61 | 57 |
62 // Reset to the empty pathname | 58 // Reset to the empty pathname |
63 void clear(); | 59 void clear(); |
64 | 60 |
65 // Returns true if the pathname is empty. Note: this->pathname().empty() | 61 // Returns true if the pathname is empty. Note: this->pathname().empty() |
66 // is always false. | 62 // is always false. |
67 bool empty() const; | 63 bool empty() const; |
68 | 64 |
69 // Returns the folder and filename components. If the pathname is empty, | 65 // Returns the folder and filename components. If the pathname is empty, |
70 // returns a string representing the current directory (as a relative path, | 66 // returns a string representing the current directory (as a relative path, |
71 // i.e., "."). | 67 // i.e., "."). |
72 std::string pathname() const; | 68 std::string pathname() const; |
73 void SetPathname(const std::string& pathname); | 69 void SetPathname(const std::string& pathname); |
74 void SetPathname(const std::string& folder, const std::string& filename); | 70 void SetPathname(const std::string& folder, const std::string& filename); |
75 | 71 |
76 // Append pathname to the current folder (if any). Any existing filename | |
77 // will be discarded. | |
78 void AppendPathname(const std::string& pathname); | |
79 | |
80 std::string folder() const; | 72 std::string folder() const; |
81 std::string folder_name() const; | |
82 std::string parent_folder() const; | 73 std::string parent_folder() const; |
83 // SetFolder and AppendFolder will append a folder delimiter, if needed. | 74 // SetFolder and AppendFolder will append a folder delimiter, if needed. |
84 void SetFolder(const std::string& folder); | 75 void SetFolder(const std::string& folder); |
85 void AppendFolder(const std::string& folder); | 76 void AppendFolder(const std::string& folder); |
86 | 77 |
87 std::string basename() const; | |
88 bool SetBasename(const std::string& basename); | 78 bool SetBasename(const std::string& basename); |
89 | 79 |
90 std::string extension() const; | |
91 // SetExtension will prefix a period, if needed. | 80 // SetExtension will prefix a period, if needed. |
92 bool SetExtension(const std::string& extension); | 81 bool SetExtension(const std::string& extension); |
93 | 82 |
94 std::string filename() const; | 83 std::string filename() const; |
95 bool SetFilename(const std::string& filename); | 84 bool SetFilename(const std::string& filename); |
96 | 85 |
97 #if defined(WEBRTC_WIN) | |
98 bool GetDrive(char* drive, uint32_t bytes) const; | |
99 static bool GetDrive(char* drive, | |
100 uint32_t bytes, | |
101 const std::string& pathname); | |
102 #endif | |
103 | |
104 private: | 86 private: |
105 std::string folder_, basename_, extension_; | 87 std::string folder_, basename_, extension_; |
106 char folder_delimiter_; | 88 char folder_delimiter_; |
107 }; | 89 }; |
108 | 90 |
109 } // namespace rtc | 91 } // namespace rtc |
110 | 92 |
111 #endif // WEBRTC_BASE_PATHUTILS_H__ | 93 #endif // WEBRTC_BASE_PATHUTILS_H__ |
OLD | NEW |