15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Protocol Buffers - Google's data interchange format 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright 2008 Google Inc. All rights reserved. 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// http://code.google.com/p/protobuf/ 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Redistribution and use in source and binary forms, with or without 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// modification, are permitted provided that the following conditions are 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// met: 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// * Redistributions of source code must retain the above copyright 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// notice, this list of conditions and the following disclaimer. 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// * Redistributions in binary form must reproduce the above 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// copyright notice, this list of conditions and the following disclaimer 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// in the documentation and/or other materials provided with the 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// distribution. 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// * Neither the name of Google Inc. nor the names of its 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// contributors may be used to endorse or promote products derived from 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// this software without specific prior written permission. 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Author: kenton@google.com (Kenton Varda) 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Based on original Protocol Buffers design by 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Sanjay Ghemawat, Jeff Dean, and others. 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This file contains miscellaneous helper code used by generated code -- 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// including lite types -- but which should not be used directly by users. 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__ 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__ 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <google/protobuf/stubs/common.h> 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include <google/protobuf/stubs/once.h> 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace google { 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace protobuf { 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace internal { 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Annotation for the compiler to emit a deprecation message if a field marked 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// with option 'deprecated=true' is used in the code, or for other things in 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// generated code which are deprecated. 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// For internal use in the pb.cc files, deprecation warnings are suppressed 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// there. 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#undef DEPRECATED_PROTOBUF_FIELD 56ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch#define PROTOBUF_DEPRECATED 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Constants for special floating point values. 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LIBPROTOBUF_EXPORT double Infinity(); 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)LIBPROTOBUF_EXPORT double NaN(); 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Default empty string object. Don't use the pointer directly. Instead, call 645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// GetEmptyString() to get the reference. 655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LIBPROTOBUF_EXPORT extern const ::std::string* empty_string_; 665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LIBPROTOBUF_EXPORT extern ProtobufOnceType empty_string_once_init_; 675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LIBPROTOBUF_EXPORT void InitEmptyString(); 695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)LIBPROTOBUF_EXPORT inline const ::std::string& GetEmptyString() { 715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) GoogleOnceInit(&empty_string_once_init_, &InitEmptyString); 725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) return *empty_string_; 735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 75ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// Defined in generated_message_reflection.cc -- not actually part of the lite 76ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// library. 77ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// 78ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// TODO(jasonh): The various callers get this declaration from a variety of 79ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// places: probably in most cases repeated_field.h. Clean these up so they all 80ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// get the declaration from this file. 81ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben MurdochLIBPROTOBUF_EXPORT int StringSpaceUsedExcludingSelf(const string& str); 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace internal 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace protobuf 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace google 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // GOOGLE_PROTOBUF_GENERATED_MESSAGE_UTIL_H__ 88