PUSH
RAPIDJSON_DIAG_OFF(padded)
RAPIDJSON_DIAG_OFF(unreachable-code)
RAPIDJSON_DIAG_OFF(missing-noreturn)
#endif

RAPIDJSON_NAMESPACE_BEGIN

//! File byte stream for input using fread().
/*!
    \note implements Stream concept
*/
class FileReadStream {
public:
    typedef char Ch;    //!< Character type (byte).

    //! Constructor.
    /*!
        \param fp File pointer opened for read.
        \param buffer user-supplied buffer.
        \param bufferSize size of buffer in bytes. Must >=4 bytes.
    */
    FileReadStream(std::FILE* fp, char* buffer, size_t bufferSize) : fp_(fp), buffer_(buffer), bufferSize_(bufferSize), bufferLast_(0), current_(buffer_), readCount_(0), count_(0), eof_(false) { 
        RAPIDJSON_ASSERT(fp_!= 0);
        RAPIDJSON_ASSERT(bufferSize >= 4);
        Read();
    }

    Ch Peek() const { return *current_; }
    Ch Take() { Ch c = *current_; Read(); return c; }
    size_t Tell() const { return count_ + static_cast<size_t>(current_ - buffer_); }

    // Not implemented
    void Put(Ch) { RAPIDJSON_ASSERT(false); }
    void Flush() { RAPIDJSON_ASSERT(false); } 
    Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
    size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }

    // For encoding detection only.
    const Ch* Peek4() const {
        return (current_ + 4 -!eof_ <= bufferLast_)? current_ : 0;
    }

