For each character in characters_wanted, sets the index corresponding to the ASCII code of that character to 1 in table. This is used by the m_find.*_of methods below to tell whether or not a character is in the lookup table in constant time. The argument `table' must be an array that is large enough to hold all the possible values of an unsigned char. Thus it should be be declared as follows: b
| 154 | // as follows: |
| 155 | // bool table[UCHAR_MAX + 1] |
| 156 | static inline void BuildLookupTable(const StringPiece& characters_wanted, |
| 157 | bool* table) { |
| 158 | const size_type length = characters_wanted.length(); |
| 159 | const char* const data = characters_wanted.data(); |
| 160 | for (size_type i = 0; i < length; ++i) { |
| 161 | table[static_cast<unsigned char>(data[i])] = true; |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | size_type StringPiece::find_first_of(const StringPiece& s, |
| 166 | size_type pos) const { |
no test coverage detected