Maxim Integrated / Mbed OS MAXREFDES155#

Dependencies:   MaximInterface

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers en.h Source File

en.h

00001 // Tencent is pleased to support the open source community by making RapidJSON available.
00002 // 
00003 // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
00004 //
00005 // Licensed under the MIT License (the "License"); you may not use this file except
00006 // in compliance with the License. You may obtain a copy of the License at
00007 //
00008 // http://opensource.org/licenses/MIT
00009 //
00010 // Unless required by applicable law or agreed to in writing, software distributed 
00011 // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
00012 // CONDITIONS OF ANY KIND, either express or implied. See the License for the 
00013 // specific language governing permissions and limitations under the License.
00014 
00015 #ifndef RAPIDJSON_ERROR_EN_H_
00016 #define RAPIDJSON_ERROR_EN_H_
00017 
00018 #include "error.h "
00019 
00020 #ifdef __clang__
00021 RAPIDJSON_DIAG_PUSH
00022 RAPIDJSON_DIAG_OFF(switch-enum)
00023 RAPIDJSON_DIAG_OFF(covered-switch-default)
00024 #endif
00025 
00026 RAPIDJSON_NAMESPACE_BEGIN
00027 
00028 //! Maps error code of parsing into error message.
00029 /*!
00030     \ingroup RAPIDJSON_ERRORS
00031     \param parseErrorCode Error code obtained in parsing.
00032     \return the error message.
00033     \note User can make a copy of this function for localization.
00034         Using switch-case is safer for future modification of error codes.
00035 */
00036 inline const RAPIDJSON_ERROR_CHARTYPE* GetParseError_En(ParseErrorCode parseErrorCode) {
00037     switch (parseErrorCode) {
00038         case kParseErrorNone:                           return RAPIDJSON_ERROR_STRING("No error.");
00039 
00040         case kParseErrorDocumentEmpty:                  return RAPIDJSON_ERROR_STRING("The document is empty.");
00041         case kParseErrorDocumentRootNotSingular:        return RAPIDJSON_ERROR_STRING("The document root must not be followed by other values.");
00042     
00043         case kParseErrorValueInvalid:                   return RAPIDJSON_ERROR_STRING("Invalid value.");
00044     
00045         case kParseErrorObjectMissName:                 return RAPIDJSON_ERROR_STRING("Missing a name for object member.");
00046         case kParseErrorObjectMissColon:                return RAPIDJSON_ERROR_STRING("Missing a colon after a name of object member.");
00047         case kParseErrorObjectMissCommaOrCurlyBracket:  return RAPIDJSON_ERROR_STRING("Missing a comma or '}' after an object member.");
00048     
00049         case kParseErrorArrayMissCommaOrSquareBracket:  return RAPIDJSON_ERROR_STRING("Missing a comma or ']' after an array element.");
00050 
00051         case kParseErrorStringUnicodeEscapeInvalidHex:  return RAPIDJSON_ERROR_STRING("Incorrect hex digit after \\u escape in string.");
00052         case kParseErrorStringUnicodeSurrogateInvalid:  return RAPIDJSON_ERROR_STRING("The surrogate pair in string is invalid.");
00053         case kParseErrorStringEscapeInvalid:            return RAPIDJSON_ERROR_STRING("Invalid escape character in string.");
00054         case kParseErrorStringMissQuotationMark:        return RAPIDJSON_ERROR_STRING("Missing a closing quotation mark in string.");
00055         case kParseErrorStringInvalidEncoding:          return RAPIDJSON_ERROR_STRING("Invalid encoding in string.");
00056 
00057         case kParseErrorNumberTooBig:                   return RAPIDJSON_ERROR_STRING("Number too big to be stored in double.");
00058         case kParseErrorNumberMissFraction:             return RAPIDJSON_ERROR_STRING("Miss fraction part in number.");
00059         case kParseErrorNumberMissExponent:             return RAPIDJSON_ERROR_STRING("Miss exponent in number.");
00060 
00061         case kParseErrorTermination:                    return RAPIDJSON_ERROR_STRING("Terminate parsing due to Handler error.");
00062         case kParseErrorUnspecificSyntaxError:          return RAPIDJSON_ERROR_STRING("Unspecific syntax error.");
00063 
00064         default:                                        return RAPIDJSON_ERROR_STRING("Unknown error.");
00065     }
00066 }
00067 
00068 RAPIDJSON_NAMESPACE_END
00069 
00070 #ifdef __clang__
00071 RAPIDJSON_DIAG_POP
00072 #endif
00073 
00074 #endif // RAPIDJSON_ERROR_EN_H_