1 /******************************************************************************
2 *
3 * Copyright (C) 2009, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * Author: Alexey Krivonogov ( gentee )
11 *
12 ******************************************************************************/
13
14 method gedfields.init()
15 {
16 this->arr.oftype( gedfieldinit )
17 }
18
19 method uint ged.close()
20 {
21 return ged_close( this )
22 }
23
24 method uint ged.create( str filename, collection cfield, uint notify )
25 {
26 uint i
27 gedfields fields
28
29 .filename = filename.ptr()
30 fornum i, *cfield
31 {
32 uint field
33
34 field as fields[ fields.expand(1)]
35 field.ftype = cfield[i++]
36 if cfield.gettype( i ) != str : break
37 field.name = cfield[i]->str.ptr()
38 if field.ftype & $FTF_AUTO : .autoid = i
39 field.ftype &= 0xFFFFFF
40 }
41 fields.expand(1)
42
43 if notify
44 {
45 .call = gentee_ptr( 4 ) // GPTR_CALL
46 .nfyparam = notify
47 }
48
49 return ged_create( this, fields.ptr() )
50 }
51
52 method uint ged.open( str filename, uint notify )
53 {
54 .filename = filename.ptr()
55 if notify
56 {
57 .call = gentee_ptr( 4 ); // GPTR_CALL
58 .nfyparam = notify;
59 }
60
61 return ged_open( this )
62 }
63
64 operator uint *( ged pdb)
65 {
66 return pdb.reccount
67 }
68
69 method uint ged.eof( fordata fd )
70 {
71 return ged_eof( this )
72 }
73
74 method uint ged.first( fordata fd )
75 {
76 return ged_goto( this, 1 )
77 }
78
79 method uint ged.next( fordata fd )
80 {
81 return ged_goto( this, this.reccur + 1 )
82 }
83