blob: 95d7f7175694281995d1c3f83d8cdaa39962e7b6 [file] [log] [blame]
Andreas Huber4b2cf352016-08-31 13:58:19 -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
17#ifndef PREDEFINED_TYPE_H_
18
19#define PREDEFINED_TYPE_H_
20
21#include "Type.h"
22
23namespace android {
24
25struct PredefinedType : public Type {
26 PredefinedType(const char *name);
27
Steven Moreland979e0992016-09-07 09:18:08 -070028 std::string getCppType(StorageMode mode,
29 std::string *extra,
30 bool specifyNamespaces) const override;
Andreas Huber4b2cf352016-08-31 13:58:19 -070031 std::string getJavaType() const override;
32
33 void emitReaderWriter(
34 Formatter &out,
35 const std::string &name,
36 const std::string &parcelObj,
37 bool parcelObjIsPointer,
38 bool isReader,
39 ErrorMode mode) const override;
40
41 void emitReaderWriterEmbedded(
42 Formatter &out,
43 const std::string &name,
44 bool nameIsPointer,
45 const std::string &parcelObj,
46 bool parcelObjIsPointer,
47 bool isReader,
48 ErrorMode mode,
49 const std::string &parentName,
50 const std::string &offsetText) const override;
51
52 bool isJavaCompatible() const override;
53
54 bool needsEmbeddedReadWrite() const override;
55 bool resultNeedsDeref() const override;
56
57private:
58 std::string mName;
59
60 DISALLOW_COPY_AND_ASSIGN(PredefinedType);
61};
62
63} // namespace android
64
65#endif // PREDEFINED_TYPE_H_