blob: 857f3a3b678fb8109724f7b59e951dd9e54134a9 [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 NAMED_TYPE_H_
18
19#define NAMED_TYPE_H_
20
Yifan Honga4b53d02016-10-31 17:29:10 -070021#include "Location.h"
22#include "Type.h"
Andreas Huber31629bc2016-08-03 09:06:40 -070023
Steven Moreland7ae3d542017-01-18 16:46:01 -080024#include <hidl-util/FQName.h>
25
Andreas Huberc9410c72016-07-28 12:18:40 -070026#include <string>
27
28namespace android {
29
30struct NamedType : public Type {
Timur Iskhakov565b0132017-09-06 18:07:11 -070031 NamedType(const char* localName, const FQName& fullName, const Location& loc, Scope* parent);
Andreas Huber31629bc2016-08-03 09:06:40 -070032
Andreas Huber39fa7182016-08-19 14:27:33 -070033 bool isNamedType() const override;
34
Andreas Huberbfd76212016-08-09 11:12:16 -070035 const FQName &fqName() const;
Steven Moreland979e0992016-09-07 09:18:08 -070036
Andreas Huber0e00de42016-08-03 09:56:02 -070037 std::string localName() const;
Steven Moreland979e0992016-09-07 09:18:08 -070038
39 /* short for fqName().cppName() */
Andreas Huber31629bc2016-08-03 09:06:40 -070040 std::string fullName() const;
Steven Moreland979e0992016-09-07 09:18:08 -070041 /* short for fqName().fullJavaName() */
Andreas Huber2831d512016-08-15 09:33:47 -070042 std::string fullJavaName() const;
Andreas Huberc9410c72016-07-28 12:18:40 -070043
Timur Iskhakova881c082017-07-25 15:12:07 -070044 const Location& location() const;
Yifan Honga4b53d02016-10-31 17:29:10 -070045
Yifan Hongf5cc2f72017-01-04 18:02:34 -080046 void emitDump(
47 Formatter &out,
48 const std::string &streamName,
49 const std::string &name) const override;
50
Timur Iskhakovcb0ba522017-07-17 20:01:37 -070051 private:
Timur Iskhakova881c082017-07-25 15:12:07 -070052 const std::string mLocalName;
Timur Iskhakov565b0132017-09-06 18:07:11 -070053 const FQName mFullName;
Timur Iskhakova881c082017-07-25 15:12:07 -070054 const Location mLocation;
Andreas Huberc9410c72016-07-28 12:18:40 -070055
56 DISALLOW_COPY_AND_ASSIGN(NamedType);
57};
58
59} // namespace android
60
61#endif // NAMED_TYPE_H_
62