OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ |
6 #define CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ | 6 #define CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iterator> | 9 #include <iterator> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "chrome/browser/sync/util/compat-file.h" | 12 #include "chrome/browser/sync/util/compat_file.h" |
13 #include "chrome/browser/sync/util/sync_types.h" | 13 #include "chrome/browser/sync/util/sync_types.h" |
14 | 14 |
15 template <typename StringType> | 15 template <typename StringType> |
16 class PathSegmentIterator : public std::iterator<std::forward_iterator_tag, | 16 class PathSegmentIterator : public std::iterator<std::forward_iterator_tag, |
17 StringType> { | 17 StringType> { |
18 public: | 18 public: |
19 explicit PathSegmentIterator(const StringType& path) : | 19 explicit PathSegmentIterator(const StringType& path) : |
20 path_(path), segment_begin_(0), segment_end_(0) { | 20 path_(path), segment_begin_(0), segment_end_(0) { |
21 ++(*this); | 21 ++(*this); |
22 } | 22 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Makes a path component legal for your OS, but doesn't handle collisions | 96 // Makes a path component legal for your OS, but doesn't handle collisions |
97 // with other files in the same directory. it can do this by removing | 97 // with other files in the same directory. it can do this by removing |
98 // illegal characters and adding ~1 before the first '.' in the filename. | 98 // illegal characters and adding ~1 before the first '.' in the filename. |
99 // returns PSTR("") if the name is fine as-is | 99 // returns PSTR("") if the name is fine as-is |
100 // on mac/linux we let names stay unicode normalization form C in the system | 100 // on mac/linux we let names stay unicode normalization form C in the system |
101 // and convert to another normal form in fuse handlers. but, if a '/' is in | 101 // and convert to another normal form in fuse handlers. but, if a '/' is in |
102 // a filename, we handle it here. | 102 // a filename, we handle it here. |
103 PathString MakePathComponentOSLegal(const PathString& component); | 103 PathString MakePathComponentOSLegal(const PathString& component); |
104 | 104 |
105 #endif // CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ | 105 #endif // CHROME_BROWSER_SYNC_UTIL_PATH_HELPERS_H_ |
OLD | NEW |