// Protocol Buffers - Google's data interchange format // Copyright 2023 Google LLC. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd #ifndef GOOGLE_PROTOBUF_HPB_REPEATED_FIELD_H__ #define GOOGLE_PROTOBUF_HPB_REPEATED_FIELD_H__ #include #include #include "absl/strings/string_view.h" #include "hpb/multibackend.h" #include "hpb/ptr.h" #if HPB_INTERNAL_BACKEND == HPB_INTERNAL_BACKEND_UPB #include "hpb/backend/upb/repeated_field.h" #elif HPB_INTERNAL_BACKEND == HPB_INTERNAL_BACKEND_CPP #include "hpb/backend/cpp/repeated_field.h" #else #error "Unsupported backend" #endif namespace hpb { template class RepeatedField { static constexpr bool kIsString = std::is_same_v; static constexpr bool kIsScalar = std::is_arithmetic_v; public: using Proxy = std::conditional_t< kIsScalar, internal::RepeatedFieldScalarProxy, std::conditional_t, internal::RepeatedFieldProxy>>; using CProxy = std::conditional_t< kIsScalar, internal::RepeatedFieldScalarProxy, std::conditional_t, internal::RepeatedFieldProxy>>; // TODO: T supports incomplete type from fwd.h forwarding headers // We would like to reference T::CProxy. Validate forwarding header design. using ValueProxy = std::conditional_t< kIsScalar, T, std::conditional_t>>; using ValueCProxy = std::conditional_t< kIsScalar, const T, std::conditional_t>>; using Access = std::conditional_t< kIsScalar, internal::RepeatedFieldScalarProxy, std::conditional_t, internal::RepeatedFieldProxy>>; }; } // namespace hpb #endif // GOOGLE_PROTOBUF_HPB_REPEATED_FIELD_H__