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

Side by Side Diff: base/files/file_path.cc

Issue 2627713002: Move constructor for base::FilePath (Closed)
Patch Set: Added comment Created 3 years, 11 months 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
« no previous file with comments | « base/files/file_path.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return false; 167 return false;
168 } 168 }
169 169
170 } // namespace 170 } // namespace
171 171
172 FilePath::FilePath() { 172 FilePath::FilePath() {
173 } 173 }
174 174
175 FilePath::FilePath(const FilePath& that) : path_(that.path_) { 175 FilePath::FilePath(const FilePath& that) : path_(that.path_) {
176 } 176 }
177 FilePath::FilePath(FilePath&& that) = default;
177 178
178 FilePath::FilePath(StringPieceType path) { 179 FilePath::FilePath(StringPieceType path) {
179 path.CopyToString(&path_); 180 path.CopyToString(&path_);
180 StringType::size_type nul_pos = path_.find(kStringTerminator); 181 StringType::size_type nul_pos = path_.find(kStringTerminator);
181 if (nul_pos != StringType::npos) 182 if (nul_pos != StringType::npos)
182 path_.erase(nul_pos, StringType::npos); 183 path_.erase(nul_pos, StringType::npos);
183 } 184 }
184 185
185 FilePath::~FilePath() { 186 FilePath::~FilePath() {
186 } 187 }
187 188
188 FilePath& FilePath::operator=(const FilePath& that) { 189 FilePath& FilePath::operator=(const FilePath& that) {
189 path_ = that.path_; 190 path_ = that.path_;
190 return *this; 191 return *this;
191 } 192 }
192 193
194 FilePath& FilePath::operator=(FilePath&& that) = default;
195
193 bool FilePath::operator==(const FilePath& that) const { 196 bool FilePath::operator==(const FilePath& that) const {
194 #if defined(FILE_PATH_USES_DRIVE_LETTERS) 197 #if defined(FILE_PATH_USES_DRIVE_LETTERS)
195 return EqualDriveLetterCaseInsensitive(this->path_, that.path_); 198 return EqualDriveLetterCaseInsensitive(this->path_, that.path_);
196 #else // defined(FILE_PATH_USES_DRIVE_LETTERS) 199 #else // defined(FILE_PATH_USES_DRIVE_LETTERS)
197 return path_ == that.path_; 200 return path_ == that.path_;
198 #endif // defined(FILE_PATH_USES_DRIVE_LETTERS) 201 #endif // defined(FILE_PATH_USES_DRIVE_LETTERS)
199 } 202 }
200 203
201 bool FilePath::operator!=(const FilePath& that) const { 204 bool FilePath::operator!=(const FilePath& that) const {
202 #if defined(FILE_PATH_USES_DRIVE_LETTERS) 205 #if defined(FILE_PATH_USES_DRIVE_LETTERS)
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 #endif 1336 #endif
1334 } 1337 }
1335 1338
1336 #if defined(OS_ANDROID) 1339 #if defined(OS_ANDROID)
1337 bool FilePath::IsContentUri() const { 1340 bool FilePath::IsContentUri() const {
1338 return StartsWith(path_, "content://", base::CompareCase::INSENSITIVE_ASCII); 1341 return StartsWith(path_, "content://", base::CompareCase::INSENSITIVE_ASCII);
1339 } 1342 }
1340 #endif 1343 #endif
1341 1344
1342 } // namespace base 1345 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698