Struct Transcoder< Encoding, Encoding >

Synopsis

#include <include/rapidjson/encodings.h>

template<typename Encoding>
struct Transcoder<Encoding, Encoding>

Description

Specialization of Transcoder with same source and target encoding.

Methods

Transcode
TranscodeUnsafe
Validate

Source

Lines 690-708 in include/rapidjson/encodings.h.

template<typename Encoding>
struct Transcoder<Encoding, Encoding> {
    template<typename InputStream, typename OutputStream>
    static RAPIDJSON_FORCEINLINE bool Transcode(InputStream& is, OutputStream& os) {
        os.Put(is.Take());  // Just copy one code unit. This semantic is different from primary template class.
        return true;
    }

    template<typename InputStream, typename OutputStream>
    static RAPIDJSON_FORCEINLINE bool TranscodeUnsafe(InputStream& is, OutputStream& os) {
        PutUnsafe(os, is.Take());  // Just copy one code unit. This semantic is different from primary template class.
        return true;
    }

    template<typename InputStream, typename OutputStream>
    static RAPIDJSON_FORCEINLINE bool Validate(InputStream& is, OutputStream& os) {
        return Encoding::Validate(is, os);  // source/target encoding are the same
    }
};





Add Discussion as Guest

Log in