blob: c8c406370b028c3f647036363621c1d4d4beec7b [file] [log] [blame]
Christopher Wiley038485e2015-09-12 11:14:14 -07001/*
2 * Copyright (C) 2015, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Steven Moreland9fccf582018-08-27 20:36:27 -070017#pragma once
Adam Lesinskiffa16862014-01-23 18:17:42 -080018
Christopher Wileyf76b59a2016-01-29 11:32:11 -080019#include <memory>
Adam Lesinskiffa16862014-01-23 18:17:42 -080020#include <stdarg.h>
21#include <stdio.h>
Christopher Wileyae589972016-01-29 11:19:23 -080022#include <string>
23#include <vector>
Adam Lesinskiffa16862014-01-23 18:17:42 -080024
Adam Lesinskiffa16862014-01-23 18:17:42 -080025enum {
Christopher Wileyae589972016-01-29 11:19:23 -080026 PACKAGE_PRIVATE = 0x00000000,
27 PUBLIC = 0x00000001,
28 PRIVATE = 0x00000002,
29 PROTECTED = 0x00000003,
30 SCOPE_MASK = 0x00000003,
Adam Lesinskiffa16862014-01-23 18:17:42 -080031
Christopher Wileyae589972016-01-29 11:19:23 -080032 STATIC = 0x00000010,
33 FINAL = 0x00000020,
34 ABSTRACT = 0x00000040,
Adam Lesinskiffa16862014-01-23 18:17:42 -080035
Christopher Wileyae589972016-01-29 11:19:23 -080036 OVERRIDE = 0x00000100,
Adam Lesinskiffa16862014-01-23 18:17:42 -080037
Christopher Wileyae589972016-01-29 11:19:23 -080038 ALL_MODIFIERS = 0xffffffff
Adam Lesinskiffa16862014-01-23 18:17:42 -080039};
40
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070041namespace android {
42namespace aidl {
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070043class CodeWriter;
Christopher Wileydb154a52015-09-28 16:32:25 -070044} // namespace aidl
45} // namespace android
46
47namespace android {
48namespace aidl {
49namespace java {
50
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070051class Type;
52
Adam Lesinskiffa16862014-01-23 18:17:42 -080053// Write the modifiers that are set in both mod and mask
Christopher Wileyfdeb0f42015-09-11 15:38:22 -070054void WriteModifiers(CodeWriter* to, int mod, int mask);
Adam Lesinskiffa16862014-01-23 18:17:42 -080055
Jiyong Park176905e2018-07-04 22:29:41 +090056struct AstNode {
57 AstNode() = default;
58 virtual ~AstNode() = default;
Christopher Wileyae589972016-01-29 11:19:23 -080059 virtual void Write(CodeWriter* to) const = 0;
Jiyong Park176905e2018-07-04 22:29:41 +090060 std::string ToString();
Adam Lesinskiffa16862014-01-23 18:17:42 -080061};
62
Jiyong Park176905e2018-07-04 22:29:41 +090063struct ClassElement : public AstNode {
64 ClassElement() = default;
65 virtual ~ClassElement() = default;
66};
67
68struct Expression : public AstNode {
Christopher Wileyae589972016-01-29 11:19:23 -080069 virtual ~Expression() = default;
Adam Lesinskiffa16862014-01-23 18:17:42 -080070};
71
Christopher Wileyae589972016-01-29 11:19:23 -080072struct LiteralExpression : public Expression {
Christopher Wiley12e894a2016-01-29 11:55:07 -080073 std::string value;
Adam Lesinskiffa16862014-01-23 18:17:42 -080074
Chih-Hung Hsieh156a57f2016-06-02 16:17:28 -070075 explicit LiteralExpression(const std::string& value);
Christopher Wileyae589972016-01-29 11:19:23 -080076 virtual ~LiteralExpression() = default;
77 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -080078};
79
80// TODO: also escape the contents. not needed for now
Christopher Wileyae589972016-01-29 11:19:23 -080081struct StringLiteralExpression : public Expression {
Christopher Wiley12e894a2016-01-29 11:55:07 -080082 std::string value;
Adam Lesinskiffa16862014-01-23 18:17:42 -080083
Chih-Hung Hsieh156a57f2016-06-02 16:17:28 -070084 explicit StringLiteralExpression(const std::string& value);
Christopher Wileyae589972016-01-29 11:19:23 -080085 virtual ~StringLiteralExpression() = default;
86 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -080087};
88
Christopher Wileyae589972016-01-29 11:19:23 -080089struct Variable : public Expression {
90 const Type* type = nullptr;
Christopher Wiley12e894a2016-01-29 11:55:07 -080091 std::string name;
Christopher Wileyae589972016-01-29 11:19:23 -080092 int dimension = 0;
Adam Lesinskiffa16862014-01-23 18:17:42 -080093
Christopher Wileyae589972016-01-29 11:19:23 -080094 Variable() = default;
Christopher Wiley12e894a2016-01-29 11:55:07 -080095 Variable(const Type* type, const std::string& name);
96 Variable(const Type* type, const std::string& name, int dimension);
Christopher Wileyae589972016-01-29 11:19:23 -080097 virtual ~Variable() = default;
Adam Lesinskiffa16862014-01-23 18:17:42 -080098
Christopher Wileyae589972016-01-29 11:19:23 -080099 void WriteDeclaration(CodeWriter* to) const;
100 void Write(CodeWriter* to) const;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800101};
102
Christopher Wileyae589972016-01-29 11:19:23 -0800103struct FieldVariable : public Expression {
104 Expression* object;
105 const Type* clazz;
Christopher Wiley12e894a2016-01-29 11:55:07 -0800106 std::string name;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800107
Christopher Wiley12e894a2016-01-29 11:55:07 -0800108 FieldVariable(Expression* object, const std::string& name);
109 FieldVariable(const Type* clazz, const std::string& name);
Christopher Wileyae589972016-01-29 11:19:23 -0800110 virtual ~FieldVariable() = default;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800111
Christopher Wileyae589972016-01-29 11:19:23 -0800112 void Write(CodeWriter* to) const;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800113};
114
Christopher Wileyae589972016-01-29 11:19:23 -0800115struct Field : public ClassElement {
Christopher Wiley12e894a2016-01-29 11:55:07 -0800116 std::string comment;
Jiyong Parka6605ab2018-11-11 14:30:21 +0900117 std::vector<std::string> annotations;
Christopher Wileyae589972016-01-29 11:19:23 -0800118 int modifiers = 0;
119 Variable* variable = nullptr;
Christopher Wiley12e894a2016-01-29 11:55:07 -0800120 std::string value;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800121
Christopher Wileyae589972016-01-29 11:19:23 -0800122 Field() = default;
123 Field(int modifiers, Variable* variable);
124 virtual ~Field() = default;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800125
Christopher Wileyae589972016-01-29 11:19:23 -0800126 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800127};
128
Jiyong Park176905e2018-07-04 22:29:41 +0900129struct Statement : public AstNode {
Christopher Wileyae589972016-01-29 11:19:23 -0800130 virtual ~Statement() = default;
Jiyong Park176905e2018-07-04 22:29:41 +0900131};
132
133struct LiteralStatement : public Statement {
134 public:
135 LiteralStatement(const std::string& value);
136 virtual ~LiteralStatement() = default;
137 void Write(CodeWriter* to) const override;
138
139 private:
140 const std::string value_;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800141};
142
Christopher Wileyae589972016-01-29 11:19:23 -0800143struct StatementBlock : public Statement {
Christopher Wiley12e894a2016-01-29 11:55:07 -0800144 std::vector<Statement*> statements;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800145
Christopher Wileyae589972016-01-29 11:19:23 -0800146 StatementBlock() = default;
147 virtual ~StatementBlock() = default;
148 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800149
Christopher Wileyae589972016-01-29 11:19:23 -0800150 void Add(Statement* statement);
151 void Add(Expression* expression);
Adam Lesinskiffa16862014-01-23 18:17:42 -0800152};
153
Christopher Wileyae589972016-01-29 11:19:23 -0800154struct ExpressionStatement : public Statement {
155 Expression* expression;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800156
Chih-Hung Hsieh156a57f2016-06-02 16:17:28 -0700157 explicit ExpressionStatement(Expression* expression);
Christopher Wileyae589972016-01-29 11:19:23 -0800158 virtual ~ExpressionStatement() = default;
159 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800160};
161
Christopher Wileyae589972016-01-29 11:19:23 -0800162struct Assignment : public Expression {
163 Variable* lvalue;
164 Expression* rvalue;
165 const Type* cast;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800166
Christopher Wileyae589972016-01-29 11:19:23 -0800167 Assignment(Variable* lvalue, Expression* rvalue);
168 Assignment(Variable* lvalue, Expression* rvalue, const Type* cast);
169 virtual ~Assignment() = default;
170 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800171};
172
Christopher Wileyae589972016-01-29 11:19:23 -0800173struct MethodCall : public Expression {
174 Expression* obj = nullptr;
175 const Type* clazz = nullptr;
Christopher Wiley12e894a2016-01-29 11:55:07 -0800176 std::string name;
177 std::vector<Expression*> arguments;
178 std::vector<std::string> exceptions;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800179
Chih-Hung Hsieh156a57f2016-06-02 16:17:28 -0700180 explicit MethodCall(const std::string& name);
Christopher Wiley12e894a2016-01-29 11:55:07 -0800181 MethodCall(const std::string& name, int argc, ...);
182 MethodCall(Expression* obj, const std::string& name);
183 MethodCall(const Type* clazz, const std::string& name);
184 MethodCall(Expression* obj, const std::string& name, int argc, ...);
185 MethodCall(const Type* clazz, const std::string& name, int argc, ...);
Christopher Wileyae589972016-01-29 11:19:23 -0800186 virtual ~MethodCall() = default;
187 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800188
Christopher Wileyae589972016-01-29 11:19:23 -0800189 private:
190 void init(int n, va_list args);
Adam Lesinskiffa16862014-01-23 18:17:42 -0800191};
192
Christopher Wileyae589972016-01-29 11:19:23 -0800193struct Comparison : public Expression {
194 Expression* lvalue;
Christopher Wiley12e894a2016-01-29 11:55:07 -0800195 std::string op;
Christopher Wileyae589972016-01-29 11:19:23 -0800196 Expression* rvalue;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800197
Christopher Wiley12e894a2016-01-29 11:55:07 -0800198 Comparison(Expression* lvalue, const std::string& op, Expression* rvalue);
Christopher Wileyae589972016-01-29 11:19:23 -0800199 virtual ~Comparison() = default;
200 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800201};
202
Christopher Wileyae589972016-01-29 11:19:23 -0800203struct NewExpression : public Expression {
204 const Type* type;
Christopher Wiley12e894a2016-01-29 11:55:07 -0800205 std::vector<Expression*> arguments;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800206
Chih-Hung Hsieh156a57f2016-06-02 16:17:28 -0700207 explicit NewExpression(const Type* type);
Christopher Wileyae589972016-01-29 11:19:23 -0800208 NewExpression(const Type* type, int argc, ...);
209 virtual ~NewExpression() = default;
210 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800211
Christopher Wileyae589972016-01-29 11:19:23 -0800212 private:
213 void init(int n, va_list args);
Adam Lesinskiffa16862014-01-23 18:17:42 -0800214};
215
Christopher Wileyae589972016-01-29 11:19:23 -0800216struct NewArrayExpression : public Expression {
217 const Type* type;
218 Expression* size;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800219
Christopher Wileyae589972016-01-29 11:19:23 -0800220 NewArrayExpression(const Type* type, Expression* size);
221 virtual ~NewArrayExpression() = default;
222 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800223};
224
Christopher Wileyae589972016-01-29 11:19:23 -0800225struct Ternary : public Expression {
226 Expression* condition = nullptr;
227 Expression* ifpart = nullptr;
228 Expression* elsepart = nullptr;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800229
Christopher Wileyae589972016-01-29 11:19:23 -0800230 Ternary() = default;
231 Ternary(Expression* condition, Expression* ifpart, Expression* elsepart);
232 virtual ~Ternary() = default;
233 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800234};
235
Christopher Wileyae589972016-01-29 11:19:23 -0800236struct Cast : public Expression {
237 const Type* type = nullptr;
238 Expression* expression = nullptr;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800239
Christopher Wileyae589972016-01-29 11:19:23 -0800240 Cast() = default;
241 Cast(const Type* type, Expression* expression);
242 virtual ~Cast() = default;
243 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800244};
245
Christopher Wileyae589972016-01-29 11:19:23 -0800246struct VariableDeclaration : public Statement {
247 Variable* lvalue = nullptr;
248 const Type* cast = nullptr;
249 Expression* rvalue = nullptr;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800250
Chih-Hung Hsieh156a57f2016-06-02 16:17:28 -0700251 explicit VariableDeclaration(Variable* lvalue);
Christopher Wileyae589972016-01-29 11:19:23 -0800252 VariableDeclaration(Variable* lvalue, Expression* rvalue,
Yi Kong894d6ba2018-07-24 11:27:38 -0700253 const Type* cast = nullptr);
Christopher Wileyae589972016-01-29 11:19:23 -0800254 virtual ~VariableDeclaration() = default;
255 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800256};
257
Christopher Wileyae589972016-01-29 11:19:23 -0800258struct IfStatement : public Statement {
259 Expression* expression = nullptr;
260 StatementBlock* statements = new StatementBlock;
261 IfStatement* elseif = nullptr;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800262
Christopher Wileyae589972016-01-29 11:19:23 -0800263 IfStatement() = default;
264 virtual ~IfStatement() = default;
265 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800266};
267
Christopher Wileyae589972016-01-29 11:19:23 -0800268struct ReturnStatement : public Statement {
269 Expression* expression;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800270
Chih-Hung Hsieh156a57f2016-06-02 16:17:28 -0700271 explicit ReturnStatement(Expression* expression);
Christopher Wileyae589972016-01-29 11:19:23 -0800272 virtual ~ReturnStatement() = default;
273 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800274};
275
Christopher Wileyae589972016-01-29 11:19:23 -0800276struct TryStatement : public Statement {
277 StatementBlock* statements = new StatementBlock;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800278
Christopher Wileyae589972016-01-29 11:19:23 -0800279 TryStatement() = default;
280 virtual ~TryStatement() = default;
281 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800282};
283
Christopher Wileyae589972016-01-29 11:19:23 -0800284struct CatchStatement : public Statement {
285 StatementBlock* statements;
286 Variable* exception;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800287
Chih-Hung Hsieh156a57f2016-06-02 16:17:28 -0700288 explicit CatchStatement(Variable* exception);
Christopher Wileyae589972016-01-29 11:19:23 -0800289 virtual ~CatchStatement() = default;
290 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800291};
292
Christopher Wileyae589972016-01-29 11:19:23 -0800293struct FinallyStatement : public Statement {
294 StatementBlock* statements = new StatementBlock;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800295
Christopher Wileyae589972016-01-29 11:19:23 -0800296 FinallyStatement() = default;
297 virtual ~FinallyStatement() = default;
298 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800299};
300
Jiyong Park176905e2018-07-04 22:29:41 +0900301struct Case : public AstNode {
Christopher Wiley12e894a2016-01-29 11:55:07 -0800302 std::vector<std::string> cases;
Christopher Wileyae589972016-01-29 11:19:23 -0800303 StatementBlock* statements = new StatementBlock;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800304
Christopher Wileyae589972016-01-29 11:19:23 -0800305 Case() = default;
Chih-Hung Hsieh156a57f2016-06-02 16:17:28 -0700306 explicit Case(const std::string& c);
Christopher Wileyae589972016-01-29 11:19:23 -0800307 virtual ~Case() = default;
Jiyong Park176905e2018-07-04 22:29:41 +0900308 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800309};
310
Christopher Wileyae589972016-01-29 11:19:23 -0800311struct SwitchStatement : public Statement {
312 Expression* expression;
Christopher Wiley12e894a2016-01-29 11:55:07 -0800313 std::vector<Case*> cases;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800314
Chih-Hung Hsieh156a57f2016-06-02 16:17:28 -0700315 explicit SwitchStatement(Expression* expression);
Christopher Wileyae589972016-01-29 11:19:23 -0800316 virtual ~SwitchStatement() = default;
317 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800318};
319
Christopher Wileyae589972016-01-29 11:19:23 -0800320struct Break : public Statement {
321 Break() = default;
322 virtual ~Break() = default;
323 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800324};
325
Christopher Wileyae589972016-01-29 11:19:23 -0800326struct Method : public ClassElement {
Christopher Wiley12e894a2016-01-29 11:55:07 -0800327 std::string comment;
Jiyong Parka6605ab2018-11-11 14:30:21 +0900328 std::vector<std::string> annotations;
Christopher Wileyae589972016-01-29 11:19:23 -0800329 int modifiers = 0;
330 const Type* returnType = nullptr; // nullptr means constructor
331 size_t returnTypeDimension = 0;
Christopher Wiley12e894a2016-01-29 11:55:07 -0800332 std::string name;
333 std::vector<Variable*> parameters;
334 std::vector<const Type*> exceptions;
Christopher Wileyae589972016-01-29 11:19:23 -0800335 StatementBlock* statements = nullptr;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800336
Christopher Wileyae589972016-01-29 11:19:23 -0800337 Method() = default;
338 virtual ~Method() = default;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800339
Christopher Wileyae589972016-01-29 11:19:23 -0800340 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800341};
342
Steven Moreland5557f1c2018-07-02 13:50:23 -0700343struct LiteralClassElement : public ClassElement {
344 std::string element;
345
346 LiteralClassElement(std::string e) : element(e) {}
347 virtual ~LiteralClassElement() = default;
348
349 void Write(CodeWriter* to) const override;
350};
351
Christopher Wiley69b44cf2016-05-03 13:43:33 -0700352struct IntConstant : public ClassElement {
353 const std::string name;
Steven Moreland693640b2018-07-19 13:46:27 -0700354 const std::string value;
Casey Dahlind40e2fe2015-11-24 14:06:52 -0800355
Steven Moreland693640b2018-07-19 13:46:27 -0700356 IntConstant(const std::string& name, const std::string& value) : name(name), value(value) {}
Christopher Wiley69b44cf2016-05-03 13:43:33 -0700357 virtual ~IntConstant() = default;
358
359 void Write(CodeWriter* to) const override;
360};
361
362struct StringConstant : public ClassElement {
363 const std::string name;
364 const std::string value;
365
366 StringConstant(std::string name, std::string value)
367 : name(name), value(value) {}
368 ~StringConstant() override = default;
Casey Dahlind40e2fe2015-11-24 14:06:52 -0800369
Christopher Wileyae589972016-01-29 11:19:23 -0800370 void Write(CodeWriter* to) const override;
Casey Dahlind40e2fe2015-11-24 14:06:52 -0800371};
372
Christopher Wileyae589972016-01-29 11:19:23 -0800373struct Class : public ClassElement {
374 enum { CLASS, INTERFACE };
Adam Lesinskiffa16862014-01-23 18:17:42 -0800375
Christopher Wiley12e894a2016-01-29 11:55:07 -0800376 std::string comment;
Jiyong Parka6605ab2018-11-11 14:30:21 +0900377 std::vector<std::string> annotations;
Christopher Wileyae589972016-01-29 11:19:23 -0800378 int modifiers = 0;
379 int what = CLASS; // CLASS or INTERFACE
380 const Type* type = nullptr;
381 const Type* extends = nullptr;
Christopher Wiley12e894a2016-01-29 11:55:07 -0800382 std::vector<const Type*> interfaces;
383 std::vector<ClassElement*> elements;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800384
Christopher Wileyae589972016-01-29 11:19:23 -0800385 Class() = default;
386 virtual ~Class() = default;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800387
Christopher Wileyae589972016-01-29 11:19:23 -0800388 void Write(CodeWriter* to) const override;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800389};
390
Jiyong Park176905e2018-07-04 22:29:41 +0900391class Document : public AstNode {
Christopher Wileyf76b59a2016-01-29 11:32:11 -0800392 public:
393 Document(const std::string& comment,
394 const std::string& package,
395 const std::string& original_src,
396 std::unique_ptr<Class> clazz);
Christopher Wileyae589972016-01-29 11:19:23 -0800397 virtual ~Document() = default;
Jiyong Park176905e2018-07-04 22:29:41 +0900398 void Write(CodeWriter* to) const override;
Christopher Wileyf76b59a2016-01-29 11:32:11 -0800399
400 private:
401 std::string comment_;
402 std::string package_;
403 std::string original_src_;
404 std::unique_ptr<Class> clazz_;
Adam Lesinskiffa16862014-01-23 18:17:42 -0800405};
406
Christopher Wileydb154a52015-09-28 16:32:25 -0700407} // namespace java
Christopher Wileyfdeb0f42015-09-11 15:38:22 -0700408} // namespace aidl
409} // namespace android