blob: 5ebba3ebf3bcd356025f66d5d901bb2835a5ae28 [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 TYPE_DEF_H_
18
19#define TYPE_DEF_H_
20
Steven Morelandd537ab02016-09-12 10:32:01 -070021#include "NamedType.h"
Andreas Huberc9410c72016-07-28 12:18:40 -070022
23namespace android {
24
Steven Morelandd537ab02016-09-12 10:32:01 -070025struct TypeDef : public NamedType {
Timur Iskhakov565b0132017-09-06 18:07:11 -070026 TypeDef(const char* localName, const FQName& fullName, const Location& location, Scope* parent,
Timur Iskhakov505316c2017-08-05 03:38:59 +000027 const Reference<Type>& type);
Andreas Huberc9410c72016-07-28 12:18:40 -070028
Andreas Huber737080b2016-08-02 15:38:04 -070029 const ScalarType *resolveToScalarType() const override;
30
Steven Moreland0ecc7b82017-07-19 12:59:23 -070031 std::string typeName() const override;
32
Timur Iskhakov24e605b2017-08-30 14:02:55 -070033 Type* referencedType();
34 const Type* referencedType() const;
Andreas Huberc9410c72016-07-28 12:18:40 -070035
Andreas Huber5a545442016-08-03 10:44:56 -070036 bool isInterface() const override;
Andreas Huber8d3ac0c2016-08-04 14:49:23 -070037 bool isEnum() const override;
38 bool isTypeDef() const override;
Andreas Huberbb797e42016-08-03 12:53:02 -070039 bool needsEmbeddedReadWrite() const override;
40 bool resultNeedsDeref() const override;
41
Timur Iskhakovdbaed332017-08-31 16:33:41 -070042 const Type* resolve() const override;
43
Timur Iskhakov542920e2017-08-30 21:31:18 -070044 std::vector<const Reference<Type>*> getReferences() const override;
Timur Iskhakov542920e2017-08-30 21:31:18 -070045
Steven Moreland6ec9eb92018-02-16 14:21:49 -080046 void emitTypeDeclarations(Formatter& out) const override;
Steven Moreland2a55e052016-09-27 10:14:24 -070047
Timur Iskhakov505316c2017-08-05 03:38:59 +000048 private:
49 Reference<Type> mReferencedType;
Andreas Huberc9410c72016-07-28 12:18:40 -070050
51 DISALLOW_COPY_AND_ASSIGN(TypeDef);
52};
53
54} // namespace android
55
56#endif // TYPE_DEF_H_
57