| 112 | |
| 113 | |
| 114 | int DynamicColorManager::findColor(const std::string& name) const { |
| 115 | if (name.empty()) { |
| 116 | return -1; |
| 117 | } |
| 118 | else if ((name[0] >= '0') && (name[0] <= '9')) { |
| 119 | int index = atoi(name.c_str()); |
| 120 | if ((index < 0) || (index >= (int)colors.size())) { |
| 121 | return -1; |
| 122 | } |
| 123 | else { |
| 124 | return index; |
| 125 | } |
| 126 | } |
| 127 | else { |
| 128 | for (int i = 0; i < (int)colors.size(); i++) { |
| 129 | if (colors[i]->getName() == name) { |
| 130 | return i; |
| 131 | } |
| 132 | } |
| 133 | return -1; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | |
| 138 | const DynamicColor* DynamicColorManager::getColor(int id) const { |
no test coverage detected