blob: fc9b6632a2dc5939bd1103b07eb6c522f6239f54 [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 Huber3599d922016-08-09 10:42:57 -070017#ifndef ANNOTATION_H_
18
19#define ANNOTATION_H_
20
21#include <android-base/macros.h>
Steven Morelandd537ab02016-09-12 10:32:01 -070022#include <map>
Andreas Huber3599d922016-08-09 10:42:57 -070023#include <string>
Andreas Huber3599d922016-08-09 10:42:57 -070024
25namespace android {
26
27struct Formatter;
Steven Morelandd537ab02016-09-12 10:32:01 -070028
29struct AnnotationParam {
30 AnnotationParam(const std::string &name,
31 std::vector<std::string> *values);
32
33 const std::string &getName() const;
34 const std::vector<std::string> *getValues() const;
35
36private:
37 const std::string mName;
38 std::vector<std::string> *mValues;
39};
40
41using AnnotationParamVector = std::vector<const AnnotationParam*>;
Andreas Huber3599d922016-08-09 10:42:57 -070042
43struct Annotation {
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070044 Annotation(const char *name, AnnotationParamVector *params);
Andreas Huber3599d922016-08-09 10:42:57 -070045
46 std::string name() const;
Zhuoyao Zhang5158db42016-08-10 10:25:20 -070047 const AnnotationParamVector &params() const;
Steven Morelandd537ab02016-09-12 10:32:01 -070048 const AnnotationParam *getParam(const std::string &name);
Andreas Huber3599d922016-08-09 10:42:57 -070049
50 void dump(Formatter &out) const;
51
52private:
53 std::string mName;
Steven Morelandd537ab02016-09-12 10:32:01 -070054 AnnotationParamVector *mParams;
Andreas Huber3599d922016-08-09 10:42:57 -070055
56 DISALLOW_COPY_AND_ASSIGN(Annotation);
57};
58
59} // namespace android
60
61#endif // ANNOTATION_H_