18170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// Protocol Buffers - Google's data interchange format 28170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// Copyright 2008 Google Inc. All rights reserved. 38170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// http://code.google.com/p/protobuf/ 48170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// 58170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// Redistribution and use in source and binary forms, with or without 68170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// modification, are permitted provided that the following conditions are 78170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// met: 88170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// 98170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// * Redistributions of source code must retain the above copyright 108170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// notice, this list of conditions and the following disclaimer. 118170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// * Redistributions in binary form must reproduce the above 128170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// copyright notice, this list of conditions and the following disclaimer 138170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// in the documentation and/or other materials provided with the 148170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// distribution. 158170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// * Neither the name of Google Inc. nor the names of its 168170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// contributors may be used to endorse or promote products derived from 178170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// this software without specific prior written permission. 188170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// 198170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 208170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 218170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 228170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 238170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 248170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 258170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 268170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 278170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 288170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 298170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 308170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai 31b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_MAP_FIELD_H__ 32b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_MAP_FIELD_H__ 338170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai 34b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer#include <map> 35b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer#include <string> 36b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer#include <vector> 37b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer#include <google/protobuf/compiler/javanano/javanano_field.h> 388170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai 39b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammernamespace google { 40b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammernamespace protobuf { 41b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammernamespace compiler { 42b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammernamespace javanano { 438170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai 44b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammerclass MapFieldGenerator : public FieldGenerator { 45b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer public: 46b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer explicit MapFieldGenerator( 47b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer const FieldDescriptor* descriptor, const Params& params); 48b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer ~MapFieldGenerator(); 498170787391efcb6cc6a8babc1cce35d5b1aff420Max Cai 50b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer // implements FieldGenerator --------------------------------------- 51b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer void GenerateMembers(io::Printer* printer, bool lazy_init) const; 52b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer void GenerateClearCode(io::Printer* printer) const; 53b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer void GenerateMergingCode(io::Printer* printer) const; 54b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer void GenerateSerializationCode(io::Printer* printer) const; 55b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer void GenerateSerializedSizeCode(io::Printer* printer) const; 56b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer void GenerateEqualsCode(io::Printer* printer) const; 57b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer void GenerateHashCodeCode(io::Printer* printer) const; 58624c448fbef20a1a2fad2289f622b468c25763d1Max Cai 59b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer private: 60b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer const FieldDescriptor* descriptor_; 61b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer map<string, string> variables_; 62624c448fbef20a1a2fad2289f622b468c25763d1Max Cai 63b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator); 64b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer}; 65624c448fbef20a1a2fad2289f622b468c25763d1Max Cai 66b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer} // namespace javanano 67b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer} // namespace compiler 68b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer} // namespace protobuf 69b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer} // namespace google 70b0575e93e4c39dec69365b850088a1eb7f82c5b3Tamas Berghammer#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_MAP_FIELD_H__ 71