blob: aa21df34f8eaa82cb23d7859a9fb8368447f87db [file] [log] [blame]
Andreas Huber1aec3972016-08-26 09:26:32 -07001/*
2 * Copyright (C) 2016 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
Andreas Huberc9410c72016-07-28 12:18:40 -070017#ifndef ARRAY_TYPE_H_
18
19#define ARRAY_TYPE_H_
20
21#include "Type.h"
22
23#include <string>
24
25namespace android {
26
27struct ArrayType : public Type {
28 ArrayType(Type *elementType, const char *dimension);
29
Andreas Huber881227d2016-08-02 14:20:21 -070030 std::string getCppType(StorageMode mode, std::string *extra) const override;
31
Andreas Huber2831d512016-08-15 09:33:47 -070032 std::string getJavaType() const override;
33
Andreas Huber881227d2016-08-02 14:20:21 -070034 void emitReaderWriter(
35 Formatter &out,
36 const std::string &name,
37 const std::string &parcelObj,
38 bool parcelObjIsPointer,
39 bool isReader,
40 ErrorMode mode) const override;
41
42 void emitReaderWriterEmbedded(
43 Formatter &out,
44 const std::string &name,
45 bool nameIsPointer,
46 const std::string &parcelObj,
47 bool parcelObjIsPointer,
48 bool isReader,
49 ErrorMode mode,
50 const std::string &parentName,
51 const std::string &offsetText) const override;
52
53 bool needsEmbeddedReadWrite() const override;
54
Andreas Huber2831d512016-08-15 09:33:47 -070055 void emitJavaReaderWriter(
56 Formatter &out,
57 const std::string &parcelObj,
58 const std::string &argName,
59 bool isReader) const override;
60
Andreas Huber85eabdb2016-08-25 11:24:49 -070061 void emitJavaFieldInitializer(
62 Formatter &out, const std::string &fieldName) const override;
63
64 void emitJavaFieldReaderWriter(
65 Formatter &out,
66 const std::string &blobName,
67 const std::string &fieldName,
68 const std::string &offset,
69 bool isReader) const override;
70
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070071 status_t emitVtsTypeDeclarations(Formatter &out) const override;
72
Andreas Huber70a59e12016-08-16 12:57:01 -070073 bool isJavaCompatible() const override;
74
Andreas Huber85eabdb2016-08-25 11:24:49 -070075 void getAlignmentAndSize(size_t *align, size_t *size) const override;
76
Andreas Huberc9410c72016-07-28 12:18:40 -070077private:
78 Type *mElementType;
79 std::string mDimension;
80
81 DISALLOW_COPY_AND_ASSIGN(ArrayType);
82};
83
84} // namespace android
85
86#endif // ARRAY_TYPE_H_
87