MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / split

Function split

dds/DCPS/ConfigStoreImpl.cpp:24–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23OPENDDS_VECTOR(String)
24split(const String& str,
25 const String& delims,
26 bool skip_leading,
27 bool skip_consecutive)
28{
29 OPENDDS_VECTOR(String) retval;
30
31 std::string::size_type pos = 0;
32 if (skip_leading) {
33 pos = str.find_first_not_of(delims);
34 }
35
36 while (pos != std::string::npos && pos < str.size()) {
37 const std::string::size_type limit = str.find_first_of(delims, pos);
38 if (limit == std::string::npos) {
39 retval.push_back(str.substr(pos));
40 break;
41 } else {
42 retval.push_back(str.substr(pos, limit - pos));
43 if (limit == str.size() - 1) {
44 // Delimeter at the end.
45 retval.push_back(String());
46 }
47 pos = limit + 1;
48 if (skip_consecutive && pos != std::string::npos && pos < str.size()) {
49 pos = str.find_first_not_of(delims, pos);
50 }
51 }
52 }
53
54 return retval;
55}
56
57String ConfigPair::canonicalize(const String& key)
58{

Callers 7

getMethod · 0.85
fragmentMethod · 0.85
fragmentMethod · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85

Calls 2

StringClass · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected