Sha256: 8f9c24f2ddf5b62e30c084385b3aa89c05a7b422850d5f3795032616329e8a50

Contents?: true

Size: 938 Bytes

Versions: 34

Compression:

Stored size: 938 Bytes

Contents

// Copyright (c) 2015-2020 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/json/

#ifndef TAO_JSON_STREAM_HPP
#define TAO_JSON_STREAM_HPP

#include <iomanip>
#include <iosfwd>
#include <stdexcept>

#include "to_stream.hpp"
#include "value.hpp"

#include "internal/format.hpp"

namespace tao::json
{
   // Use ostream << std::setw( n ) for pretty-printing with indent n.

   template< template< typename... > class Traits >
   std::ostream& operator<<( std::ostream& o, const basic_value< Traits >& v )
   {
      const auto w = o.width( 0 );
      if( w > 0 ) {
         if( w >= 256 ) {
            throw std::runtime_error( internal::format( "indentation ", w, " larger than 255" ) );
         }
         json::to_stream( o, v, static_cast< std::size_t >( w ) );
      }
      else {
         json::to_stream( o, v );
      }
      return o;
   }

}  // namespace tao::json

#endif

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
couchbase-3.2.0-universal-darwin-20 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.2.0 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.1.1 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.1.1-universal-darwin-20 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.1.0 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.3 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.3-universal-darwin-20 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.2 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.1-universal-darwin-19 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.1 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.0-universal-darwin-19 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.0 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.0.beta.1-universal-darwin-19 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.0.beta.1 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.0.alpha.5-x86_64-linux ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.0.alpha.5-universal-darwin-19 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.0.alpha.5-x86_64-darwin-19 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.0.alpha.5 ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.0.alpha.4-x86_64-linux ext/third_party/json/include/tao/json/stream.hpp
couchbase-3.0.0.alpha.4-x86_64-darwin-19 ext/third_party/json/include/tao/json/stream.hpp