| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SK_COMMAND_LINE_FLAGS_H | 8 #ifndef SK_COMMAND_LINE_FLAGS_H |
| 9 #define SK_COMMAND_LINE_FLAGS_H | 9 #define SK_COMMAND_LINE_FLAGS_H |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 SkASSERT(i >= 0 && i < fStrings.count()); | 118 SkASSERT(i >= 0 && i < fStrings.count()); |
| 119 return fStrings[i].c_str(); | 119 return fStrings[i].c_str(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 int count() const { | 122 int count() const { |
| 123 return fStrings.count(); | 123 return fStrings.count(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool isEmpty() const { return this->count() == 0; } | 126 bool isEmpty() const { return this->count() == 0; } |
| 127 | 127 |
| 128 /** |
| 129 * Returns true iff string is equal to one of the strings in this array. |
| 130 */ |
| 131 bool contains(const char* string) const { |
| 132 for (int i = 0; i < fStrings.count(); i++) { |
| 133 if (fStrings[i].equals(string)) { |
| 134 return true; |
| 135 } |
| 136 } |
| 137 return false; |
| 138 } |
| 139 |
| 128 private: | 140 private: |
| 129 void reset() { fStrings.reset(); } | 141 void reset() { fStrings.reset(); } |
| 130 | 142 |
| 131 void append(const char* string) { | 143 void append(const char* string) { |
| 132 fStrings.push_back().set(string); | 144 fStrings.push_back().set(string); |
| 133 } | 145 } |
| 134 | 146 |
| 135 void append(const char* string, size_t length) { | 147 void append(const char* string, size_t length) { |
| 136 fStrings.push_back().set(string, length); | 148 fStrings.push_back().set(string, length); |
| 137 } | 149 } |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 double* fDoubleValue; | 437 double* fDoubleValue; |
| 426 double fDefaultDouble; | 438 double fDefaultDouble; |
| 427 SkCommandLineFlags::StringArray* fStrings; | 439 SkCommandLineFlags::StringArray* fStrings; |
| 428 // Both for the help string and in case fStrings is empty. | 440 // Both for the help string and in case fStrings is empty. |
| 429 SkString fDefaultString; | 441 SkString fDefaultString; |
| 430 | 442 |
| 431 // In order to keep a linked list. | 443 // In order to keep a linked list. |
| 432 SkFlagInfo* fNext; | 444 SkFlagInfo* fNext; |
| 433 }; | 445 }; |
| 434 #endif // SK_COMMAND_LINE_FLAGS_H | 446 #endif // SK_COMMAND_LINE_FLAGS_H |
| OLD | NEW |