blob: 965b7866c32c3d07898143c9f2e0eac8590b49c4 [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,
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 isJavaCompatible() const override;
54
55 bool needsEmbeddedReadWrite() const override;
56 bool resultNeedsDeref() const override;
57
58private:
59 std::string mName;
60
61 DISALLOW_COPY_AND_ASSIGN(PredefinedType);
62};
63
64} // namespace android
65
66#endif // PREDEFINED_TYPE_H_