OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 if (i < path.size() && path[i] == '\"') { | 106 if (i < path.size() && path[i] == '\"') { |
107 is_quoted = true; | 107 is_quoted = true; |
108 } | 108 } |
109 } | 109 } |
110 return result; | 110 return result; |
111 } | 111 } |
112 | 112 |
113 util::Status DecodeCompactFieldMaskPaths(StringPiece paths, | 113 util::Status DecodeCompactFieldMaskPaths(StringPiece paths, |
114 PathSinkCallback path_sink) { | 114 PathSinkCallback path_sink) { |
115 std::stack<string> prefix; | 115 stack<string> prefix; |
116 int length = paths.length(); | 116 int length = paths.length(); |
117 int previous_position = 0; | 117 int previous_position = 0; |
118 bool in_map_key = false; | 118 bool in_map_key = false; |
119 bool is_escaping = false; | 119 bool is_escaping = false; |
120 // Loops until 1 passed the end of the input to make the handle of the last | 120 // Loops until 1 passed the end of the input to make the handle of the last |
121 // segment easier. | 121 // segment easier. |
122 for (int i = 0; i <= length; ++i) { | 122 for (int i = 0; i <= length; ++i) { |
123 if (i != length) { | 123 if (i != length) { |
124 // Skips everything in a map key until we hit the end of it, which is | 124 // Skips everything in a map key until we hit the end of it, which is |
125 // marked by an un-escaped '"' immediately followed by a ']'. | 125 // marked by an un-escaped '"' immediately followed by a ']'. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 StrCat("Invalid FieldMask '", paths, | 216 StrCat("Invalid FieldMask '", paths, |
217 "'. Cannot find matching ')' for all '('.")); | 217 "'. Cannot find matching ')' for all '('.")); |
218 } | 218 } |
219 return util::Status::OK; | 219 return util::Status::OK; |
220 } | 220 } |
221 | 221 |
222 } // namespace converter | 222 } // namespace converter |
223 } // namespace util | 223 } // namespace util |
224 } // namespace protobuf | 224 } // namespace protobuf |
225 } // namespace google | 225 } // namespace google |
OLD | NEW |