blob: 84c9441b55a8d520a855259770e10828ab34844f [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
Andreas Huber4bcf97d2016-08-30 11:27:49 -070028 void addNamedTypesToSet(std::set<const FQName> &set) const override;
Steven Moreland979e0992016-09-07 09:18:08 -070029 std::string getCppType(StorageMode mode,
30 std::string *extra,
31 bool specifyNamespaces) const override;
Andreas Huber4b2cf352016-08-31 13:58:19 -070032 std::string getJavaType() const override;
33
34 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,
Andreas Huberf9d49f12016-09-12 14:58:36 -070044 size_t depth,
Andreas Huber4b2cf352016-08-31 13:58:19 -070045 const std::string &name,
46 bool nameIsPointer,
47 const std::string &parcelObj,
48 bool parcelObjIsPointer,
49 bool isReader,
50 ErrorMode mode,
51 const std::string &parentName,
52 const std::string &offsetText) const override;
53
54 bool isJavaCompatible() const override;
55
56 bool needsEmbeddedReadWrite() const override;
57 bool resultNeedsDeref() const override;
58
59private:
60 std::string mName;
61
62 DISALLOW_COPY_AND_ASSIGN(PredefinedType);
63};
64
65} // namespace android
66
67#endif // PREDEFINED_TYPE_H_