1e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// Protocol Buffers - Google's data interchange format 2e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// Copyright 2008 Google Inc. All rights reserved. 3e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// http://code.google.com/p/protobuf/ 4e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// 5e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// Redistribution and use in source and binary forms, with or without 6e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// modification, are permitted provided that the following conditions are 7e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// met: 8e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// 9e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// * Redistributions of source code must retain the above copyright 10e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// notice, this list of conditions and the following disclaimer. 11e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// * Redistributions in binary form must reproduce the above 12e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// copyright notice, this list of conditions and the following disclaimer 13e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// in the documentation and/or other materials provided with the 14e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// distribution. 15e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// * Neither the name of Google Inc. nor the names of its 16e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// contributors may be used to endorse or promote products derived from 17e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// this software without specific prior written permission. 18e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// 19e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 31e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// Author: kenton@google.com (Kenton Varda) 32e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// Based on original Protocol Buffers design by 33e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville// Sanjay Ghemawat, Jeff Dean, and others. 34e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 35e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__ 36e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__ 37e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 38e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville#include <map> 39e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville#include <string> 40e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville#include <google/protobuf/compiler/javamicro/javamicro_field.h> 41e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 42e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Savillenamespace google { 43e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Savillenamespace protobuf { 44e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Savillenamespace compiler { 45e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Savillenamespace javamicro { 46e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 47e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Savilleclass MessageFieldGenerator : public FieldGenerator { 48e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville public: 49e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville explicit MessageFieldGenerator(const FieldDescriptor* descriptor, const Params& params); 50e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville ~MessageFieldGenerator(); 51e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 52e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville // implements FieldGenerator --------------------------------------- 53e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville void GenerateMembers(io::Printer* printer) const; 54e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville void GenerateMergingCode(io::Printer* printer) const; 55e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville void GenerateParsingCode(io::Printer* printer) const; 56e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville void GenerateSerializationCode(io::Printer* printer) const; 57e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville void GenerateSerializedSizeCode(io::Printer* printer) const; 58e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 59e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville string GetBoxedType() const; 60e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 61e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville private: 62e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville const FieldDescriptor* descriptor_; 63e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville map<string, string> variables_; 64e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 65e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); 66e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville}; 67e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 68e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Savilleclass RepeatedMessageFieldGenerator : public FieldGenerator { 69e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville public: 70e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville explicit RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, 71e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville const Params& params); 72e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville ~RepeatedMessageFieldGenerator(); 73e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 74e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville // implements FieldGenerator --------------------------------------- 75e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville void GenerateMembers(io::Printer* printer) const; 76e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville void GenerateMergingCode(io::Printer* printer) const; 77e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville void GenerateParsingCode(io::Printer* printer) const; 78e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville void GenerateSerializationCode(io::Printer* printer) const; 79e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville void GenerateSerializedSizeCode(io::Printer* printer) const; 80e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 81e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville string GetBoxedType() const; 82e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 83e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville private: 84e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville const FieldDescriptor* descriptor_; 85e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville map<string, string> variables_; 86e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 87e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); 88e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville}; 89e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 90e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville} // namespace javamicro 91e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville} // namespace compiler 92e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville} // namespace protobuf 93e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville 94e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville} // namespace google 95e2d542951c059563a3b7f74c257dac4f222d9dc5Wink Saville#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__ 96