summaryrefslogtreecommitdiff
path: root/src/lib/eolian/database_var_api.c
blob: 45400f5c6ba0ef08dd7afc0db5e48f5615962967 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <Eina.h>
#include "eolian_database.h"

EAPI const Eolian_Variable *
eolian_variable_global_get_by_name(const char *name)
{
   if (!_globals) return NULL;
   Eina_Stringshare *shr = eina_stringshare_add(name);
   Eolian_Variable *v = eina_hash_find(_globals, shr);
   eina_stringshare_del(shr);
   return v;
}

EAPI const Eolian_Variable *
eolian_variable_constant_get_by_name(const char *name)
{
   if (!_constants) return NULL;
   Eina_Stringshare *shr = eina_stringshare_add(name);
   Eolian_Variable *v = eina_hash_find(_constants, shr);
   eina_stringshare_del(shr);
   return v;
}

EAPI Eina_Iterator *
eolian_variable_globals_get_by_file(const char *fname)
{
   if (!_globalsf) return NULL;
   Eina_Stringshare *shr = eina_stringshare_add(fname);
   Eina_List *l = eina_hash_find(_globalsf, shr);
   eina_stringshare_del(shr);
   if (!l) return NULL;
   return eina_list_iterator_new(l);
}

EAPI Eina_Iterator *
eolian_variable_constants_get_by_file(const char *fname)
{
   if (!_constantsf) return NULL;
   Eina_Stringshare *shr = eina_stringshare_add(fname);
   Eina_List *l = eina_hash_find(_constantsf, shr);
   eina_stringshare_del(shr);
   if (!l) return NULL;
   return eina_list_iterator_new(l);
}

EAPI Eolian_Variable_Type
eolian_variable_type_get(const Eolian_Variable *var)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(var, EOLIAN_VAR_UNKNOWN);
   return var->type;
}

EAPI Eina_Stringshare *
eolian_variable_description_get(const Eolian_Variable *var)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
   return var->comment;
}

EAPI const Eolian_Documentation *
eolian_variable_documentation_get(const Eolian_Variable *var)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
   return var->doc;
}

EAPI Eina_Stringshare *
eolian_variable_file_get(const Eolian_Variable *var)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
   return var->base.file;
}

EAPI const Eolian_Type *
eolian_variable_base_type_get(const Eolian_Variable *var)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
   return var->base_type;
}

EAPI const Eolian_Expression *
eolian_variable_value_get(const Eolian_Variable *var)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
   return var->value;
}

EAPI Eina_Stringshare *
eolian_variable_name_get(const Eolian_Variable *var)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
   return var->name;
}

EAPI Eina_Stringshare *
eolian_variable_full_name_get(const Eolian_Variable *var)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
   return var->full_name;
}

EAPI Eina_Iterator *
eolian_variable_namespaces_get(const Eolian_Variable *var)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(var, NULL);
   if (!var->namespaces) return NULL;
   return eina_list_iterator_new(var->namespaces);
}

EAPI Eina_Bool
eolian_variable_is_extern(const Eolian_Variable *var)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(var, EINA_FALSE);
   return var->is_extern;
}