MCPcopy Create free account
hub / github.com/apache/mesos / foreach

Function foreach

src/common/roles.cpp:114–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112 static const string* dotdot = new string("..");
113
114 foreach (const string& component, components) {
115 CHECK(!component.empty()); // `tokenize` does not return empty tokens.
116
117 if (component == *dot) {
118 return Error("Role '" + role + "' cannot include '.' as a component");
119 }
120
121 if (component == *dotdot) {
122 return Error("Role '" + role + "' cannot include '..' as a component");
123 }
124
125 if (component == *star) {
126 return Error("Role '" + role + "' cannot include '*' as a component");
127 }
128
129 if (strings::startsWith(component, '-')) {
130 return Error("Role component '" + component + "' is invalid "
131 "because it starts with a dash");
132 }
133
134 if (component.find_first_of(*INVALID_CHARACTERS) != string::npos) {
135 return Error("Role component '" + component + "' is invalid "
136 "because it contains backspace or whitespace");
137 }
138 }
139
140 return None();
141}

Callers

nothing calls this directly

Calls 6

startsWithFunction · 0.85
validateFunction · 0.70
ErrorFunction · 0.50
emptyMethod · 0.45
isSomeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected