Sha256: 8286065eb477a74d8e1d6ce202037ae15c180e26cb52101d160e5efb8fa46843

Contents?: true

Size: 1.51 KB

Versions: 34

Compression:

Stored size: 1.51 KB

Contents

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

#ifndef TAO_JSON_BINDING_INTERNAL_TYPE_KEY_HPP
#define TAO_JSON_BINDING_INTERNAL_TYPE_KEY_HPP

#include <string>

#include "../../internal/string_t.hpp"
#include "../../internal/type_traits.hpp"

namespace tao::json::binding::internal
{
   struct use_default_key
   {};

   template< typename K, typename V >
   struct type_key;

   template< char... Cs, typename V >
   struct type_key< json::internal::string_t< Cs... >, V >
   {
      template< template< typename... > class Traits >
      [[nodiscard]] static std::string key()
      {
         return json::internal::string_t< Cs... >::as_string();
      }

      template< template< typename... > class Traits = traits, typename Consumer >
      static void produce_key( Consumer& consumer )
      {
         consumer.key( json::internal::string_t< Cs... >::as_string_view() );
      }
   };

   template< typename V >
   struct type_key< use_default_key, V >
   {
      template< template< typename... > class Traits >
      [[nodiscard]] static std::string key()
      {
         return Traits< V >::template default_key< Traits >::as_string();
      }

      template< template< typename... > class Traits = traits, typename Consumer >
      static void produce_key( Consumer& consumer )
      {
         consumer.key( Traits< V >::template default_key< Traits >::as_string_view() );
      }
   };

}  // namespace tao::json::binding::internal

#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/binding/internal/type_key.hpp
couchbase-3.2.0 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.1.1 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.1.1-universal-darwin-20 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.1.0 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.3 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.3-universal-darwin-20 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.2 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.1-universal-darwin-19 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.1 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.0-universal-darwin-19 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.0 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.0.beta.1-universal-darwin-19 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.0.beta.1 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.0.alpha.5-x86_64-linux ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.0.alpha.5-universal-darwin-19 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.0.alpha.5-x86_64-darwin-19 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.0.alpha.5 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.0.alpha.4-x86_64-linux ext/third_party/json/include/tao/json/binding/internal/type_key.hpp
couchbase-3.0.0.alpha.4-x86_64-darwin-19 ext/third_party/json/include/tao/json/binding/internal/type_key.hpp