javanano_message_field.h revision 102cfe65b9b9e2b458c3d0ec69d47e8fc40dc726
19a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// Protocol Buffers - Google's data interchange format
29a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// Copyright 2008 Google Inc.  All rights reserved.
39a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// http://code.google.com/p/protobuf/
49a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//
59a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// Redistribution and use in source and binary forms, with or without
69a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// modification, are permitted provided that the following conditions are
79a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// met:
89a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//
99a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//     * Redistributions of source code must retain the above copyright
109a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// notice, this list of conditions and the following disclaimer.
11e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org//     * Redistributions in binary form must reproduce the above
129a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// copyright notice, this list of conditions and the following disclaimer
139a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// in the documentation and/or other materials provided with the
149a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// distribution.
159a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//     * Neither the name of Google Inc. nor the names of its
169a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// contributors may be used to endorse or promote products derived from
179a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// this software without specific prior written permission.
1849d62206ededc5905d6121d42fdcce8ed665b2c0kjellander@webrtc.org//
199a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2024f07023ade0cf0058bd3546999068c902a94deaturaj@webrtc.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2124f07023ade0cf0058bd3546999068c902a94deaturaj@webrtc.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2224f07023ade0cf0058bd3546999068c902a94deaturaj@webrtc.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
239a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
249a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
259a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
269a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
279a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
289a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
299a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
309a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
319a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// Author: kenton@google.com (Kenton Varda)
329a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//  Based on original Protocol Buffers design by
339a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org//  Sanjay Ghemawat, Jeff Dean, and others.
349a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
359a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__
369a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#define GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__
379a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
389a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include <map>
399a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include <string>
409a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#include <google/protobuf/compiler/javanano/javanano_field.h>
419a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
429a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgnamespace google {
439a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgnamespace protobuf {
449a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgnamespace compiler {
45162639b2d729397915f9cbff160a828c1fc14c8fhenrik.lundin@webrtc.orgnamespace javanano {
469a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
479a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgclass MessageFieldGenerator : public FieldGenerator {
489a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org public:
499a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  explicit MessageFieldGenerator(const FieldDescriptor* descriptor, const Params& params);
509a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  ~MessageFieldGenerator();
519a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
529a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  // implements FieldGenerator ---------------------------------------
539a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateMembers(io::Printer* printer) const;
549a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateClearCode(io::Printer* printer) const;
559a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateMergingCode(io::Printer* printer) const;
569a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateSerializationCode(io::Printer* printer) const;
57f1a6eacbb485e8275cc81ad9d9170a75b65864eehenrik.lundin@webrtc.org  void GenerateSerializedSizeCode(io::Printer* printer) const;
589a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateEqualsCode(io::Printer* printer) const;
59162639b2d729397915f9cbff160a828c1fc14c8fhenrik.lundin@webrtc.org  void GenerateHashCodeCode(io::Printer* printer) const;
609a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
619a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org private:
629a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  const FieldDescriptor* descriptor_;
639a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  map<string, string> variables_;
649a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
659a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
669a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org};
679a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
689a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.orgclass RepeatedMessageFieldGenerator : public FieldGenerator {
699a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org public:
709a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  explicit RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor,
719a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org        const Params& params);
729a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  ~RepeatedMessageFieldGenerator();
739a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
749a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  // implements FieldGenerator ---------------------------------------
759a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateMembers(io::Printer* printer) const;
769a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateClearCode(io::Printer* printer) const;
779a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateMergingCode(io::Printer* printer) const;
789a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateSerializationCode(io::Printer* printer) const;
799a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateSerializedSizeCode(io::Printer* printer) const;
809a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateEqualsCode(io::Printer* printer) const;
819a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  void GenerateHashCodeCode(io::Printer* printer) const;
829a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
839a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org private:
849a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  const FieldDescriptor* descriptor_;
859a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  map<string, string> variables_;
869a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
879a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator);
889a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org};
899a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
909a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org}  // namespace javanano
919a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org}  // namespace compiler
929a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org}  // namespace protobuf
939a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org
949a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org}  // namespace google
959a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#endif  // GOOGLE_PROTOBUF_COMPILER_JAVA_MESSAGE_FIELD_H__
969a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org