-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharff_token.h
More file actions
executable file
·136 lines (117 loc) · 2.79 KB
/
Copy patharff_token.h
File metadata and controls
executable file
·136 lines (117 loc) · 2.79 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef __INCLUDED_ARFF_TOKEN_H__
#define __INCLUDED_ARFF_TOKEN_H__
/**
* @file arff_token.h
* @brief Contains the 'ArffToken' class
*/
#include <string>
#include "arff_utils.h"
/**
* @enum ArffTokenEnum
* @brief Tokens in the ARFF file
*/
enum ArffTokenEnum
{
/** relation tag */
RELATION = 0,
/** attribute tag */
ATTRIBUTE,
/** data tag */
DATA_TOKEN,
/** missing */
MISSING_TOKEN,
/** numeric type */
NUMERIC_TOKEN,
/** string type */
STRING_TOKEN,
/** date type */
DATE_TOKEN,
/** value token (could be name, nominal, value) */
VALUE_TOKEN,
/** flower bracket open */
BRKT_OPEN,
/** flower bracket close */
BRKT_CLOSE,
/** end of file has been reached */
END_OF_FILE,
/** unknown type (usually an error) */
UNKNOWN_TOKEN,
};
/**
* @brief Utility function to convert ArffTokenEnum to string
* @param type the enum value to be converted
* @return desired string
*/
std::string arff_token2str(ArffTokenEnum type);
/**
* @struct ArffToken arff_token.h
* @brief An ARFF Token read by the ArffLexer class
*/
struct ArffToken
{
public:
/**
* @brief Constructor
* @param _str the token string
* @param _token the token enum
*/
ArffToken(const std::string& _str, ArffTokenEnum _token);
/**
* @brief Copy constructor
* @param _src source object to copy from
*/
ArffToken(const ArffToken& _src);
/**
* @brief Destructor
*/
~ArffToken();
/**
* @brief token string
* @return string
*/
std::string token_str() const;
/**
* @brief token enum
* @return enum
*/
ArffTokenEnum token_enum() const;
/**
* @brief token value as a 32b integer
* @return integer
*
* Note, this function is meaningful only if the token is of
* 'numeric' type!
*/
int32 token_int32() const;
/**
* @brief token value as a 64b integer
* @return integer
*
* Note, this function is meaningful only if the token is of
* 'numeric' type!
*/
int64 token_int64() const;
/**
* @brief token value as a float
* @return float
*
* Note, this function is meaningful only if the token is of
* 'numeric' type!
*/
float token_float() const;
/**
* @brief token value as a double
* @return double
*
* Note, this function is meaningful only if the token is of
* 'numeric' type!
*/
double token_double() const;
private:
/** string */
std::string m_str;
/** enum */
ArffTokenEnum m_enum;
};
/* DO NOT WRITE ANYTHING BELOW THIS LINE!!! */
#endif // __INCLUDED_ARFF_TOKEN_H__