MCPcopy Create free account
hub / github.com/apache/impala / SplitStringAndParseToInserter

Function SplitStringAndParseToInserter

be/src/gutil/strings/split.h:1143–1164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1141
1142template <class Container, class InsertPolicy>
1143bool SplitStringAndParseToInserter(
1144 StringPiece source, StringPiece delim,
1145 bool (*parse)(const string& str, typename Container::value_type* value),
1146 Container* result, InsertPolicy insert_policy) {
1147 CHECK(NULL != parse);
1148 CHECK(NULL != result);
1149 CHECK(NULL != delim.data());
1150 CHECK_GT(delim.size(), 0);
1151 bool retval = true;
1152 vector<StringPiece> pieces = strings::Split(source,
1153 strings::delimiter::AnyOf(delim),
1154 strings::SkipEmpty());
1155 for (const auto& piece : pieces) {
1156 typename Container::value_type t;
1157 if (parse(piece.as_string(), &t)) {
1158 insert_policy(result, t);
1159 } else {
1160 retval = false;
1161 }
1162 }
1163 return retval;
1164}
1165
1166// Cannot use output iterator here (e.g. std::inserter, std::back_inserter)
1167// because some callers use non-standard containers that don't have iterators,

Callers 2

Calls 6

SplitFunction · 0.85
AnyOfClass · 0.85
SkipEmptyClass · 0.85
as_stringMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected