| 174 | |
| 175 | |
| 176 | JSON::ElementType JSON::getType() const |
| 177 | { |
| 178 | switch (*ptr_begin) |
| 179 | { |
| 180 | case '{': |
| 181 | return TYPE_OBJECT; |
| 182 | case '[': |
| 183 | return TYPE_ARRAY; |
| 184 | case 't': |
| 185 | case 'f': |
| 186 | return TYPE_BOOL; |
| 187 | case 'n': |
| 188 | return TYPE_NULL; |
| 189 | case '-': |
| 190 | case '0': |
| 191 | case '1': |
| 192 | case '2': |
| 193 | case '3': |
| 194 | case '4': |
| 195 | case '5': |
| 196 | case '6': |
| 197 | case '7': |
| 198 | case '8': |
| 199 | case '9': |
| 200 | return TYPE_NUMBER; |
| 201 | case '"': |
| 202 | { |
| 203 | /// Проверим - это просто строка или name-value pair |
| 204 | Pos after_string = skipString(); |
| 205 | if (after_string < ptr_end && *after_string == ':') |
| 206 | return TYPE_NAME_VALUE_PAIR; |
| 207 | else |
| 208 | return TYPE_STRING; |
| 209 | } |
| 210 | default: |
| 211 | throw JSONException(std::string("JSON: unexpected char ") + *ptr_begin + ", expected one of '{[tfn-0123456789\"'"); |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | |
| 216 | void JSON::checkPos(Pos pos) const |
no outgoing calls
no test coverage detected