MCPcopy Create free account
hub / github.com/SmingHub/Sming / Iterator

Class Iterator

Sming/Core/Data/CStringArray.h:269–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267 * @{
268 */
269 class Iterator
270 {
271 public:
272 Iterator() = default;
273 Iterator(const Iterator&) = default;
274
275 Iterator(const CStringArray* array, uint16_t offset, uint16_t index)
276 : mArray(array), mOffset(offset), mIndex(index)
277 {
278 }
279
280 operator bool() const
281 {
282 return mArray != nullptr && mOffset < mArray->length();
283 }
284
285 bool equals(const char* rhs) const
286 {
287 auto s = str();
288 return s == rhs || strcmp(s, rhs) == 0;
289 }
290
291 bool equalsIgnoreCase(const char* rhs) const
292 {
293 auto s = str();
294 return s == rhs || strcasecmp(str(), rhs) == 0;
295 }
296
297 bool operator==(const Iterator& rhs) const
298 {
299 return mArray == rhs.mArray && mOffset == rhs.mOffset;
300 }
301
302 bool operator!=(const Iterator& rhs) const
303 {
304 return !operator==(rhs);
305 }
306
307 bool operator==(const char* rhs) const
308 {
309 return equals(rhs);
310 }
311
312 bool operator!=(const char* rhs) const
313 {
314 return !equals(rhs);
315 }
316
317 bool equals(const String& rhs) const
318 {
319 return rhs.equals(str());
320 }
321
322 bool equalsIgnoreCase(const String& rhs) const
323 {
324 return rhs.equalsIgnoreCase(str());
325 }
326

Callers 2

beginMethod · 0.70
endMethod · 0.70

Calls 1

lengthMethod · 0.45

Tested by

no test coverage detected