| 28 | #endif |
| 29 | |
| 30 | RAPIDJSON_NAMESPACE_BEGIN |
| 31 | |
| 32 | /////////////////////////////////////////////////////////////////////////////// |
| 33 | // Encoding |
| 34 | |
| 35 | /*! \class rapidjson::Encoding |
| 36 | \brief Concept for encoding of Unicode characters. |
| 37 | |
| 38 | \code |
| 39 | concept Encoding { |
| 40 | typename Ch; //! Type of character. A "character" is actually a code unit in unicode's definition. |
| 41 | |
| 42 | enum { supportUnicode = 1 }; // or 0 if not supporting unicode |
| 43 | |
| 44 | //! \brief Encode a Unicode codepoint to an output stream. |
| 45 | //! \param os Output stream. |
| 46 | //! \param codepoint An unicode codepoint, ranging from 0x0 to 0x10FFFF inclusively. |
| 47 | template<typename OutputStream> |
| 48 | static void Encode(OutputStream& os, unsigned codepoint); |
| 49 | |
| 50 | //! \brief Decode a Unicode codepoint from an input stream. |
| 51 | //! \param is Input stream. |
| 52 | //! \param codepoint Output of the unicode codepoint. |
| 53 | //! \return true if a valid codepoint can be decoded from the stream. |
| 54 | template <typename InputStream> |
| 55 | static bool Decode(InputStream& is, unsigned* codepoint); |
| 56 | |
| 57 | //! \brief Validate one Unicode codepoint from an encoded stream. |
| 58 | //! \param is Input stream to obtain codepoint. |
| 59 | //! \param os Output for copying one codepoint. |
| 60 | //! \return true if it is valid. |
| 61 | //! \note This function just validating and copying the codepoint without actually decode it. |
| 62 | template <typename InputStream, typename OutputStream> |
| 63 | static bool Validate(InputStream& is, OutputStream& os); |
| 64 | |
| 65 | // The following functions are deal with byte streams. |
| 66 | |
| 67 | //! Take a character from input byte stream, skip BOM if exist. |
| 68 | template <typename InputByteStream> |
| 69 | static CharType TakeBOM(InputByteStream& is); |
| 70 | |
| 71 | //! Take a character from input byte stream. |
| 72 | template <typename InputByteStream> |
| 73 | static Ch Take(InputByteStream& is); |
| 74 | |
| 75 | //! Put BOM to output byte stream. |
| 76 | template <typename OutputByteStream> |
| 77 | static void PutBOM(OutputByteStream& os); |
| 78 | |
| 79 | //! Put a character to output byte stream. |
| 80 | template <typename OutputByteStream> |
| 81 | static void Put(OutputByteStream& os, Ch c); |
| 82 | }; |
| 83 | \endcode |
| 84 | */ |
| 85 | |
| 86 | /////////////////////////////////////////////////////////////////////////////// |
| 87 | // UTF8 |
no test coverage detected