blob: 0e380fac73ca2d912d47726730a7ee815fc644ef [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;
45 std::vector<const Reference<Type>*> getStrongReferences() const override;
46
Steven Moreland2a55e052016-09-27 10:14:24 -070047 status_t emitTypeDeclarations(Formatter &out) const override;
48
Timur Iskhakov505316c2017-08-05 03:38:59 +000049 private:
50 Reference<Type> mReferencedType;
Andreas Huberc9410c72016-07-28 12:18:40 -070051
52 DISALLOW_COPY_AND_ASSIGN(TypeDef);
53};
54
55} // namespace android
56
57#endif // TYPE_DEF_H_
58