File: ABItype.h

package info (click to toggle)
gentle 1.9%2Bcvs20100605%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,224 kB
  • sloc: cpp: 41,569; ansic: 3,978; sh: 1,420; makefile: 240
file content (72 lines) | stat: -rwxr-xr-x 2,122 bytes parent folder | download | duplicates (7)
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
/** \file
	\brief Contains the ABItype class, as well as its TFLAG helper class
*/
#ifndef _ABI_TYPE_H_
#define _ABI_TYPE_H_

#include "main.h"

#include <math.h>
#include <fcntl.h>
#include <vector>
#include <iostream>
#include <algorithm>

/** \class TFLAG
	\brief Helper class for ABItype
*/
class TFLAG
    {
    public :
    TFLAG () ;
    ~TFLAG () ;
    /// \var pos ???
    /// \var after ????
    /// \var data Carries the associated data
    int pos , after ;
    unsigned char *data ;
    
    wxString getPascalString () ;
    
    wxString flag ; ///< The flag name
    int instance ; ///< Flag data item
    int datatype ; ///< Flag data item
    int datasize ; ///< Flag data item
    int nrecords ; ///< Flag data item
    int nbytes ; ///< Flag data item
    int value ; ///< Flag data item
    int remainder ; ///< Flag data item
    int spare ; ///< Flag data item
    } ;

/** \class ABItype
	\brief Reads files in ABI format
*/
class ABItype
    {
    public :
    ABItype () ;
    ~ABItype () ;
    
    int getRecord ( wxString id , int num ) ;
    int getRecordValue ( wxString id , int num ) ;
    wxString getRecordPascalString ( wxString id , int num ) ;
    wxString getSequence ( int num = 2 ) ;
    int getMacOffset ( unsigned char *t ) ;
    
    // Parser functions
    void parse ( wxString filename ) ;
    TFLAG getFlag ( unsigned char *t , int &from ) ;
    wxString getStr ( unsigned char *t , int from , int len ) ;
    wxString getText ( unsigned char *t , int &from ) ; ///< Reads a Pascal-like string
    int getInt1 ( unsigned char *t , int &from ) ; ///< Reads a 1-byte number
    int getInt2 ( unsigned char *t , int &from ) ; ///< Reads a 2-byte number
    int getInt4 ( unsigned char *t , int &from ) ; ///< Reads a 4-byte number
    int getInt10 ( unsigned char *t , int &from ) ; ///< Jumps ahead 10 bytes, ignores contents
    int getCMBF ( unsigned char *t , int l ) ; ///< Reads a Pascal-like string with known length
    
    // Variables
    vector <TFLAG> vf ; ///< All the flags
    } ;

#endif