Sha256: 7a0447d7abf21b566fec81eaa1133e4534bdc5334263b31b0c561d42c388f49e

Contents?: true

Size: 1.91 KB

Versions: 10

Compression:

Stored size: 1.91 KB

Contents

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

#ifndef TAO_JSON_PEGTL_CONTRIB_ICU_INTERNAL_HPP
#define TAO_JSON_PEGTL_CONTRIB_ICU_INTERNAL_HPP

#include <unicode/uchar.h>

#include "../../config.hpp"
#include "../../type_list.hpp"

#include "../../internal/enable_control.hpp"

namespace TAO_JSON_PEGTL_NAMESPACE::internal
{
   namespace icu
   {
      template< typename Peek, UProperty P, bool V = true >
      struct binary_property
      {
         using rule_t = binary_property;
         using subs_t = empty_list;

         template< typename ParseInput >
         [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( Peek::peek( in ) ) )
         {
            if( const auto r = Peek::peek( in ) ) {
               if( u_hasBinaryProperty( r.data, P ) == V ) {
                  in.bump( r.size );
                  return true;
               }
            }
            return false;
         }
      };

      template< typename Peek, UProperty P, int V >
      struct property_value
      {
         using rule_t = property_value;
         using subs_t = empty_list;

         template< typename ParseInput >
         [[nodiscard]] static bool match( ParseInput& in ) noexcept( noexcept( Peek::peek( in ) ) )
         {
            if( const auto r = Peek::peek( in ) ) {
               if( u_getIntPropertyValue( r.data, P ) == V ) {
                  in.bump( r.size );
                  return true;
               }
            }
            return false;
         }
      };

   }  // namespace icu

   template< typename Peek, UProperty P, bool V >
   inline constexpr bool enable_control< icu::binary_property< Peek, P, V > > = false;

   template< typename Peek, UProperty P, int V >
   inline constexpr bool enable_control< icu::property_value< Peek, P, V > > = false;

}  // namespace TAO_JSON_PEGTL_NAMESPACE::internal

#endif

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
couchbase-3.2.0-universal-darwin-20 ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp
couchbase-3.2.0 ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp
couchbase-3.1.1 ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp
couchbase-3.1.1-universal-darwin-20 ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp
couchbase-3.1.0 ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp
couchbase-3.0.3 ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp
couchbase-3.0.3-universal-darwin-20 ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp
couchbase-3.0.2 ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp
couchbase-3.0.1-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp
couchbase-3.0.1 ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp