Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

aqbanking / src / libs / aqbanking / types2 / balance.xml @ f4a16f5b

History | View | Annotate | Download (6.47 KB)

1
<?xml?>
2

    
3
<tm2>
4
  <type id="AB_BALANCE" type="pointer">
5
    <descr>
6
      This class holds time and amount of an account balance.
7
    </descr>
8

    
9
    <lang id="c">
10
      <identifier>AB_BALANCE</identifier>
11
      <prefix>AB_Balance</prefix>
12
      
13
      <baseFileName>balance</baseFileName>
14
      
15
      <flags>
16
        with_db
17
        with_xml
18
        with_refcount
19
        with_list1
20
      </flags>
21
      
22
      <headers>
23
        <header type="sys" loc="pre">aqbanking/error.h</header>
24
        <header type="sys" loc="pre">gwenhywfar/types.h</header>
25
        <header type="sys" loc="pre">gwenhywfar/gwendate.h</header>
26

    
27
        <header type="sys" loc="post">aqbanking/value.h</header>
28
      </headers>
29

    
30

    
31

    
32
      <inlines>
33

    
34
        <inline loc="end" access="public">
35
          <typeFlagsMask>with_list2</typeFlagsMask>
36
          <typeFlagsValue>with_list2</typeFlagsValue>
37
          <content>
38
             $(api) int $(struct_prefix)_List2_freeAll($(struct_type)_LIST2 *tl);
39
          </content>
40
        </inline>
41

    
42
        <inline loc="code">
43
          <typeFlagsMask>with_list2</typeFlagsMask>
44
          <typeFlagsValue>with_list2</typeFlagsValue>
45
          <content>
46

    
47
             static $(struct_type) *$(struct_prefix)_List2__freeAll_cb($(struct_type) *t, void *user_data) {
48
               $(struct_prefix)_free(t);
49
               return NULL;
50
             }
51

    
52

    
53
             int $(struct_prefix)_List2_freeAll($(struct_type)_LIST2 *tl) {
54
               if (tl) {
55
                 $(struct_prefix)_List2_ForEach(tl, $(struct_prefix)_List2__freeAll_cb, NULL);
56
                 $(struct_prefix)_List2_free(tl); 
57
               }
58
               else {
59
                 DBG_ERROR(AQBANKING_LOGDOMAIN, "List missing");
60
                 return GWEN_ERROR_INVALID;
61
               }
62
               return 0;
63
             }
64
          </content>
65
        </inline>
66

    
67

    
68
        <inline loc="end" access="public">
69
          <typeFlagsMask>with_list1</typeFlagsMask>
70
          <typeFlagsValue>with_list1</typeFlagsValue>
71
          <content>
72
             $(api) AB_BALANCE *$(struct_prefix)_List_FindFirstByType(const $(struct_type)_LIST *bl, int ty);
73
          </content>
74
        </inline>
75

    
76
        <inline loc="code">
77
          <typeFlagsMask>with_list1</typeFlagsMask>
78
          <typeFlagsValue>with_list1</typeFlagsValue>
79
          <content>
80
             AB_BALANCE *$(struct_prefix)_List_FindFirstByType(const $(struct_type)_LIST *bl, int ty) {
81
               AB_BALANCE *bal;
82
               
83
               assert(bl);
84
               bal=AB_Balance_List_First(bl);
85
               while(bal) {
86
                 if (ty==AB_Balance_TypeNone || ty==bal->type)
87
                   return bal;
88
                 bal=AB_Balance_List_Next(bal);
89
               }
90
               
91
               return NULL;
92
             }
93
          </content>
94
        </inline>
95

    
96

    
97
        <inline loc="end" access="public">
98
          <typeFlagsMask>with_list1</typeFlagsMask>
99
          <typeFlagsValue>with_list1</typeFlagsValue>
100
          <content>
101
             $(api) AB_BALANCE *$(struct_prefix)_List_FindNextByType($(struct_type) *bal, int ty);
102
          </content>
103
        </inline>
104

    
105
        <inline loc="code">
106
          <typeFlagsMask>with_list1</typeFlagsMask>
107
          <typeFlagsValue>with_list1</typeFlagsValue>
108
          <content>
109
             AB_BALANCE *$(struct_prefix)_List_FindNextByType($(struct_type) *bal, int ty) {
110
               assert(bal);
111
               bal=AB_Balance_List_Next(bal);
112
               while(bal) {
113
                 if (ty==AB_Balance_TypeNone || ty==bal->type)
114
                   return bal;
115
                 bal=AB_Balance_List_Next(bal);
116
               }
117
               
118
               return NULL;
119
             }
120
          </content>
121
        </inline>
122

    
123

    
124
        <inline loc="end" access="public">
125
          <typeFlagsMask>with_list1</typeFlagsMask>
126
          <typeFlagsValue>with_list1</typeFlagsValue>
127
          <content>
128
             $(api) AB_BALANCE *$(struct_prefix)_List_GetLatestByType(const $(struct_type)_LIST *bl, int ty);
129
          </content>
130
        </inline>
131

    
132
        <inline loc="code">
133
          <typeFlagsMask>with_list1</typeFlagsMask>
134
          <typeFlagsValue>with_list1</typeFlagsValue>
135
          <content>
136
             AB_BALANCE *$(struct_prefix)_List_GetLatestByType(const $(struct_type)_LIST *bl, int ty) {
137
               AB_BALANCE *lastBal=NULL;
138
               const GWEN_DATE *lastDt=NULL;
139
               AB_BALANCE *bal=NULL;
140
             
141
               bal=AB_Balance_List_First(bl);
142
               while(bal) {
143
                 if (ty==0 || (AB_Balance_GetType(bal)==ty)) {
144
                   const GWEN_DATE *dt;
145
             
146
                   if (lastBal && lastDt && (dt=AB_Balance_GetDate(bal))) {
147
                     if (GWEN_Date_Compare(dt, lastDt)>0) {
148
                       lastBal=bal;
149
                       lastDt=dt;
150
                     }
151
                   }
152
                   else {
153
                     lastBal=bal;
154
                     lastDt=AB_Balance_GetDate(bal);
155
                   }
156
                 }
157
                 bal=AB_Balance_List_Next(bal);
158
               }
159

    
160
               return lastBal;
161
             }
162
          </content>
163
        </inline>
164

    
165

    
166
      </inlines>
167

    
168

    
169
    </lang>
170

    
171
    <enums>
172

    
173
      <enum id="AB_BALANCE_TYPE" prefix="AB_Balance_Type" type="AB_BALANCE_TYPE">
174
        <item name="none" value="0"/>
175
        <item name="noted"/>
176
        <item name="booked"/>
177
        <item name="bankLine"/>
178
        <item name="disposable"/>
179
        <item name="temporary"/>
180
      </enum>
181

    
182
    </enums>
183

    
184
    <defines>
185

    
186
    </defines>
187

    
188

    
189
    <members>
190

    
191
      <member name="date" type="gwen_date" maxlen="16" >
192
        <aqdb_type>AQDB_DataType_String</aqdb_type>
193
        <access>public</access>
194
        <flags>own with_hash</flags>
195
        <setflags>const dup</setflags>
196
        <getflags>const</getflags>
197
        <default>NULL</default>
198
        <preset>NULL</preset>
199
      </member>
200

    
201
      <member name="value" type="AB_VALUE" maxlen="256" >
202
        <descr>
203
        </descr>
204
        <access>public</access>
205
        <flags>own</flags>
206
        <setflags>const dup</setflags>
207
        <getflags>const</getflags>
208
        <default>NULL</default>
209
        <preset>NULL</preset>
210
      </member>
211

    
212
      <member name="type" type="int" maxlen="32" enum="AB_BALANCE_TYPE" >
213
        <default>AB_Balance_TypeUnknown</default>
214
        <preset>AB_Balance_TypeUnknown</preset>
215
        <access>public</access>
216
        <flags>enum with_getbymember</flags>
217
        <setflags>none</setflags>
218
        <getflags>none</getflags>
219
      </member>
220

    
221
    </members>
222

    
223
    
224
  </type>
225
  
226
</tm2>
227