1e462795ff5d4c7359f9e8637c10544bb2de70107tturney// Tencent is pleased to support the open source community by making RapidJSON available. 2e462795ff5d4c7359f9e8637c10544bb2de70107tturney// 3e462795ff5d4c7359f9e8637c10544bb2de70107tturney// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved. 4e462795ff5d4c7359f9e8637c10544bb2de70107tturney// 5e462795ff5d4c7359f9e8637c10544bb2de70107tturney// Licensed under the MIT License (the "License"); you may not use this file except 6e462795ff5d4c7359f9e8637c10544bb2de70107tturney// in compliance with the License. You may obtain a copy of the License at 7e462795ff5d4c7359f9e8637c10544bb2de70107tturney// 8e462795ff5d4c7359f9e8637c10544bb2de70107tturney// http://opensource.org/licenses/MIT 9e462795ff5d4c7359f9e8637c10544bb2de70107tturney// 10e462795ff5d4c7359f9e8637c10544bb2de70107tturney// Unless required by applicable law or agreed to in writing, software distributed 11e462795ff5d4c7359f9e8637c10544bb2de70107tturney// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 12e462795ff5d4c7359f9e8637c10544bb2de70107tturney// CONDITIONS OF ANY KIND, either express or implied. See the License for the 13e462795ff5d4c7359f9e8637c10544bb2de70107tturney// specific language governing permissions and limitations under the License. 14e462795ff5d4c7359f9e8637c10544bb2de70107tturney 15e462795ff5d4c7359f9e8637c10544bb2de70107tturney#ifndef RAPIDJSON_ERROR_EN_H__ 16e462795ff5d4c7359f9e8637c10544bb2de70107tturney#define RAPIDJSON_ERROR_EN_H__ 17e462795ff5d4c7359f9e8637c10544bb2de70107tturney 18e462795ff5d4c7359f9e8637c10544bb2de70107tturney#include "error.h" 19e462795ff5d4c7359f9e8637c10544bb2de70107tturney 20e462795ff5d4c7359f9e8637c10544bb2de70107tturneyRAPIDJSON_NAMESPACE_BEGIN 21e462795ff5d4c7359f9e8637c10544bb2de70107tturney 22e462795ff5d4c7359f9e8637c10544bb2de70107tturney//! Maps error code of parsing into error message. 23e462795ff5d4c7359f9e8637c10544bb2de70107tturney/*! 24e462795ff5d4c7359f9e8637c10544bb2de70107tturney \ingroup RAPIDJSON_ERRORS 25e462795ff5d4c7359f9e8637c10544bb2de70107tturney \param parseErrorCode Error code obtained in parsing. 26e462795ff5d4c7359f9e8637c10544bb2de70107tturney \return the error message. 27e462795ff5d4c7359f9e8637c10544bb2de70107tturney \note User can make a copy of this function for localization. 28e462795ff5d4c7359f9e8637c10544bb2de70107tturney Using switch-case is safer for future modification of error codes. 29e462795ff5d4c7359f9e8637c10544bb2de70107tturney*/ 30e462795ff5d4c7359f9e8637c10544bb2de70107tturneyinline const RAPIDJSON_ERROR_CHARTYPE* GetParseError_En(ParseErrorCode parseErrorCode) { 31e462795ff5d4c7359f9e8637c10544bb2de70107tturney switch (parseErrorCode) { 32e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorNone: return RAPIDJSON_ERROR_STRING("No error."); 33e462795ff5d4c7359f9e8637c10544bb2de70107tturney 34e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorDocumentEmpty: return RAPIDJSON_ERROR_STRING("The document is empty."); 35e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorDocumentRootNotSingular: return RAPIDJSON_ERROR_STRING("The document root must not follow by other values."); 36e462795ff5d4c7359f9e8637c10544bb2de70107tturney 37e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorValueInvalid: return RAPIDJSON_ERROR_STRING("Invalid value."); 38e462795ff5d4c7359f9e8637c10544bb2de70107tturney 39e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorObjectMissName: return RAPIDJSON_ERROR_STRING("Missing a name for object member."); 40e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorObjectMissColon: return RAPIDJSON_ERROR_STRING("Missing a colon after a name of object member."); 41e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorObjectMissCommaOrCurlyBracket: return RAPIDJSON_ERROR_STRING("Missing a comma or '}' after an object member."); 42e462795ff5d4c7359f9e8637c10544bb2de70107tturney 43e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorArrayMissCommaOrSquareBracket: return RAPIDJSON_ERROR_STRING("Missing a comma or ']' after an array element."); 44e462795ff5d4c7359f9e8637c10544bb2de70107tturney 45e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorStringUnicodeEscapeInvalidHex: return RAPIDJSON_ERROR_STRING("Incorrect hex digit after \\u escape in string."); 46e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorStringUnicodeSurrogateInvalid: return RAPIDJSON_ERROR_STRING("The surrogate pair in string is invalid."); 47e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorStringEscapeInvalid: return RAPIDJSON_ERROR_STRING("Invalid escape character in string."); 48e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorStringMissQuotationMark: return RAPIDJSON_ERROR_STRING("Missing a closing quotation mark in string."); 49e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorStringInvalidEncoding: return RAPIDJSON_ERROR_STRING("Invalid encoding in string."); 50e462795ff5d4c7359f9e8637c10544bb2de70107tturney 51e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorNumberTooBig: return RAPIDJSON_ERROR_STRING("Number too big to be stored in double."); 52e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorNumberMissFraction: return RAPIDJSON_ERROR_STRING("Miss fraction part in number."); 53e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorNumberMissExponent: return RAPIDJSON_ERROR_STRING("Miss exponent in number."); 54e462795ff5d4c7359f9e8637c10544bb2de70107tturney 55e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorTermination: return RAPIDJSON_ERROR_STRING("Terminate parsing due to Handler error."); 56e462795ff5d4c7359f9e8637c10544bb2de70107tturney case kParseErrorUnspecificSyntaxError: return RAPIDJSON_ERROR_STRING("Unspecific syntax error."); 57e462795ff5d4c7359f9e8637c10544bb2de70107tturney 58e462795ff5d4c7359f9e8637c10544bb2de70107tturney default: 59e462795ff5d4c7359f9e8637c10544bb2de70107tturney return RAPIDJSON_ERROR_STRING("Unknown error."); 60e462795ff5d4c7359f9e8637c10544bb2de70107tturney } 61e462795ff5d4c7359f9e8637c10544bb2de70107tturney} 62e462795ff5d4c7359f9e8637c10544bb2de70107tturney 63e462795ff5d4c7359f9e8637c10544bb2de70107tturneyRAPIDJSON_NAMESPACE_END 64e462795ff5d4c7359f9e8637c10544bb2de70107tturney 65e462795ff5d4c7359f9e8637c10544bb2de70107tturney#endif // RAPIDJSON_ERROR_EN_H__ 66