• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2023 Google Inc.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 #ifndef GOOGLE_PROTOBUF_INTERNAL_VISIBILITY_H__
8 #define GOOGLE_PROTOBUF_INTERNAL_VISIBILITY_H__
9 
10 namespace google {
11 namespace protobuf {
12 
13 class Arena;
14 class Message;
15 class MessageLite;
16 
17 namespace internal {
18 
19 class InternalVisibilityForTesting;
20 class InternalMetadata;
21 
22 // Empty class to use as a mandatory 'internal token' for functions that have to
23 // be public, such as arena constructors, but that are for internal use only.
24 class InternalVisibility {
25  private:
26   // Note: we don't use `InternalVisibility() = default` here, but default the
27   // ctor outside of the class to force a private ctor instance.
28   explicit constexpr InternalVisibility();
29 
30   friend class ::google::protobuf::Arena;
31   friend class ::google::protobuf::Message;
32   friend class ::google::protobuf::MessageLite;
33   friend class ::google::protobuf::internal::InternalMetadata;
34 
35   friend class InternalVisibilityForTesting;
36 };
37 
38 inline constexpr InternalVisibility::InternalVisibility() = default;
39 
40 }  // namespace internal
41 }  // namespace protobuf
42 }  // namespace google
43 
44 #endif  // GOOGLE_PROTOBUF_INTERNAL_VISIBILITY_H__
45