00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #if !defined(_GATLIST_H_)
00021 #define _GATLIST_H_ 1
00022
00023 #include <stdlib.h>
00024
00025 #include "GATObject.h"
00026 #include "GATType.h"
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #if defined(DOXYGEN)
00042 GATList_type
00043 GATList_type_Create();
00044 #endif
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 #if defined(DOXYGEN)
00063 GATList_type
00064 GATList_type_Equals(GATList_type const lhs, GATList_type const rhs,
00065 GATBool *isequal);
00066 #endif
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 #if defined(DOXYGEN)
00082 GATType
00083 GATList_type_GetType(GATList_type const lhs);
00084 #endif
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 #if defined(DOXYGEN)
00102 GATResult
00103 GATList_type_Clone(GATList_type const list, GATList *new_list);
00104 #endif
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 #if defined(DOXYGEN)
00123 GATResult
00124 GATList_type_GetInterface(GATList_const file, GATInterface iftype,
00125 void const **ifp);
00126 #endif
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 #if defined(DOXYGEN)
00147 void
00148 GATList_type_Destroy(GATList_type *list);
00149 #endif
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167 #if defined(DOXYGEN)
00168 size_t
00169 GATList_type_Size(GATList_type list);
00170 #endif
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 #if defined(DOXYGEN)
00189 GATList_type_Iterator
00190 GATList_type_Begin(GATList_type list);
00191 #endif
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213 #if defined(DOXYGEN)
00214 GATList_type_Iterator
00215 GATList_type_End(GATList_type list);
00216 #endif
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240 #if defined(DOXYGEN)
00241 GATList_type_Iterator
00242 GATList_type_Next(GATList_type_Iterator iter);
00243 #endif
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265 #if defined(DOXYGEN)
00266 GATList_type_Iterator
00267 GATList_type_Previous(GATList_type_Iterator iter);
00268 #endif
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296 #if defined(DOXYGEN)
00297 GATList_type_Iterator
00298 GATList_type_Insert(GATList_type list, GATList_type_Iterator where, type data);
00299 #endif
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324 #if defined(DOXYGEN)
00325 GATList_type_Iterator
00326 GATList_type_Erase(GATList_type list, GATList_type_Iterator where);
00327 #endif
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349 #if defined(DOXYGEN)
00350 type *
00351 GATList_type_Get(GATList_type_Iterator where);
00352 #endif
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386 #if defined(DOXYGEN)
00387 GATList_type_Iterator GATList_type_Splice(
00388 GATList_type dest, GATList_type_Iterator here,
00389 GATList_type src, GATList_type_Iterator first, GATList_type_Iterator last,
00390 size_t count);
00391 #endif
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411 #if defined(DOXYGEN)
00412 GATResult
00413 GATList_type_Serialise(GATList list, GATObject stream, GATBool clear_dirty);
00414 #endif
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435 #if defined(DOXYGEN)
00436 GATList GATList_type_DeSerialise(GATContext context, GATObject stream,
00437 GATResult *result);
00438 #endif
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455 #if defined(DOXYGEN)
00456 GATResult GATList_type_GetIsDirty(GATList_const list, GATBool *isdirty);
00457 #endif
00458
00459 #if (__STDC_VERSION__ >= 199901) || defined(__cplusplus)
00460 #define GAT_INLINE_FUNC inline
00461 #else
00462 #define GAT_INLINE_FUNC static
00463 #endif
00464
00465
00466
00467
00468
00469
00470
00471 #define GATHANDLE_DECLARE(handletype) \
00472 struct handletype ## _handle { int dummy; }; \
00473 typedef struct handletype ## _handle *handletype; \
00474 typedef struct handletype ## _handle const *handletype ## _const \
00475
00476
00477
00478 #define GATLIST_PROTOTYPES(qualifier, type, listtype) \
00479 \
00480 GATOBJECT_DECLARE_CONVERTERS_QUALIFIED(qualifier, listtype); \
00481 \
00482 qualifier listtype listtype ## _Create(void); \
00483 qualifier GATResult listtype ## _Equals(listtype ## _const lhs, \
00484 listtype ## _const rhs, GATBool *isequal); \
00485 qualifier void listtype ## _Destroy(listtype *list); \
00486 qualifier GATType listtype ## _GetType(listtype ## _const object); \
00487 qualifier GATResult listtype ## _Clone(listtype ## _const object, \
00488 listtype *new_obj); \
00489 qualifier GATResult listtype ## _GetInterface(listtype ## _const file, \
00490 GATInterface iftype, void const **ifp); \
00491 \
00492 qualifier size_t listtype ## _Size(listtype ## _const list); \
00493 qualifier listtype ## _Iterator listtype ## _Begin(listtype ## _const list); \
00494 qualifier listtype ## _Iterator listtype ## _End(listtype ## _const list); \
00495 qualifier listtype ## _Iterator listtype ## _Next( \
00496 listtype ## _Iterator_const iterator); \
00497 qualifier listtype ## _Iterator listtype ## _Previous( \
00498 listtype ## _Iterator_const iterator); \
00499 qualifier listtype ## _Iterator listtype ## _Insert( \
00500 listtype list, listtype ## _Iterator iterator, type const data); \
00501 qualifier listtype ## _Iterator listtype ## _Erase( \
00502 listtype list, listtype ## _Iterator iterator); \
00503 qualifier type *listtype ## _Get( \
00504 listtype ## _Iterator_const iterator); \
00505 \
00506 qualifier listtype ## _Iterator_const listtype ## _Splice( \
00507 listtype dest, listtype ## _Iterator here, \
00508 listtype src, listtype ## _Iterator first, \
00509 listtype ## _Iterator last, size_t count); \
00510 \
00511 qualifier GATResult listtype ## _Serialise(listtype list, \
00512 GATObject stream, GATBool clear_dirty); \
00513 qualifier listtype listtype ## _DeSerialise(GATContext context, \
00514 GATObject stream, GATResult *result); \
00515 qualifier GATResult listtype ## _GetIsDirty(listtype ## _const list, \
00516 GATBool *isdirty) \
00517
00518
00519
00520 #define GATLIST_IMPLEMENT(qualifier, type, listtype, gattype) \
00521 \
00522 qualifier listtype listtype ## _Create(void) \
00523 { \
00524 return (listtype) GATList_i_Create(gattype, sizeof(type)); \
00525 } \
00526 \
00527 qualifier GATResult listtype ## _Equals(listtype ## _const lhs, \
00528 listtype ## _const rhs, GATBool *isequal) \
00529 { \
00530 return GATList_i_Equals((GATList_const) lhs, (GATList_const) rhs, \
00531 isequal); \
00532 } \
00533 \
00534 qualifier void listtype ## _Destroy(listtype *list) \
00535 { \
00536 GATList_i_Destroy((GATList *) list); \
00537 } \
00538 \
00539 qualifier GATType listtype ## _GetType(listtype ## _const list) \
00540 { \
00541 return GATList_i_GetType((GATList_const) list); \
00542 } \
00543 \
00544 qualifier GATResult listtype ## _Clone(listtype ## _const list, \
00545 listtype *new_list) \
00546 { \
00547 return GATList_i_Clone((GATList_const) list, (GATList *)new_list); \
00548 } \
00549 \
00550 qualifier GATResult listtype ## _GetInterface(listtype ## _const list, \
00551 GATInterface iftype, void const **ifp) \
00552 { \
00553 return GATList_i_GetInterface((GATList_const) list, iftype, ifp); \
00554 } \
00555 \
00556 qualifier size_t listtype ## _Size(listtype ## _const list) \
00557 { \
00558 return GATList_i_Size((GATList_const) list); \
00559 } \
00560 \
00561 qualifier listtype ## _Iterator listtype ## _Begin(listtype ## _const list) \
00562 { \
00563 return (listtype ## _Iterator) GATList_i_Begin((GATList_const)list); \
00564 } \
00565 \
00566 qualifier listtype ## _Iterator listtype ## _End(listtype ## _const list) \
00567 { \
00568 return (listtype ## _Iterator) GATList_i_End((GATList_const) list); \
00569 } \
00570 \
00571 qualifier listtype ## _Iterator listtype ## _Next( \
00572 listtype ## _Iterator_const iterator) \
00573 { \
00574 return (listtype ## _Iterator) GATList_i_Next( \
00575 (GATListIterator_const) iterator); \
00576 } \
00577 \
00578 qualifier listtype ## _Iterator listtype ## _Previous( \
00579 listtype ## _Iterator_const iterator) \
00580 { \
00581 return (listtype ## _Iterator) GATList_i_Previous( \
00582 (GATListIterator_const) iterator); \
00583 } \
00584 \
00585 qualifier listtype ## _Iterator listtype ## _Insert( \
00586 listtype list, listtype ## _Iterator iterator, type const data) \
00587 { \
00588 return (listtype ## _Iterator) GATList_i_Insert((GATList)list, \
00589 (GATListIterator) iterator, &data); \
00590 } \
00591 \
00592 qualifier listtype ## _Iterator listtype ## _Erase( \
00593 listtype list, listtype ## _Iterator iterator) \
00594 { \
00595 return (listtype ## _Iterator) GATList_i_Erase((GATList)list, \
00596 (GATListIterator) iterator); \
00597 } \
00598 \
00599 qualifier type *listtype ## _Get( \
00600 listtype ## _Iterator_const iterator) \
00601 { \
00602 return (type *) GATList_i_Get((GATListIterator_const) iterator); \
00603 } \
00604 \
00605 qualifier listtype ## _Iterator_const listtype ## _Splice( \
00606 listtype dest, listtype ## _Iterator here, \
00607 listtype src, listtype ## _Iterator first, \
00608 listtype ## _Iterator last, size_t count) \
00609 { \
00610 return (listtype ## _Iterator_const) GATList_i_Splice( \
00611 (GATList) dest, (GATListIterator) here, \
00612 (GATList) src, (GATListIterator) first, \
00613 (GATListIterator) last, count); \
00614 } \
00615 \
00616 qualifier GATResult listtype ## _Serialise(listtype list, \
00617 GATObject stream, GATBool clear_dirty) \
00618 { \
00619 return GATList_i_Serialise((GATList) list, stream, clear_dirty); \
00620 } \
00621 \
00622 qualifier listtype listtype ## _DeSerialise(GATContext context, \
00623 GATObject stream, GATResult *result) \
00624 { \
00625 return (listtype) GATList_i_DeSerialise(context, stream, result); \
00626 } \
00627 \
00628 qualifier GATResult listtype ## _GetIsDirty(listtype ## _const list, \
00629 GATBool *isdirty) \
00630 { \
00631 return GATList_i_GetIsDirty((GATList_const) list, isdirty); \
00632 } \
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644 #define GATLIST_DECLARE_QUALIFIED(qualifier, type, name) \
00645 GATHANDLE_DECLARE(name); \
00646 GATHANDLE_DECLARE(name ## _Iterator); \
00647 GATLIST_PROTOTYPES(qualifier, type, name) \
00648
00649
00650 #define GATLIST_DECLARE(type) \
00651 GATLIST_DECLARE_QUALIFIED(GAT_INLINE_FUNC, type, GATList_ ## type) \
00652
00653
00654 #define GATLIST_DECLARE_LIST(type) \
00655 GATLIST_DECLARE_QUALIFIED(GAT_INLINE_FUNC, type, GATList_ ## type) \
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667 #define GATLIST_DEFINE_QUALIFIED(qualifier, type, name, gattype) \
00668 GATLIST_DECLARE_QUALIFIED(qualifier, type, name); \
00669 GATLIST_IMPLEMENT(qualifier, type, name, gattype) \
00670
00671
00672 #define GATLIST_DEFINE(type) \
00673 GATLIST_DEFINE_QUALIFIED(GAT_INLINE_FUNC, type, GATList_ ## type, \
00674 GATType_ ## type) \
00675
00676
00677 #define GATLIST_DEFINE_LIST(type) \
00678 GATLIST_DEFINE_QUALIFIED(GAT_INLINE_FUNC, type, GATList_ ## type, \
00679 GATType_GATList) \
00680
00681
00682
00683 #define GATLIST_VERSION1 0x0100
00684 #define GATLIST_LASTVERSION GATLIST_VERSION1
00685 #define GATLIST_MINOR_MASK 0x00ff
00686
00687
00688
00689
00690 GATHANDLE_DECLARE(GATList_String);
00691 GATHANDLE_DECLARE(GATList_String_Iterator);
00692
00693
00694 #define GATLIST_VERSION1 0x0100
00695 #define GATLIST_LASTVERSION GATLIST_VERSION1
00696 #define GATLIST_MINOR_MASK 0x00ff
00697
00698
00699 #if defined(__cplusplus)
00700 extern "C" {
00701 #endif
00702
00703
00704 GATOBJECT_DECLARE_CONVERTERS(GATList);
00705 GATOBJECT_DECLARE_CONVERTERS(GATList_String);
00706
00707
00708
00709
00710
00711 GATList
00712 GATList_i_Create(GATType type, size_t size);
00713
00714
00715 GATResult
00716 GATList_i_Equals(GATList_const lhs, GATList_const rhs, GATBool *isequal);
00717
00718
00719 GATType
00720 GATList_i_GetType(GATList_const list);
00721
00722
00723 GATResult
00724 GATList_i_Clone(GATList_const list, GATList *new_list);
00725
00726
00727 GATResult
00728 GATList_i_GetInterface(GATList_const file, GATInterface iftype,
00729 void const **ifp);
00730
00731
00732 void
00733 GATList_i_Destroy(GATList *listhandle);
00734
00735
00736 size_t
00737 GATList_i_Size(GATList_const listhandle);
00738
00739
00740
00741
00742
00743
00744
00745
00746 GATListIterator GATList_i_Begin(GATList_const listhandle);
00747 GATListIterator GATList_i_End(GATList_const listhandle);
00748 GATListIterator GATList_i_Next(GATListIterator_const iterator);
00749 GATListIterator GATList_i_Previous(GATListIterator_const iterator);
00750
00751
00752 GATListIterator
00753 GATList_i_Insert(GATList listhandle, GATListIterator iterator,
00754 void const *data);
00755
00756
00757 GATListIterator
00758 GATList_i_Erase(GATList listhandle, GATListIterator iterator);
00759
00760
00761 void *
00762 GATList_i_Get(GATListIterator_const iterator);
00763
00764
00765
00766
00767
00768
00769
00770
00771 GATListIterator_const
00772 GATList_i_Splice(GATList dest, GATListIterator here,
00773 GATList src, GATListIterator first,
00774 GATListIterator last, size_t count);
00775
00776
00777
00778
00779 GATResult
00780 GATList_i_Serialise(GATList list, GATObject stream, GATBool clear_dirty);
00781
00782
00783 GATList GATList_i_DeSerialise(GATContext context, GATObject stream,
00784 GATResult *result);
00785
00786
00787 GATResult GATList_i_GetIsDirty(GATList_const list, GATBool *isdirty);
00788
00789
00790
00791
00792
00793 GATList_String
00794 GATList_String_Create(void);
00795
00796
00797 GATType
00798 GATList_String_GetType(GATList_String_const list);
00799
00800
00801 GATResult
00802 GATList_String_Clone(GATList_String_const list, GATList_String *new_list);
00803
00804
00805 GATResult
00806 GATList_String_GetInterface(GATList_String_const list, GATInterface iftype,
00807 void const **ifp);
00808
00809
00810 GATResult
00811 GATList_String_Equals(GATList_String_const lhs, GATList_String_const rhs,
00812 GATBool *isequal);
00813
00814
00815 void
00816 GATList_String_Destroy(GATList_String *list);
00817
00818
00819 size_t
00820 GATList_String_Size(GATList_String_const list);
00821
00822
00823
00824
00825
00826 GATList_String_Iterator GATList_String_Begin(GATList_String_const list);
00827 GATList_String_Iterator GATList_String_End(GATList_String_const list);
00828 GATList_String_Iterator GATList_String_Next(
00829 GATList_String_Iterator_const iter);
00830 GATList_String_Iterator GATList_String_Previous(
00831 GATList_String_Iterator_const iter);
00832
00833
00834 GATList_String_Iterator
00835 GATList_String_Insert(GATList_String list,
00836 GATList_String_Iterator iterator, char const *data);
00837
00838
00839 GATList_String_Iterator
00840 GATList_String_Erase(GATList_String list,
00841 GATList_String_Iterator iterator);
00842
00843
00844 char const *
00845 GATList_String_Get(GATList_String_Iterator_const iterator);
00846
00847
00848
00849
00850
00851 GATList_String_Iterator_const
00852 GATList_String_Splice(GATList_String dest,
00853 GATList_String_Iterator here, GATList_String src,
00854 GATList_String_Iterator first,
00855 GATList_String_Iterator last, size_t count);
00856
00857
00858
00859
00860 GATResult GATList_String_Serialise(GATList_String list, GATObject stream,
00861 GATBool clear_dirty);
00862
00863
00864 GATList_String GATList_String_DeSerialise(GATContext context,
00865 GATObject stream, GATResult *result);
00866
00867
00868 GATResult
00869 GATList_String_GetIsDirty(GATList_String_const list, GATBool *isdirty);
00870
00871 #if defined(__cplusplus)
00872 }
00873 #endif
00874
00875 #endif