Andreas Huber | 1aec397 | 2016-08-26 09:26:32 -0700 | [diff] [blame] | 1 | /* |
| 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 Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 17 | #ifndef NAMED_TYPE_H_ |
| 18 | |
| 19 | #define NAMED_TYPE_H_ |
| 20 | |
Yifan Hong | a4b53d0 | 2016-10-31 17:29:10 -0700 | [diff] [blame] | 21 | #include "Location.h" |
| 22 | #include "Type.h" |
Andreas Huber | 31629bc | 2016-08-03 09:06:40 -0700 | [diff] [blame] | 23 | |
Steven Moreland | 7ae3d54 | 2017-01-18 16:46:01 -0800 | [diff] [blame] | 24 | #include <hidl-util/FQName.h> |
| 25 | |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 26 | #include <string> |
| 27 | |
| 28 | namespace android { |
| 29 | |
| 30 | struct NamedType : public Type { |
Timur Iskhakov | 565b013 | 2017-09-06 18:07:11 -0700 | [diff] [blame] | 31 | NamedType(const char* localName, const FQName& fullName, const Location& loc, Scope* parent); |
Andreas Huber | 31629bc | 2016-08-03 09:06:40 -0700 | [diff] [blame] | 32 | |
Andreas Huber | 39fa718 | 2016-08-19 14:27:33 -0700 | [diff] [blame] | 33 | bool isNamedType() const override; |
| 34 | |
Andreas Huber | bfd7621 | 2016-08-09 11:12:16 -0700 | [diff] [blame] | 35 | const FQName &fqName() const; |
Steven Moreland | 979e099 | 2016-09-07 09:18:08 -0700 | [diff] [blame] | 36 | |
Andreas Huber | 0e00de4 | 2016-08-03 09:56:02 -0700 | [diff] [blame] | 37 | std::string localName() const; |
Steven Moreland | 979e099 | 2016-09-07 09:18:08 -0700 | [diff] [blame] | 38 | |
| 39 | /* short for fqName().cppName() */ |
Andreas Huber | 31629bc | 2016-08-03 09:06:40 -0700 | [diff] [blame] | 40 | std::string fullName() const; |
Steven Moreland | 979e099 | 2016-09-07 09:18:08 -0700 | [diff] [blame] | 41 | /* short for fqName().cppLocalName() */ |
| 42 | std::string partialCppName() const; |
| 43 | /* short for fqName().fullJavaName() */ |
Andreas Huber | 2831d51 | 2016-08-15 09:33:47 -0700 | [diff] [blame] | 44 | std::string fullJavaName() const; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 45 | |
Timur Iskhakov | a881c08 | 2017-07-25 15:12:07 -0700 | [diff] [blame] | 46 | const Location& location() const; |
Yifan Hong | a4b53d0 | 2016-10-31 17:29:10 -0700 | [diff] [blame] | 47 | |
Yifan Hong | f5cc2f7 | 2017-01-04 18:02:34 -0800 | [diff] [blame] | 48 | void emitDump( |
| 49 | Formatter &out, |
| 50 | const std::string &streamName, |
| 51 | const std::string &name) const override; |
| 52 | |
Timur Iskhakov | cb0ba52 | 2017-07-17 20:01:37 -0700 | [diff] [blame] | 53 | private: |
Timur Iskhakov | a881c08 | 2017-07-25 15:12:07 -0700 | [diff] [blame] | 54 | const std::string mLocalName; |
Timur Iskhakov | 565b013 | 2017-09-06 18:07:11 -0700 | [diff] [blame] | 55 | const FQName mFullName; |
Timur Iskhakov | a881c08 | 2017-07-25 15:12:07 -0700 | [diff] [blame] | 56 | const Location mLocation; |
Andreas Huber | c9410c7 | 2016-07-28 12:18:40 -0700 | [diff] [blame] | 57 | |
| 58 | DISALLOW_COPY_AND_ASSIGN(NamedType); |
| 59 | }; |
| 60 | |
| 61 | } // namespace android |
| 62 | |
| 63 | #endif // NAMED_TYPE_H_ |
| 64 | |