EnglishРусский  

   ..

   ged.g

   gedbase.g

   geddemo.g

   gedfield.g

Реклама

Инсталлятор CreateInstall
Бесплатные и коммерческие инсталляторы

source\lib\ged\gedfield.g
 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 uint ged.findfield( str name )
15 {
16    return ged_findfield( this, name.ptr())  
17 }
18 
19 method gedfield ged.field( uint ind )
20 {
21    return ged_field( this, ind )->gedfield
22 }
23 
24 method uint ged.fieldcount
25 {
26    return this.head->gedhead.numfields
27 }
28 
29 method uint ged.fieldptr( uint ifield )
30 {
31    return ged_fieldptr( this, this.reccur, ifield )
32 }
33 
34 method uint ged.getuint( uint ifield )
35 {
36    return ged_getuint( this, this.reccur, ifield )
37 }
38 
39 method long ged.getlong( uint ifield )
40 {
41    return ged_getlong( this, this.reccur, ifield )
42 }
43 
44 method float ged.getfloat( uint ifield )
45 {
46    return ged_getfloat( this, this.reccur, ifield )
47 }
48 
49 method double ged.getdouble( uint ifield )
50 {
51    return ged_getdouble( this, this.reccur, ifield )
52 }
53 
54 method str ged.getstr( uint ifield, str ret )
55 {
56    ret.clear()
57    switch this.field( ifield ).ftype
58    {
59       case $FT_BYTE, $FT_SHORT, $FT_INT : ret += int( this.getuint( ifield ))
60       case $FT_UBYTE, $FT_USHORT, $FT_UINT : ret += this.getuint( ifield )
61       case $FT_FLOAT : ret += this.getfloat( ifield )
62       case $FT_LONG : ret += this.getlong( ifield )
63       case $FT_ULONG : ret += ulong( this.getlong( ifield ))
64       case $FT_DOUBLE :  ret += this.getdouble( ifield )
65       case $FT_STR
66       {
67          uint ptr = this.fieldptr( ifield )
68          if ( ptr + this.field( ifield ).width - 1 )->ubyte
69          {
70             ret.append( ptr, this.field( ifield ).width ) 
71          }
72          else : ret.append( ptr, mlen( ptr ))
73       }
74       case $FT_USTR
75       {
76          ustr utemp
77          uint ptr = this.fieldptr( ifield )
78          if ( ptr + this.field( ifield ).width - 2 )->ushort
79          {
80             utemp.copy( ptr, this.field( ifield ).width )
81             utemp.setlen( this.field( ifield ).width >> 1 )
82          }
83          else : utemp.copy( ptr )
84          ret += str( utemp )
85       }  
86    }
87    return ret
88 }
89 
90 
Редактировать