Sha256: cab665b33b810de24c9aa27c0e99bc538bb6e0b7dec31e8016d52e9eb202fa89

Contents?: true

Size: 971 Bytes

Versions: 34

Compression:

Stored size: 971 Bytes

Contents

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

#ifndef TAO_JSON_PEGTL_INTERNAL_CSTRING_READER_HPP
#define TAO_JSON_PEGTL_INTERNAL_CSTRING_READER_HPP

#include <cassert>
#include <cstddef>

#include "../config.hpp"

namespace TAO_JSON_PEGTL_NAMESPACE::internal
{
   struct cstring_reader
   {
      explicit cstring_reader( const char* zero_terminated ) noexcept
         : m_cstring( zero_terminated )
      {
         assert( m_cstring != nullptr );
      }

      [[nodiscard]] std::size_t operator()( char* buffer, const std::size_t length ) noexcept
      {
         std::size_t i = 0;
         char c;

         while( ( i < length ) && ( ( c = m_cstring[ i ] ) != 0 ) ) {
            *buffer++ = c;
            ++i;
         }
         m_cstring += i;
         return i;
      }

      const char* m_cstring;
   };

}  // namespace TAO_JSON_PEGTL_NAMESPACE::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/external/pegtl/internal/cstring_reader.hpp
couchbase-3.2.0 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.1.1 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.1.1-universal-darwin-20 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.1.0 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.3 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.3-universal-darwin-20 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.2 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.1-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.1 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.0-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.0 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.0.beta.1-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.0.beta.1 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.0.alpha.5-x86_64-linux ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.0.alpha.5-universal-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.0.alpha.5-x86_64-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.0.alpha.5 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.0.alpha.4-x86_64-linux ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp
couchbase-3.0.0.alpha.4-x86_64-darwin-19 ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp