Sha256: 26a1d2cdc12a833262a29f12a7c6244c98b0b7d77d440445c747f36a213e90b7

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

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

#ifndef TAO_JSON_EVENTS_INVALID_STRING_TO_HEX_HPP
#define TAO_JSON_EVENTS_INVALID_STRING_TO_HEX_HPP

#include <utility>

#include "../internal/hexdump.hpp"
#include "../utf8.hpp"

namespace tao::json::events
{
   template< typename Consumer >
   struct invalid_string_to_hex
      : Consumer
   {
      using Consumer::Consumer;

      void string( const char* v )
      {
         string( std::string_view( v ) );
      }

      void string( std::string&& v )
      {
         if( internal::validate_utf8_nothrow( v ) ) {
            Consumer::string( std::move( v ) );
         }
         else {
            Consumer::string( internal::hexdump( v ) );
         }
      }

      void string( const std::string_view v )
      {
         if( internal::validate_utf8_nothrow( v ) ) {
            Consumer::string( v );
         }
         else {
            Consumer::string( internal::hexdump( v ) );
         }
      }
   };

}  // namespace tao::json::events

#endif

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
couchbase-3.4.5 ext/couchbase/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.4.4 ext/couchbase/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.4.3 ext/couchbase/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.4.2 ext/couchbase/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.4.1 ext/couchbase/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.4.0 ext/couchbase/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.3.0 ext/couchbase/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp