Steven Moreland | f1a35f7 | 2016-08-17 08:41:49 -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 | |
| 17 | #ifndef COMPOSITE_DECLARATION_H_ |
| 18 | #define COMPOSITE_DECLARATION_H_ |
| 19 | |
| 20 | #include "Declaration.h" |
| 21 | #include "Type.h" |
| 22 | |
| 23 | namespace android { |
| 24 | |
| 25 | struct CompositeDeclaration : Declaration { |
| 26 | CompositeDeclaration( |
| 27 | const Type::Qualifier::Qualification qualifier, |
| 28 | const std::string &name, |
| 29 | std::vector<android::Declaration *> *fieldDeclarations); |
| 30 | ~CompositeDeclaration(); |
| 31 | |
Steven Moreland | 95b4623 | 2016-09-20 14:46:55 -0700 | [diff] [blame^] | 32 | void setName(const std::string &name) override; |
| 33 | |
Steven Moreland | f1a35f7 | 2016-08-17 08:41:49 -0700 | [diff] [blame] | 34 | const Type::Qualifier::Qualification &getQualifier() const; |
| 35 | const std::vector<android::Declaration *>* getFieldDeclarations() const; |
| 36 | |
| 37 | static std::string type() { return "composite"; } |
| 38 | const std::string decType() const override { return type(); } |
| 39 | |
| 40 | void generateSource(Formatter &out) const override; |
| 41 | void processContents(AST &ast) override; |
| 42 | |
| 43 | void generateInterface(Formatter &out) const; |
| 44 | std::string getInterfaceName() const; |
| 45 | bool isInterface() const; |
| 46 | |
| 47 | void setEnumTypeName(const std::string &name); |
| 48 | |
| 49 | private: |
| 50 | const Type::Qualifier::Qualification mQualifier; |
| 51 | std::vector<android::Declaration *> *mFieldDeclarations; |
| 52 | |
| 53 | std::string mEnumTypeName; |
| 54 | |
| 55 | void generateBody(Formatter &out) const; |
| 56 | |
| 57 | DISALLOW_COPY_AND_ASSIGN(CompositeDeclaration); |
| 58 | }; |
| 59 | |
| 60 | } // namespace android |
| 61 | |
| 62 | #endif // COMPOSITE_DECLARATION_H_ |