Go to the documentation of this file.
37 #include <google/protobuf/port_def.inc>
48 StringPiece segment) {
52 if (segment.empty()) {
67 result.reserve(
path.size() << 1);
69 bool is_quoted =
false;
70 bool is_escaping =
false;
71 int current_segment_start = 0;
75 for (
size_t i = 0;
i <=
path.size(); ++
i) {
78 if (
i ==
path.size()) {
81 result.push_back(
path[
i]);
84 }
else if (
path[
i] ==
'\\') {
86 }
else if (
path[
i] ==
'\"') {
87 current_segment_start =
i + 1;
95 path.substr(current_segment_start,
i - current_segment_start));
96 if (
i <
path.size()) {
97 result.push_back(
path[
i]);
99 current_segment_start =
i + 1;
110 std::stack<std::string>
prefix;
112 int previous_position = 0;
113 bool in_map_key =
false;
114 bool is_escaping =
false;
126 if (paths[
i] ==
'\\') {
130 if (paths[
i] !=
'\"') {
134 if (
i >=
length - 1 || paths[
i + 1] !=
']') {
138 "Invalid FieldMask '", paths,
139 "'. Map keys should be represented as [\"some_key\"]."));
146 if (
i <
length - 1 && paths[
i + 1] !=
'.' && paths[
i + 1] !=
',' &&
147 paths[
i + 1] !=
')' && paths[
i + 1] !=
'(') {
151 "Invalid FieldMask '", paths,
152 "'. Map keys should be at the end of a path segment."));
159 if (paths[
i] ==
'[') {
160 if (
i >=
length - 1 || paths[
i + 1] !=
'\"') {
164 "Invalid FieldMask '", paths,
165 "'. Map keys should be represented as [\"some_key\"]."));
174 if (paths[
i] !=
',' && paths[
i] !=
')' && paths[
i] !=
'(') {
181 paths.
substr(previous_position,
i - previous_position);
184 if (
i <
length && paths[
i] ==
'(') {
186 prefix.push(AppendPathSegmentToPrefix(current_prefix, segment));
187 }
else if (!segment.
empty()) {
192 path_sink(AppendPathSegmentToPrefix(current_prefix, segment)));
196 if (
i <
length && paths[
i] ==
')') {
200 StrCat(
"Invalid FieldMask '", paths,
201 "'. Cannot find matching '(' for all ')'."));
205 previous_position =
i + 1;
210 StrCat(
"Invalid FieldMask '", paths,
211 "'. Cannot find matching ']' for all '['."));
216 StrCat(
"Invalid FieldMask '", paths,
217 "'. Cannot find matching ')' for all '('."));
stringpiece_ssize_type length() const
util::Status DecodeCompactFieldMaskPaths(StringPiece paths, PathSinkCallback path_sink)
string StrCat(const AlphaNum &a, const AlphaNum &b)
GLenum GLuint GLenum GLsizei length
GLsizei const GLchar *const * string
StringPiece substr(size_type pos, size_type n=npos) const
std::function< std::string(StringPiece)> ConverterCallback
GLsizei const GLchar ** path
static const char prefix[]
bool HasPrefixString(const string &str, const string &prefix)
Status
Status of any operation that the TOF sdk performs.
std::string ConvertFieldMaskPath(const StringPiece path, ConverterCallback converter)
std::function< util::Status(StringPiece)> PathSinkCallback
#define RETURN_IF_ERROR(expr)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:51