BWAPI
|
00001 // Protocol Buffers - Google's data interchange format 00002 // Copyright 2008 Google Inc. All rights reserved. 00003 // http://code.google.com/p/protobuf/ 00004 // 00005 // Redistribution and use in source and binary forms, with or without 00006 // modification, are permitted provided that the following conditions are 00007 // met: 00008 // 00009 // * Redistributions of source code must retain the above copyright 00010 // notice, this list of conditions and the following disclaimer. 00011 // * Redistributions in binary form must reproduce the above 00012 // copyright notice, this list of conditions and the following disclaimer 00013 // in the documentation and/or other materials provided with the 00014 // distribution. 00015 // * Neither the name of Google Inc. nor the names of its 00016 // contributors may be used to endorse or promote products derived from 00017 // this software without specific prior written permission. 00018 // 00019 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00020 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00021 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00022 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00023 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00024 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00025 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00026 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00027 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00029 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 00031 // Author: kenton@google.com (Kenton Varda) 00032 // Based on original Protocol Buffers design by 00033 // Sanjay Ghemawat, Jeff Dean, and others. 00034 // 00035 // This header is logically internal, but is made public because it is used 00036 // from protocol-compiler-generated code, which may reside in other components. 00037 00038 #ifndef GOOGLE_PROTOBUF_REFLECTION_OPS_H__ 00039 #define GOOGLE_PROTOBUF_REFLECTION_OPS_H__ 00040 00041 #include <google/protobuf/message.h> 00042 00043 namespace google { 00044 namespace protobuf { 00045 namespace internal { 00046 00047 // Basic operations that can be performed using reflection. 00048 // These can be used as a cheap way to implement the corresponding 00049 // methods of the Message interface, though they are likely to be 00050 // slower than implementations tailored for the specific message type. 00051 // 00052 // This class should stay limited to operations needed to implement 00053 // the Message interface. 00054 // 00055 // This class is really a namespace that contains only static methods. 00056 class LIBPROTOBUF_EXPORT ReflectionOps { 00057 public: 00058 static void Copy(const Message& from, Message* to); 00059 static void Merge(const Message& from, Message* to); 00060 static void Clear(Message* message); 00061 static bool IsInitialized(const Message& message); 00062 static void DiscardUnknownFields(Message* message); 00063 00064 // Finds all unset required fields in the message and adds their full 00065 // paths (e.g. "foo.bar[5].baz") to *names. "prefix" will be attached to 00066 // the front of each name. 00067 static void FindInitializationErrors(const Message& message, 00068 const string& prefix, 00069 vector<string>* errors); 00070 00071 private: 00072 // All methods are static. No need to construct. 00073 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ReflectionOps); 00074 }; 00075 00076 } // namespace internal 00077 } // namespace protobuf 00078 00079 } // namespace google 00080 #endif // GOOGLE_PROTOBUF_REFLECTION_OPS_H__