int getColorIndex(const char* str) { int result = -1; int i; for (i = 0; result < 0 && i < colorNameCount; ++i) { const char* name = colorNames[i]; if (matchIgnoreCase(str, name, strlen(str))) result = i; } return result; }
bool RegularExpression::matchChar(Context* const context, const XMLInt32 ch, int& offset, const short direction, const bool ignoreCase) { int tmpOffset = direction > 0 ? offset : offset - 1; if (tmpOffset >= context->fLimit || tmpOffset < 0) return false; XMLInt32 strCh = 0; if (!context->nextCh(strCh, tmpOffset, direction)) return false; bool match = ignoreCase ? matchIgnoreCase(ch, strCh) : (ch == strCh); if (!match) return false; offset = (direction > 0) ? ++tmpOffset : tmpOffset; return true; }