Sha256: e49b5f5991f6ff44ccedba2adba34a34c3c867cf1bbb4084f7c99a3473bdb6cb

Contents?: true

Size: 1.08 KB

Versions: 34

Compression:

Stored size: 1.08 KB

Contents

// Copyright (c) 2019-2020 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

34 entries across 34 versions & 1 rubygems

Version Path
couchbase-3.0.0.alpha.4-universal-darwin-19 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.4 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.3-x86_64-linux ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.3-x86_64-darwin-19 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.3-universal-darwin-19 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.3 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.2-x86_64-linux ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.2-x86_64-darwin-19 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.2-universal-darwin-19 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.2 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.1-x86_64-linux ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.1-x86_64-darwin-19 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.1-universal-darwin-19 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp
couchbase-3.0.0.alpha.1 ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp