|
1 | | -/* |
2 | | -Copyright (C) 2010 Mark Gordon |
3 | | -
|
4 | | -This program is free software; you can redistribute it and/or modify it under |
5 | | -the terms of the GNU General Public License as published by the Free Software |
6 | | -Foundation; either version 2 of the License, or (at your option) any later |
7 | | -version. |
8 | | -
|
9 | | -This program is distributed in the hope that it will be useful, but WITHOUT ANY |
10 | | -WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
11 | | -PARTICULAR PURPOSE. See the GNU General Public License for more details. |
12 | | -
|
13 | | -You should have received a copy of the GNU General Public License along with |
14 | | -this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
15 | | -Place, Suite 330, Boston, MA 02111-1307 USA |
16 | | -*/ |
17 | | -/*! \file annotation.h |
18 | | - * \brief Contains java annotation information |
19 | | - * |
20 | | - * Contains the classes for storing annotation information and an enumeration |
21 | | - * with the possible annotation visibilities. Annotations that are stored |
22 | | - * in a DexValue do not have associated visibilities and should have their |
23 | | - * corresponding visibility field set to VISIBILITY_NONE. |
24 | | - */ |
25 | | -#ifndef __DXCUT_ANNOTATION_H |
26 | | -#define __DXCUT_ANNOTATION_H |
27 | | -#include <dxcut/dex.h> |
28 | | -#include <dxcut/value.h> |
29 | | -#ifdef __cplusplus |
30 | | -extern "C" { |
31 | | -#endif |
32 | | - |
33 | | -typedef enum DexAnnotationVisibility { |
34 | | - /// Annotation is only meant to be visible at compile time. |
35 | | - VISIBILITY_BUILD = 0x00, |
36 | | - /// Annotation is visible at runtime. |
37 | | - VISIBILITY_RUNTIME = 0x01, |
38 | | - /// Annotation is visible at runtime but only to the underlying system. |
39 | | - VISIBILITY_SYSTEM = 0x02, |
40 | | - /// If this annotation came from a DexValue it won't have a visibility |
41 | | - /// associated with it. |
42 | | - VISIBILITY_NONE = 0xFF |
43 | | -} DexAnnotationVisibility; |
44 | | - |
45 | | - |
46 | | -typedef struct { |
47 | | - /// The name of the parameter. For annotations that contain one parameter this |
48 | | - /// is "value". |
49 | | - ref_str* name; |
50 | | - /// The value associated with this parameter. |
51 | | - DexValue value; |
52 | | -} DexNameValuePair; |
53 | | - |
54 | | -struct dex_annotation_t { |
55 | | - /// Indicates the intended visibility of this annotation. |
56 | | - DexAnnotationVisibility visibility; |
57 | | - |
58 | | - /// Indicates the type of the element. |
59 | | - ref_str* type; |
60 | | - |
61 | | - /// A sentinel-terminated list of name value pair parameters for this |
62 | | - /// annotation. |
63 | | - DexNameValuePair* parameters; |
64 | | -}; |
65 | | - |
66 | | -typedef struct dex_annotation_t DexAnnotation; |
67 | | - |
68 | | -/** \fn void dxc_free_annotation(DexAnnotation* annotation) |
69 | | - * \brief Frees all data allocated for this annotation. Does not attempt to |
70 | | - * free the passed pointer. |
71 | | - */ |
72 | | -extern |
73 | | -void dxc_free_annotation(DexAnnotation* annotation); |
74 | | - |
75 | | -/** \fn int dxc_is_sentinel_annotation(DexAnnotation* annotation) |
76 | | - * \brief Returns true if this annotation marks the end of an annotation list. |
77 | | - */ |
78 | | -extern |
79 | | -int dxc_is_sentinel_annotation(DexAnnotation* annotation); |
80 | | - |
81 | | -/** \fn void dxc_make_sentinel_annotation(DexAnnotation* annotation) |
82 | | - * \brief Marks the passed annotation as the end of a list. |
83 | | - */ |
84 | | -extern |
85 | | -void dxc_make_sentinel_annotation(DexAnnotation* annotation); |
86 | | - |
87 | | -/** \fn void dxc_free_parameter(DexNameValuePair* parameter) |
88 | | - * \brief Frees all data allocated for this name value pair. |
89 | | - * Does not attempt to free the passed pointer. |
90 | | - */ |
91 | | -extern |
92 | | -void dxc_free_parameter(DexNameValuePair* parameter); |
93 | | - |
94 | | -/** \fn int dxc_is_sentinel_parameter(DexNameValuePair* parameter) |
95 | | - * \brief Returns true if this name value pair marks the end of a |
96 | | - * name value pair list. |
97 | | - */ |
98 | | -extern |
99 | | -int dxc_is_sentinel_parameter(DexNameValuePair* parameter); |
100 | | - |
101 | | -/** \fn void dxc_make_sentinel_parameter(DexNameValuePair* parameter) |
102 | | - * \brief Marks the passed named value pair as the end of a list. |
103 | | - */ |
104 | | -extern |
105 | | -void dxc_make_sentinel_parameter(DexNameValuePair* parameter); |
106 | | - |
107 | | -#ifdef __cplusplus |
108 | | -} |
109 | | -#endif |
110 | | -#endif // __DXCUT_ANNOTATION_H |
| 1 | +/* |
| 2 | +Copyright (C) 2010 Mark Gordon |
| 3 | +
|
| 4 | +This program is free software; you can redistribute it and/or modify it under |
| 5 | +the terms of the GNU General Public License as published by the Free Software |
| 6 | +Foundation; either version 2 of the License, or (at your option) any later |
| 7 | +version. |
| 8 | +
|
| 9 | +This program is distributed in the hope that it will be useful, but WITHOUT ANY |
| 10 | +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 11 | +PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 12 | +
|
| 13 | +You should have received a copy of the GNU General Public License along with |
| 14 | +this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
| 15 | +Place, Suite 330, Boston, MA 02111-1307 USA |
| 16 | +*/ |
| 17 | +/*! \file annotation.h |
| 18 | + * \brief Contains java annotation information |
| 19 | + * |
| 20 | + * Contains the classes for storing annotation information and an enumeration |
| 21 | + * with the possible annotation visibilities. Annotations that are stored |
| 22 | + * in a DexValue do not have associated visibilities and should have their |
| 23 | + * corresponding visibility field set to VISIBILITY_NONE. |
| 24 | + */ |
| 25 | +#ifndef __DXCUT_ANNOTATION_H |
| 26 | +#define __DXCUT_ANNOTATION_H |
| 27 | +#include <dxcut/dex.h> |
| 28 | +#include <dxcut/value.h> |
| 29 | +#ifdef __cplusplus |
| 30 | +extern "C" { |
| 31 | +#endif |
| 32 | + |
| 33 | +typedef enum DexAnnotationVisibility { |
| 34 | + /// Annotation is only meant to be visible at compile time. |
| 35 | + VISIBILITY_BUILD = 0x00, |
| 36 | + /// Annotation is visible at runtime. |
| 37 | + VISIBILITY_RUNTIME = 0x01, |
| 38 | + /// Annotation is visible at runtime but only to the underlying system. |
| 39 | + VISIBILITY_SYSTEM = 0x02, |
| 40 | + /// If this annotation came from a DexValue it won't have a visibility |
| 41 | + /// associated with it. |
| 42 | + VISIBILITY_NONE = 0xFF |
| 43 | +} DexAnnotationVisibility; |
| 44 | + |
| 45 | + |
| 46 | +typedef struct { |
| 47 | + /// The name of the parameter. For annotations that contain one parameter this |
| 48 | + /// is "value". |
| 49 | + ref_str* name; |
| 50 | + /// The value associated with this parameter. |
| 51 | + DexValue value; |
| 52 | +} DexNameValuePair; |
| 53 | + |
| 54 | +struct dex_annotation_t { |
| 55 | + /// Indicates the intended visibility of this annotation. |
| 56 | + DexAnnotationVisibility visibility; |
| 57 | + |
| 58 | + /// Indicates the type of the element. |
| 59 | + ref_str* type; |
| 60 | + |
| 61 | + /// A sentinel-terminated list of name value pair parameters for this |
| 62 | + /// annotation. |
| 63 | + DexNameValuePair* parameters; |
| 64 | +}; |
| 65 | + |
| 66 | +typedef struct dex_annotation_t DexAnnotation; |
| 67 | + |
| 68 | +/** \fn void dxc_free_annotation(DexAnnotation* annotation) |
| 69 | + * \brief Frees all data allocated for this annotation. Does not attempt to |
| 70 | + * free the passed pointer. |
| 71 | + */ |
| 72 | +extern |
| 73 | +void dxc_free_annotation(DexAnnotation* annotation); |
| 74 | + |
| 75 | +/** \fn int dxc_is_sentinel_annotation(DexAnnotation* annotation) |
| 76 | + * \brief Returns true if this annotation marks the end of an annotation list. |
| 77 | + */ |
| 78 | +extern |
| 79 | +int dxc_is_sentinel_annotation(const DexAnnotation* annotation); |
| 80 | + |
| 81 | +/** \fn void dxc_make_sentinel_annotation(DexAnnotation* annotation) |
| 82 | + * \brief Marks the passed annotation as the end of a list. |
| 83 | + */ |
| 84 | +extern |
| 85 | +void dxc_make_sentinel_annotation(DexAnnotation* annotation); |
| 86 | + |
| 87 | +/** \fn void dxc_free_parameter(DexNameValuePair* parameter) |
| 88 | + * \brief Frees all data allocated for this name value pair. |
| 89 | + * Does not attempt to free the passed pointer. |
| 90 | + */ |
| 91 | +extern |
| 92 | +void dxc_free_parameter(DexNameValuePair* parameter); |
| 93 | + |
| 94 | +/** \fn int dxc_is_sentinel_parameter(DexNameValuePair* parameter) |
| 95 | + * \brief Returns true if this name value pair marks the end of a |
| 96 | + * name value pair list. |
| 97 | + */ |
| 98 | +extern |
| 99 | +int dxc_is_sentinel_parameter(const DexNameValuePair* parameter); |
| 100 | + |
| 101 | +/** \fn void dxc_make_sentinel_parameter(DexNameValuePair* parameter) |
| 102 | + * \brief Marks the passed named value pair as the end of a list. |
| 103 | + */ |
| 104 | +extern |
| 105 | +void dxc_make_sentinel_parameter(DexNameValuePair* parameter); |
| 106 | + |
| 107 | +#ifdef __cplusplus |
| 108 | +} |
| 109 | +#endif |
| 110 | +#endif // __DXCUT_ANNOTATION_H |
0 commit comments