Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:12:24

0001 // Protocol Buffers - Google's data interchange format
0002 // Copyright 2008 Google Inc.  All rights reserved.
0003 //
0004 // Use of this source code is governed by a BSD-style
0005 // license that can be found in the LICENSE file or at
0006 // https://developers.google.com/open-source/licenses/bsd
0007 
0008 // Author: kenton@google.com (Kenton Varda)
0009 //  Based on original Protocol Buffers design by
0010 //  Sanjay Ghemawat, Jeff Dean, and others.
0011 //
0012 // This header is logically internal, but is made public because it is used
0013 // from protocol-compiler-generated code, which may reside in other components.
0014 
0015 #ifndef GOOGLE_PROTOBUF_REFLECTION_OPS_H__
0016 #define GOOGLE_PROTOBUF_REFLECTION_OPS_H__
0017 
0018 #include "google/protobuf/message.h"
0019 #include "google/protobuf/port.h"
0020 
0021 #ifdef SWIG
0022 #error "You cannot SWIG proto headers"
0023 #endif
0024 
0025 // Must be included last.
0026 #include "google/protobuf/port_def.inc"
0027 
0028 namespace google {
0029 namespace protobuf {
0030 namespace internal {
0031 
0032 // Basic operations that can be performed using reflection.
0033 // These can be used as a cheap way to implement the corresponding
0034 // methods of the Message interface, though they are likely to be
0035 // slower than implementations tailored for the specific message type.
0036 //
0037 // This class should stay limited to operations needed to implement
0038 // the Message interface.
0039 //
0040 // This class is really a namespace that contains only static methods.
0041 class PROTOBUF_EXPORT ReflectionOps {
0042  public:
0043   ReflectionOps() = delete;
0044 
0045   static void Copy(const Message& from, Message* to);
0046   static void Merge(const Message& from, Message* to);
0047   static void Clear(Message* message);
0048   static bool IsInitialized(const Message& message);
0049   static bool IsInitialized(const Message& message, bool check_fields,
0050                             bool check_descendants);
0051   static void DiscardUnknownFields(Message* message);
0052 
0053   // Finds all unset required fields in the message and adds their full
0054   // paths (e.g. "foo.bar[5].baz") to *names.  "prefix" will be attached to
0055   // the front of each name.
0056   static void FindInitializationErrors(const Message& message,
0057                                        const std::string& prefix,
0058                                        std::vector<std::string>* errors);
0059 };
0060 
0061 }  // namespace internal
0062 }  // namespace protobuf
0063 }  // namespace google
0064 
0065 #include "google/protobuf/port_undef.inc"
0066 
0067 #endif  // GOOGLE_PROTOBUF_REFLECTION_OPS_H__