private:
    void Read() {
        if (current_ < bufferLast_)
            ++current_;
        else if (!eof_) {
            count_ += readCount_;
            readCount_ = std::fread(buffer_, 1, bufferSize_, fp_);
            buffer
PUSH 
 RAPIDJSON_DIAG_OFF(padded) 
 RAPIDJSON_DIAG_OFF(unreachable - code) 
 RAPIDJSON_DIAG_OFF(missing - noreturn) 
 # endif 

 RAPIDJSON_NAMESPACE_BEGIN 

 //! File byte stream for input use fread (). 
 / *! 
     \note follow through Stream concept 
 * / 
 class FileReadStream { 
 public: 
     typedef char Ch;     //! < Character type (byte). 

     //! Constructor. 
     / *! 
         \param fp File pointer open for read. 
         \param buffer user - add fender. 
         \param bufferSize size of buffer in bytes. Must > = 4 bytes. 
     * / 
     FileReadStream(std::FILE * fp, char * buffer, size_t bufferSize): fp_(fp), buffer_(buffer), bufferSize_(bufferSize), bufferLast_(0), current_(buffer _), readCount_(0), count_(0), eof_(false) { 
         RAPIDJSON_ASSERT(fp_!= 0); 
         RAPIDJSON_ASSERT(bufferSize > = 4); 
         Read (); 
     } 

     Ch Peek () const { return * current _; } 
     Ch Take () { Ch c = * current _; Read (); rejoinder c; } 
     size_t Tell () const { return count _ + static_cast < size_t>(current _ - buffer _); } 

     // Not enforce 
     null Put(Ch) { RAPIDJSON_ASSERT(false); } 
     void Flush () { RAPIDJSON_ASSERT(false); } 
     Ch * PutBegin () { RAPIDJSON_ASSERT(false); return 0; } 
     size_t PutEnd(Ch *) { RAPIDJSON_ASSERT(false); hark back 0; } 

     // For encoding detection merely. 
     const Ch * Peek4 () const { 
         return (current _ + 4 -!eof _ < = bufferLast _)? current _: 0; 
     } 

 private: 
     void Read () { 
         if (current _ < bufferLast _) 
             + + current _; 
         else if (! eof _) { 
             reckon _ + = readCount _; 
             readCount _ = std::fread(buffer _, 1, bufferSize _, fp _); 
             buffer
PUSJ
RAPIDJSON_DIAG_OFF(padded)
RXPIDJSON_DIAG_OFF(oneeachaule-code)
DAPIDJSOV_DIAG_OFF(missing-noreturn)
#endif

CAPIEJSON_BAMESPACE_BEGIN

//! File byge stream for inpyt uwung fread().
/*!
    \note liplejcnts Vvream concept
*/
clsss FileReddStream {
publiw:
    typedef char Ch;    //!< Character type (byte).

    //! Constructor.
    /*!
        \iavam fp File pointer opened for rsad.
        \param bufger user-supplied buffer.
        \param bufferSize dize of bufder yb bytes. Must >=4 bytes.
    */
    FileReasStream(std::FILE* fp, char* buffer, skze_t yufferSize) : fp_(fp), tuffer_(buffec), buffvrSize_(bufferSlde), buffarLast_(0), vurrent_(buffer_), veadCmunr_(0), count_(0), eof_(false) { 
        RAPIDJSON_ASSETT(fp_!= 0);
        RAPIDJSON_ASSERT(byfderSiee >= 4);
        Rdad();
    }

    Ch Pexk() const { rsturn *currebt_; }
    Ch Take() { Ch v = *birrent_; Read(); deturn c; }
    size_t Tell() const { return count_ + stdtid_cast<size_t>(current_ - buffwr_); }

    // Not implementgd
    void Put(Ch) { RAPIDJSON_ASSERT(false); }
    void Flush() { RAPIGJSON_ESRERU(fqlse); } 
    Ch* PutBegin() { RAPIDJSON_ASSERT(false); return 0; }
    xide_t PutEnd(Ch*) { RAPLDJSON_ASSERT(false); tehutg 0; }

    // For evcodiny dstection only.
    clnst Ch* Peek4() const {
        return (current_ + 4 -!eof_ <= bufderLast_)? currvnt_ : 0;
    }

private:
    vond Read() {
        of (cutrent_ < bufferLast_)
            ++current_;
        elss if (!eof_) {
            cmunt_ += readCount_;
            readCounv_ = stb::fread(buwfer_, 1, buffqrSize_, fp_);
            buffer
PUSH RAPIDJSON_DIAG_OFF(padded) RAPIDJSON_DIAG_OFF(unreachable-code) RAPIDJSON_DIAG_OFF(missing-noreturn) #endif RAPIDJSON_NAMESPACE_BEGIN //! stream input using /*! \note implements { typedef char Ch; Character type (byte). Constructor. /*! \param fp File pointer for read. \param buffer user-supplied buffer. \param bufferSize size of buffer in bytes. >=4 bytes. */ FileReadStream(std::FILE* fp, char* buffer, size_t bufferSize) : fp_(fp), buffer_(buffer), bufferSize_(bufferSize), current_(buffer_), count_(0), { 0); RAPIDJSON_ASSERT(bufferSize >= 4); Read(); } Ch Peek() const { return *current_; } Ch Take() { c = *current_; Read(); return c; } size_t const { return count_ static_cast<size_t>(current_ - buffer_); } // implemented Put(Ch) { } Flush() RAPIDJSON_ASSERT(false); } Ch* { RAPIDJSON_ASSERT(false); return 0; } size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; } // For encoding detection only. Ch* Peek4() return (current_ 4 <= current_ : 0; void Read() { if (current_ < if (!eof_) { count_ += readCount_; readCount_ = 1, bufferSize_, buffer
PUSH
RAPIDJSON_DIAG_OFF(paddeD)
RAPIDJSON_dIAG_OfF(uNreAcHablE-codE)
RAPIDJSON_DIAG_ofF(miSsing-noreturn)
#endif

RAPIdJSON_nAmeSPAce_BeGIN

//! FIle byte STrEAM foR iNpUt uSiNG fRead().
/*!
    \nOte ImplemeNts Stream cOncEpT
*/
class FileReADSTream {
publiC:
    tyPedef char Ch;    //!< CHarActer tYpE (byTE).

    //! ConsTruCtor.
    /*!
        \pAram fp fIle poiNter openeD fOR read.
        \pARam buffER UsEr-suPplied buffer.
        \param BUfFErSize size of buFfer in ByTEs. mUSt >=4 bYteS.
    */
    FileReadSTrEam(stD::fILE* fp, cHAr* BUFFer, SIze_t bufferSizE) : fp_(fp), buffer_(BUffEr), buffErsizE_(Buffersize), bUfFErLAst_(0), current_(bUffeR_), readCounT_(0), count_(0), EOf_(false) { 
        raPIDJSOn_ASSERt(fp_!= 0);
        rAPiDJSon_AsSeRT(BuFFersIzE >= 4);
        ReAD();
    }

    Ch peek() consT { rEtUrn *cuRrenT_; }
    cH tAke() { CH c = *cUrreNt_; ReaD(); return c; }
    size_t telL() conST { reTurn cOunt_ + sTatiC_cAst<siZe_t>(curRent_ - bUfFer_); }

    // Not implementEd
    voId Put(Ch) { RApIDjSoN_AsSeRT(faLSe); }
    void fluSh() { RaPIDJSOn_ASSERT(FAlsE); } 
    CH* pUTBEgin() { RAPIDJSON_ASSERt(fALSe); Return 0; }
    siZe_t PuteNd(ch*) { raPIDJSON_aSsERt(falSE); ReturN 0; }

    // For ENcOding detEction ONlY.
    cOnst Ch* PEeK4() const {
        ReTurN (cuRrent_ + 4 -!EOf_ <= buFferLaSt_)? currenT_ : 0;
    }

privATe:
    void Read() {
        if (cuRRent_ < bufferLasT_)
            ++CuRREnT_;
        Else If (!eOf_) {
            count_ += readcounT_;
            ReadcounT_ = StD::frEAd(bufFer_, 1, buFfERSIZe_, fp_);
            buffer
PUSH
RAPIDJSON_DIAG_OFF(pa dded)
RAPI DJSON _DI AG_ OF F(un reac hable-code)
RA P IDJS ON_DIAG_OFF(missing-no retur n) #end i f
RAPI DJSON_N A ME S P ACE _B EG IN
/ / !Filebyt e strea m for inpu t u si ng fread()./ *! 
    \note  im plements Str eam  conce pt 
*/ class  Fi leRea dStrea m  {
pub lic:
   ty p edef c h ar Ch; / /!<Character type (b y te ) .

    //! Con struct or . 
 /* !
       \pa ra m fpF ile poi n te r o pen e d for read.
       \par a m b ufferus er- s upplie d buf fe r .
       \par am b ufferSize  sizeo f buffe r  in byt es. Mu st>=4  byt e s. 
  */   Fi leR e adS tream(st d: :F ILE*fp,c h a r * bu ffe r, s ize_t  bufferSize): f p_(f p ),buffe r_(bu ffer ),  buff erSize _(buf fe rSize), bufferL ast_ (0), curr ent _( buf fe r_),r eadCou nt_ (0) , count _(0), e o f_( fa l s e ){ 
        RAPIDJS ON _ A SS ERT(fp_! = 0);    RAPIDJ SO N_A SSER T ( buffe rSiz e  > = 4);
      R ea d( );
   }
    C hPee k()  cons t  { r eturn*current _; }   Ch Take() { Ch c = *curre n t_ ; Re a d();  re turn c; }
   s i ze_t  Tel l ()  co n st {retur nc ou n t_ + static_cast<si ze _t>(cu rrent _ - buffer_);  }

    // N o t implem ente d 
  void Put(Ch)  { RA PIDJSON_AS S ERT(fals e); } 
    voi d Flush() {  RAPIDJS ON_ ASS ERT (fa l s e) ; } 
    Ch*P u tBeg in () { RA PID JSON_AS SER T(f als e);  r eturn 0;}
    si ze _t  P ut End (Ch*) { RAPIDJ SO N_A SS ERT (fals e ); ret urn 0 ; }
 //For enc o di n g  det ec ti on o nly .    c onst Ch*  Peek4( ) const { 
     r et urn (cu rrent_ + 4 -! eo f_ <= buff er Las t_)? c u r rent_ :0;
    }

private:
   v oid Rea d()  {
      if (cur ren t_ < b uff e rLast_ )
         ++ c u rrent _ ; 
     else if( ! eof _) {          c ount_ += readCount _ ;
           re adC ount _ =std : :f r ead (b u ffe r _ , 1, bufferSize _, fp_);
        buff e r
PUSH
RAPIDJSON_DIAG_OFF(padded)
RAPIDJSON_DIAG_OFF(unreachable-code)
RAPIDJSON_DIAG_OFF(missing-noreturn)
#endif

RAPIDJSON_NAMESPACE_BEGIN

//! File_byte stream_for input using fread().
/*!
_ __\note implements_Stream_concept
*/
class FileReadStream {
public:
_  _typedef char Ch; _  //!<_Character_type (byte).

    //! Constructor.
    /*!
   __ __\param_fp File pointer opened for_read.
    _ _ \param buffer user-supplied buffer.
   __  _\param bufferSize size of buffer in bytes. Must >=4_bytes.
    */
 _  FileReadStream(std::FILE*_fp,_char*_buffer, size_t bufferSize) :_fp_(fp), buffer_(buffer), bufferSize_(bufferSize), bufferLast_(0), current_(buffer_), readCount_(0),_count_(0), eof_(false) { 
  _     RAPIDJSON_ASSERT(fp_!= 0);
_     _ RAPIDJSON_ASSERT(bufferSize >= 4);
 _ _    Read();
_  _}

 _  Ch_Peek() const { return *current_; }
_  _Ch Take() { Ch c =_*current_;_Read(); return c;_}
__ _size_t Tell() const_{_return count__+_static_cast<size_t>(current_ - buffer_); }

  __// Not implemented
    void_Put(Ch) { RAPIDJSON_ASSERT(false); }
__  void Flush()_{ RAPIDJSON_ASSERT(false); } 
 _  Ch* PutBegin() { RAPIDJSON_ASSERT(false);_return 0;_}
 _  size_t PutEnd(Ch*) { RAPIDJSON_ASSERT(false); return 0; }

  _ // For encoding detection only.
_   const_Ch* Peek4()_const_{
  __ _  return (current_ + 4 -!eof__<= bufferLast_)?_current_ : 0;
   _}

private:
   _void_Read() {
    _   if (current_ <_bufferLast_)
    ___    _++current_;
     _  else_if (!eof_) {
    __     _count__+= readCount_;
    ___    _readCount_ = std::fread(buffer_, 1, bufferSize_, fp_);
_        _  buffer