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 | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame] | 17 | #ifndef ANNOTATION_H_ |
| 18 | |
| 19 | #define ANNOTATION_H_ |
| 20 | |
| 21 | #include <android-base/macros.h> |
| 22 | |
| 23 | #include <string> |
| 24 | #include <utils/KeyedVector.h> |
| 25 | |
| 26 | namespace android { |
| 27 | |
| 28 | struct Formatter; |
Zhuoyao Zhang | 5158db4 | 2016-08-10 10:25:20 -0700 | [diff] [blame] | 29 | using AnnotationParamVector = |
| 30 | DefaultKeyedVector<std::string, std::vector<std::string> *>; |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame] | 31 | |
| 32 | struct Annotation { |
Zhuoyao Zhang | 5158db4 | 2016-08-10 10:25:20 -0700 | [diff] [blame] | 33 | Annotation(const char *name, AnnotationParamVector *params); |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame] | 34 | |
| 35 | std::string name() const; |
Zhuoyao Zhang | 5158db4 | 2016-08-10 10:25:20 -0700 | [diff] [blame] | 36 | const AnnotationParamVector ¶ms() const; |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame] | 37 | |
| 38 | void dump(Formatter &out) const; |
| 39 | |
| 40 | private: |
| 41 | std::string mName; |
Zhuoyao Zhang | 5158db4 | 2016-08-10 10:25:20 -0700 | [diff] [blame] | 42 | AnnotationParamVector *mParamsByName; |
Andreas Huber | 3599d92 | 2016-08-09 10:42:57 -0700 | [diff] [blame] | 43 | |
| 44 | DISALLOW_COPY_AND_ASSIGN(Annotation); |
| 45 | }; |
| 46 | |
| 47 | } // namespace android |
| 48 | |
| 49 | #endif // ANNOTATION_H_ |