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

Side by Side Diff: base/utf_offset_string_conversions.h

Issue 6877053: Base: More adjustments to BASE_API and project dependencies to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « base/tracked_objects.h ('k') | base/utf_string_conversion_utils.h » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 BASE_UTF_OFFSET_STRING_CONVERSIONS_H_ 5 #ifndef BASE_UTF_OFFSET_STRING_CONVERSIONS_H_
6 #define BASE_UTF_OFFSET_STRING_CONVERSIONS_H_ 6 #define BASE_UTF_OFFSET_STRING_CONVERSIONS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 size_t limit_; 69 size_t limit_;
70 }; 70 };
71 71
72 // Adjustment function called by std::transform which will adjust any offset 72 // Adjustment function called by std::transform which will adjust any offset
73 // that occurs after one or more modified substrings. To use, create any 73 // that occurs after one or more modified substrings. To use, create any
74 // number of AdjustOffset::Adjustments, drop them into a vector, then call 74 // number of AdjustOffset::Adjustments, drop them into a vector, then call
75 // std::transform with the transform function being something similar to 75 // std::transform with the transform function being something similar to
76 // AdjustOffset(adjustments). Each Adjustment gives the original |location| 76 // AdjustOffset(adjustments). Each Adjustment gives the original |location|
77 // of the encoded section and the |old_length| and |new_length| of the section 77 // of the encoded section and the |old_length| and |new_length| of the section
78 // before and after decoding. 78 // before and after decoding.
79 struct AdjustOffset { 79 struct BASE_API AdjustOffset {
80 // Helper structure which indicates where an encoded character occurred 80 // Helper structure which indicates where an encoded character occurred
81 // and how long that encoding was. 81 // and how long that encoding was.
82 struct Adjustment { 82 struct BASE_API Adjustment {
83 Adjustment(size_t location, size_t old_length, size_t new_length); 83 Adjustment(size_t location, size_t old_length, size_t new_length);
84 84
85 size_t location; 85 size_t location;
86 size_t old_length; 86 size_t old_length;
87 size_t new_length; 87 size_t new_length;
88 }; 88 };
89 89
90 typedef std::vector<Adjustment> Adjustments; 90 typedef std::vector<Adjustment> Adjustments;
91 91
92 explicit AdjustOffset(const Adjustments& adjustments); 92 explicit AdjustOffset(const Adjustments& adjustments);
93 void operator()(size_t& offset); 93 void operator()(size_t& offset);
94 94
95 const Adjustments& adjustments_; 95 const Adjustments& adjustments_;
96 }; 96 };
97 97
98 #endif // BASE_UTF_OFFSET_STRING_CONVERSIONS_H_ 98 #endif // BASE_UTF_OFFSET_STRING_CONVERSIONS_H_
OLDNEW
« no previous file with comments | « base/tracked_objects.h ('k') | base/utf_string_conversion_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698