Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: base/file_path.h

Issue 16239: Add a method to explicitly request a UTF8 representation of a FilePath. This... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_path.cc » ('j') | base/file_path.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 // FilePath is a container for pathnames stored in a platform's native string 5 // FilePath is a container for pathnames stored in a platform's native string
6 // type, providing containers for manipulation in according with the 6 // type, providing containers for manipulation in according with the
7 // platform's conventions for pathnames. It supports the following path 7 // platform's conventions for pathnames. It supports the following path
8 // types: 8 // types:
9 // 9 //
10 // POSIX Windows 10 // POSIX Windows
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return path_ == that.path_; 125 return path_ == that.path_;
126 } 126 }
127 127
128 // Required for some STL containers and operations 128 // Required for some STL containers and operations
129 bool operator<(const FilePath& that) const { 129 bool operator<(const FilePath& that) const {
130 return path_ < that.path_; 130 return path_ < that.path_;
131 } 131 }
132 132
133 const StringType& value() const { return path_; } 133 const StringType& value() const { return path_; }
134 134
135 // Returns value() encoded as a UTF8 std::string. Be careful to not use this
136 // in places that use filesystem APIs as it won't be portable.
137 const std::string UTF8Value() const;
138
135 // Returns true if |character| is in kSeparators. 139 // Returns true if |character| is in kSeparators.
136 static bool IsSeparator(CharType character); 140 static bool IsSeparator(CharType character);
137 141
138 // Returns a FilePath corresponding to the directory containing the path 142 // Returns a FilePath corresponding to the directory containing the path
139 // named by this object, stripping away the file component. If this object 143 // named by this object, stripping away the file component. If this object
140 // only contains one component, returns a FilePath identifying 144 // only contains one component, returns a FilePath identifying
141 // kCurrentDirectory. If this object already refers to the root directory, 145 // kCurrentDirectory. If this object already refers to the root directory,
142 // returns a FilePath identifying the root directory. 146 // returns a FilePath identifying the root directory.
143 FilePath DirName() const; 147 FilePath DirName() const;
144 148
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 struct hash<FilePath> { 216 struct hash<FilePath> {
213 size_t operator()(const FilePath& f) const { 217 size_t operator()(const FilePath& f) const {
214 return std::tr1::hash<FilePath::StringType>()(f.value()); 218 return std::tr1::hash<FilePath::StringType>()(f.value());
215 } 219 }
216 }; 220 };
217 221
218 } // namespace __gnu_cxx 222 } // namespace __gnu_cxx
219 #endif // defined(COMPILER_GCC) 223 #endif // defined(COMPILER_GCC)
220 224
221 #endif // BASE_FILE_PATH_H_ 225 #endif // BASE_FILE_PATH_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_path.cc » ('j') | base/file_path.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698