javanano_primitive_field.h revision 64d8d8f89050c5ada85341f967af391f4716a7cb
145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// Protocol Buffers - Google's data interchange format 245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// Copyright 2008 Google Inc. All rights reserved. 345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// http://code.google.com/p/protobuf/ 445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// 545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// Redistribution and use in source and binary forms, with or without 645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// modification, are permitted provided that the following conditions are 745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// met: 845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// 945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// * Redistributions of source code must retain the above copyright 1045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// notice, this list of conditions and the following disclaimer. 1145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// * Redistributions in binary form must reproduce the above 1245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// copyright notice, this list of conditions and the following disclaimer 1345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// in the documentation and/or other materials provided with the 1445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// distribution. 1545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// * Neither the name of Google Inc. nor the names of its 1645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// contributors may be used to endorse or promote products derived from 1745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// this software without specific prior written permission. 1845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// 1945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 2245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 3145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// Author: kenton@google.com (Kenton Varda) 3245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// Based on original Protocol Buffers design by 3345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org// Sanjay Ghemawat, Jeff Dean, and others. 3445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 3545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_PRIMITIVE_FIELD_H__ 3645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define GOOGLE_PROTOBUF_COMPILER_JAVANANO_PRIMITIVE_FIELD_H__ 3745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 3845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <map> 3945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <string> 4045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <google/protobuf/compiler/javanano/javanano_field.h> 4145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 4245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgnamespace google { 4345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgnamespace protobuf { 4445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgnamespace compiler { 4545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgnamespace javanano { 4645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 4745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgclass PrimitiveFieldGenerator : public FieldGenerator { 4845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org public: 4945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org explicit PrimitiveFieldGenerator(const FieldDescriptor* descriptor, const Params ¶ms); 5045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org ~PrimitiveFieldGenerator(); 5145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 5245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org // implements FieldGenerator --------------------------------------- 5345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void GenerateMembers(io::Printer* printer) const; 5445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void GenerateMergingCode(io::Printer* printer) const; 5545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void GenerateParsingCode(io::Printer* printer) const; 5645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void GenerateSerializationCode(io::Printer* printer) const; 5745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void GenerateSerializedSizeCode(io::Printer* printer) const; 5845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 5945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org string GetBoxedType() const; 6045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 6145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org private: 6245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org const FieldDescriptor* descriptor_; 6345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org map<string, string> variables_; 6445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 6545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); 6645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}; 6745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 6845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgclass RepeatedPrimitiveFieldGenerator : public FieldGenerator { 6945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org public: 7045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org explicit RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, const Params& params); 7145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org ~RepeatedPrimitiveFieldGenerator(); 7245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 7345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org // implements FieldGenerator --------------------------------------- 7445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void GenerateMembers(io::Printer* printer) const; 7545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void GenerateMergingCode(io::Printer* printer) const; 7645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void GenerateParsingCode(io::Printer* printer) const; 7745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void GenerateSerializationCode(io::Printer* printer) const; 7845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void GenerateSerializedSizeCode(io::Printer* printer) const; 7945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 8045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org string GetBoxedType() const; 8145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 8245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org private: 8345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org const FieldDescriptor* descriptor_; 8445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org map<string, string> variables_; 8545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 8645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); 8745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}; 8845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 8945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} // namespace javanano 9045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} // namespace compiler 9145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} // namespace protobuf 9245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 9345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} // namespace google 9445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_PRIMITIVE_FIELD_H__ 9545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org