evecache 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/README.txt +24 -0
- data/Rakefile +5 -0
- data/evecache.gemspec +16 -0
- data/ext/evecache/Makefile +237 -0
- data/ext/evecache/dbtypes.cpp +237 -0
- data/ext/evecache/evecache.cxx +16354 -0
- data/ext/evecache/evecache/config.hpp +19 -0
- data/ext/evecache/evecache/dbtypes.hpp +64 -0
- data/ext/evecache/evecache/exceptions.hpp +47 -0
- data/ext/evecache/evecache/market.hpp +166 -0
- data/ext/evecache/evecache/parser.hpp +316 -0
- data/ext/evecache/evecache/reader.hpp +110 -0
- data/ext/evecache/exceptions.cpp +46 -0
- data/ext/evecache/extconf.rb +8 -0
- data/ext/evecache/libevecache.i +431 -0
- data/ext/evecache/market.cpp +325 -0
- data/ext/evecache/parser.cpp +1249 -0
- data/ext/evecache/reader.cpp +322 -0
- data/lib/evecache.rb +83 -0
- data/test/test_evecache.rb +7 -0
- metadata +67 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
#ifndef _EC_CONFIG_H_
|
2
|
+
#define _EC_CONFIG_H_
|
3
|
+
|
4
|
+
#ifdef WIN32
|
5
|
+
|
6
|
+
#if defined(EVECACHE_EXPORT) // inside DLL
|
7
|
+
# define EVECACHE_API __declspec(dllexport)
|
8
|
+
#else // outside DLL
|
9
|
+
# define EVECACHE_API __declspec(dllimport)
|
10
|
+
#endif
|
11
|
+
#else
|
12
|
+
|
13
|
+
#define EVECACHE_API
|
14
|
+
|
15
|
+
#endif
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
#endif
|
@@ -0,0 +1,64 @@
|
|
1
|
+
// libevecache - EVE Cache File Reader Library
|
2
|
+
// Copyright (C) 2009-2010 StackFoundry LLC and Yann Ramin
|
3
|
+
//
|
4
|
+
// This library is free software; you can redistribute it and/or
|
5
|
+
// modify it under the terms of the GNU General Public
|
6
|
+
// License as published by the Free Software Foundation; either
|
7
|
+
// version 2 of the License, or (at your option) any later version.
|
8
|
+
//
|
9
|
+
// This library is distributed in the hope that it will be useful,
|
10
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
// General Public License for more details.
|
13
|
+
//
|
14
|
+
// You should have received a copy of the GNU General Public
|
15
|
+
// License along with this library; if not, write to the Free Software
|
16
|
+
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
//
|
18
|
+
// http://dev.eve-central.com/libevecache/
|
19
|
+
// http://gitorious.org/libevecache
|
20
|
+
|
21
|
+
|
22
|
+
#ifndef _EC_DBTYPES_H_
|
23
|
+
#define _EC_DBTYPES_H_
|
24
|
+
|
25
|
+
#include <map>
|
26
|
+
#include <string>
|
27
|
+
|
28
|
+
namespace EveCache {
|
29
|
+
|
30
|
+
enum DbType {
|
31
|
+
Int64 = 20,
|
32
|
+
Time64 = 64,
|
33
|
+
Currency64 = 6,
|
34
|
+
Int32 = 3,
|
35
|
+
Int16 = 2,
|
36
|
+
Int8 = 17,
|
37
|
+
Double = 5,
|
38
|
+
Bool = 11,
|
39
|
+
String = 129,
|
40
|
+
String2 = 130,
|
41
|
+
};
|
42
|
+
|
43
|
+
unsigned long windows_to_unix_time(unsigned long long);
|
44
|
+
|
45
|
+
class ColumnLookup {
|
46
|
+
public:
|
47
|
+
static unsigned char lookupId(std::string& name);
|
48
|
+
static std::string lookupName(unsigned char e);
|
49
|
+
|
50
|
+
private:
|
51
|
+
ColumnLookup() {}
|
52
|
+
ColumnLookup(const ColumnLookup &rhs) {}
|
53
|
+
static bool isInit;
|
54
|
+
static void init();
|
55
|
+
static void insert(const char*, unsigned char id);
|
56
|
+
static std::map<std::string, unsigned char> _idLookup;
|
57
|
+
static std::map<unsigned char, std::string> _nameLookup; // fixme, just bad, no need for this
|
58
|
+
};
|
59
|
+
|
60
|
+
|
61
|
+
};
|
62
|
+
|
63
|
+
|
64
|
+
#endif
|
@@ -0,0 +1,47 @@
|
|
1
|
+
// libevecache - EVE Cache File Reader Library
|
2
|
+
// Copyright (C) 2009-2010 StackFoundry LLC and Yann Ramin
|
3
|
+
//
|
4
|
+
// This program is free software: you can redistribute it and/or modify
|
5
|
+
// it under the terms of the GNU General Public License as published by
|
6
|
+
// the Free Software Foundation, either version 3 of the License, or
|
7
|
+
// (at your option) any later version.
|
8
|
+
//
|
9
|
+
// This program is distributed in the hope that it will be useful,
|
10
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
// GNU General Public License for more details.
|
13
|
+
//
|
14
|
+
// You should have received a copy of the GNU General Public License
|
15
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
//
|
17
|
+
// http://dev.eve-central.com/libevecache/
|
18
|
+
// http://gitorious.org/libevecache
|
19
|
+
|
20
|
+
#ifndef _EC_EXCEPTIONS_H_
|
21
|
+
#define _EC_EXCEPTIONS_H_
|
22
|
+
|
23
|
+
#include <string>
|
24
|
+
#include "evecache/config.hpp"
|
25
|
+
|
26
|
+
namespace EveCache {
|
27
|
+
|
28
|
+
class EVECACHE_API EndOfFileException {
|
29
|
+
public:
|
30
|
+
EndOfFileException();
|
31
|
+
operator std::string () const;
|
32
|
+
};
|
33
|
+
|
34
|
+
class EVECACHE_API ParseException {
|
35
|
+
public:
|
36
|
+
ParseException(const std::string& msg);
|
37
|
+
ParseException(const char* m);
|
38
|
+
operator std::string () const;
|
39
|
+
private:
|
40
|
+
std::string message;
|
41
|
+
};
|
42
|
+
|
43
|
+
|
44
|
+
};
|
45
|
+
|
46
|
+
|
47
|
+
#endif
|
@@ -0,0 +1,166 @@
|
|
1
|
+
// libevecache - EVE Cache File Reader Library
|
2
|
+
// Copyright (C) 2009-2010 StackFoundry LLC and Yann Ramin
|
3
|
+
//
|
4
|
+
// This library is free software; you can redistribute it and/or
|
5
|
+
// modify it under the terms of the GNU General Public
|
6
|
+
// License as published by the Free Software Foundation; either
|
7
|
+
// version 2 of the License, or (at your option) any later version.
|
8
|
+
//
|
9
|
+
// This library is distributed in the hope that it will be useful,
|
10
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
// General Public License for more details.
|
13
|
+
//
|
14
|
+
// You should have received a copy of the GNU General Public
|
15
|
+
// License along with this library; if not, write to the Free Software
|
16
|
+
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
//
|
18
|
+
// http://dev.eve-central.com/libevecache/
|
19
|
+
// http://gitorious.org/libevecache
|
20
|
+
|
21
|
+
|
22
|
+
#ifndef _EC_MARKET_H_
|
23
|
+
#define _EC_MARKET_H_
|
24
|
+
|
25
|
+
#include "evecache/config.hpp"
|
26
|
+
|
27
|
+
#include <vector>
|
28
|
+
#include <string>
|
29
|
+
|
30
|
+
namespace EveCache {
|
31
|
+
|
32
|
+
|
33
|
+
class SNode;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Domain object for a market order
|
37
|
+
*/
|
38
|
+
class EVECACHE_API MarketOrder {
|
39
|
+
public:
|
40
|
+
|
41
|
+
MarketOrder() : _price(0), _volRemaining(0), _range(0), _orderID(0), _volEntered(0), _minVolume(0), _bid(0), _issued(0),
|
42
|
+
_duration(0), _stationID(0), _regionID(0), _solarSystemID(0), _jumps(0), _type(0) {}
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Utility
|
46
|
+
*/
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Return this item as a standard CSV file export line
|
50
|
+
*/
|
51
|
+
std::string toCsv() const;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Data setters
|
55
|
+
*/
|
56
|
+
|
57
|
+
void setPrice(unsigned long long v) { _price = v; }
|
58
|
+
void setVolRemaining(double v) { _volRemaining = v; }
|
59
|
+
void setRange(unsigned int v) { _range = v; }
|
60
|
+
void setOrderID(unsigned long long v) { _orderID = v; }
|
61
|
+
void setVolEntered(unsigned int v) { _volEntered = v; }
|
62
|
+
void setMinVolume(unsigned int v) { _minVolume = v; }
|
63
|
+
void setBid(bool b) { _bid = b; }
|
64
|
+
void setIssued(unsigned long long v) { _issued = v; }
|
65
|
+
void setDuration(unsigned int v) { _duration = v; }
|
66
|
+
void setStationID(unsigned int v) { _stationID = v; }
|
67
|
+
void setRegionID(unsigned int v) { _regionID = v; }
|
68
|
+
void setSolarSystemID(unsigned int v) { _solarSystemID = v; }
|
69
|
+
void setJumps(unsigned int v) { _jumps = v; }
|
70
|
+
void setType(unsigned int v) { _type = v; }
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Data accessors
|
74
|
+
*/
|
75
|
+
unsigned long long price() const { return _price; }
|
76
|
+
double volRemaining() const { return _volRemaining; }
|
77
|
+
unsigned int range() const { return _range; }
|
78
|
+
unsigned long long orderID() const { return _orderID; }
|
79
|
+
unsigned int volEntered() const { return _volEntered; }
|
80
|
+
unsigned int minVolume() const { return _minVolume; }
|
81
|
+
bool isBid() const { return _bid; }
|
82
|
+
unsigned long long issued() const { return _issued; }
|
83
|
+
unsigned int duration() const { return _duration; }
|
84
|
+
unsigned int stationID() const { return _stationID; }
|
85
|
+
unsigned int regionID() const { return _regionID; }
|
86
|
+
unsigned int solarSystemID() const { return _solarSystemID; }
|
87
|
+
unsigned int jumps() const { return _jumps; }
|
88
|
+
unsigned int type() const { return _type; }
|
89
|
+
|
90
|
+
private:
|
91
|
+
unsigned long long _price;
|
92
|
+
double _volRemaining;
|
93
|
+
unsigned int _range;
|
94
|
+
unsigned long long _orderID;
|
95
|
+
unsigned int _volEntered;
|
96
|
+
unsigned int _minVolume;
|
97
|
+
bool _bid;
|
98
|
+
unsigned long long _issued;
|
99
|
+
unsigned int _duration;
|
100
|
+
unsigned int _stationID;
|
101
|
+
unsigned int _solarSystemID;
|
102
|
+
unsigned int _regionID;
|
103
|
+
unsigned int _jumps;
|
104
|
+
unsigned int _type;
|
105
|
+
};
|
106
|
+
|
107
|
+
|
108
|
+
class EVECACHE_API MarketList {
|
109
|
+
public:
|
110
|
+
MarketList(int type, int region);
|
111
|
+
MarketList();
|
112
|
+
MarketList(const MarketList &rhs) {
|
113
|
+
_type = rhs._type;
|
114
|
+
_region = rhs._region;
|
115
|
+
_sellOrders = rhs._sellOrders;
|
116
|
+
_buyOrders = rhs._buyOrders;
|
117
|
+
_ts = rhs._ts;
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
void setType(int v) { _type = v; }
|
122
|
+
void setRegion(int r) { _region = r; }
|
123
|
+
void setTimestamp(unsigned long t) { _ts = t; }
|
124
|
+
|
125
|
+
int type() const { return _type; }
|
126
|
+
int region() const { return _region; }
|
127
|
+
unsigned long timestamp() const { return _ts; }
|
128
|
+
|
129
|
+
std::vector<MarketOrder> getSellOrders() const { return _sellOrders; }
|
130
|
+
std::vector<MarketOrder> getBuyOrders() const { return _buyOrders; }
|
131
|
+
|
132
|
+
void addOrder(MarketOrder& order);
|
133
|
+
|
134
|
+
private:
|
135
|
+
int _type;
|
136
|
+
int _region;
|
137
|
+
unsigned long _ts;
|
138
|
+
std::vector<MarketOrder> _sellOrders;
|
139
|
+
std::vector<MarketOrder> _buyOrders;
|
140
|
+
};
|
141
|
+
|
142
|
+
|
143
|
+
class EVECACHE_API MarketParser {
|
144
|
+
public:
|
145
|
+
MarketParser(const SNode *stream);
|
146
|
+
MarketParser(const char* fileName);
|
147
|
+
MarketParser(const std::string fileName);
|
148
|
+
~MarketParser();
|
149
|
+
MarketList getList() const;
|
150
|
+
void parse();
|
151
|
+
bool valid() const;
|
152
|
+
private:
|
153
|
+
const SNode *_stream;
|
154
|
+
bool _valid;
|
155
|
+
void initWithFile(const std::string& fileName);
|
156
|
+
void parse(const SNode* nest);
|
157
|
+
void parseDbRow(const SNode* nest);
|
158
|
+
MarketList _list;
|
159
|
+
|
160
|
+
};
|
161
|
+
|
162
|
+
|
163
|
+
};
|
164
|
+
|
165
|
+
|
166
|
+
#endif
|
@@ -0,0 +1,316 @@
|
|
1
|
+
// libevecache - EVE Cache File Reader Library
|
2
|
+
// Copyright (C) 2009-2010 StackFoundry LLC and Yann Ramin
|
3
|
+
//
|
4
|
+
// This library is free software; you can redistribute it and/or
|
5
|
+
// modify it under the terms of the GNU General Public
|
6
|
+
// License as published by the Free Software Foundation; either
|
7
|
+
// version 2 of the License, or (at your option) any later version.
|
8
|
+
//
|
9
|
+
// This library is distributed in the hope that it will be useful,
|
10
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU
|
12
|
+
// General Public License for more details.
|
13
|
+
//
|
14
|
+
// You should have received a copy of the GNU General Public
|
15
|
+
// License along with this library; if not, write to the Free Software
|
16
|
+
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
//
|
18
|
+
// http://dev.eve-central.com/libevecache/
|
19
|
+
// http://gitorious.org/libevecache
|
20
|
+
|
21
|
+
#ifndef _EC_PARSER_H_
|
22
|
+
#define _EC_PARSER_H_
|
23
|
+
|
24
|
+
#include <vector>
|
25
|
+
#include <string>
|
26
|
+
|
27
|
+
#include "evecache/config.hpp"
|
28
|
+
#include "evecache/dbtypes.hpp"
|
29
|
+
|
30
|
+
namespace EveCache {
|
31
|
+
|
32
|
+
typedef enum {
|
33
|
+
EStreamStart = 0x7e,
|
34
|
+
ENone = 0x01, // Python None type
|
35
|
+
EString = 0x2, // Another type of string, also ids
|
36
|
+
ELongLong = 0x3, // 64 bit value?
|
37
|
+
EInteger = 0x04, // 4 byte, little endian?
|
38
|
+
EShort = 0x05, // 2 byte
|
39
|
+
EByte = 0x6, // i think
|
40
|
+
ENeg1Integer = 0x07, // int == -1
|
41
|
+
E0Integer = 0x08, // int == 0
|
42
|
+
E1Integer = 0x09, // int == 1
|
43
|
+
EReal = 0x0a, // floating point, 64 bits, assume matches machine double type
|
44
|
+
E0Real = 0x0b,
|
45
|
+
E0String = 0xe, // 0 length string
|
46
|
+
EString3 = 0xf, // really? another? single character string
|
47
|
+
EString4 = 0x10,
|
48
|
+
EMarker = 0x11, // A one byte identifier code
|
49
|
+
EUnicodeString = 0x12,
|
50
|
+
EIdent = 0x13, // an identifier string
|
51
|
+
ETuple = 0x14, // a tuple of N objects
|
52
|
+
ETuple2 = 0x15, // a tuple of N objects, variant 2
|
53
|
+
EDict = 0x16, // N objects, consisting of key object and value object
|
54
|
+
EObject = 0x17, // Object type ?
|
55
|
+
ESharedObj = 0x1b, // shared object reference
|
56
|
+
EChecksum = 0x1c,
|
57
|
+
EBoolTrue = 0x1f,
|
58
|
+
EBoolFalse = 0x20,
|
59
|
+
EObject22 = 0x22, // a database header field of some variety
|
60
|
+
EObject23 = 0x23, // another datatype containing ECompressedRows/DBRows
|
61
|
+
E0Tuple = 0x24, // a tuple of 0 objects
|
62
|
+
E1Tuple = 0x25, // a tuple of 1 objects
|
63
|
+
E0Tuple2 = 0x26,
|
64
|
+
E1Tuple2 = 0x27, // a tuple of 1 objects, variant 2
|
65
|
+
EEmptyString = 0x28, // empty
|
66
|
+
EUnicodeString2 = 0x29,
|
67
|
+
ECompressedRow = 0x2a, // the datatype from hell, a RLEish compressed row
|
68
|
+
ESubstream = 0x2b, // substream - len bytes followed by 0x7e
|
69
|
+
E2Tuple = 0x2c, // a tuple of 2 objects
|
70
|
+
EString2 = 0x2e, // stringtastic
|
71
|
+
ESizedInt = 0x2f, // when you can't decide ahead of time how long to make the integer...
|
72
|
+
|
73
|
+
} EStreamCode;
|
74
|
+
|
75
|
+
|
76
|
+
class CacheFile_Iterator;
|
77
|
+
|
78
|
+
/***********************************************************************/
|
79
|
+
|
80
|
+
class EVECACHE_API SNode {
|
81
|
+
public:
|
82
|
+
SNode(EStreamCode t);
|
83
|
+
SNode(const SNode&);
|
84
|
+
virtual ~SNode();
|
85
|
+
virtual std::string repl() const;
|
86
|
+
virtual EStreamCode type() const;
|
87
|
+
virtual void setType(EStreamCode t);
|
88
|
+
virtual void addMember(SNode* node);
|
89
|
+
virtual const std::vector<SNode*>& members() const;
|
90
|
+
virtual SNode* clone() const;
|
91
|
+
private:
|
92
|
+
EStreamCode _type;
|
93
|
+
protected:
|
94
|
+
std::vector<SNode*> _members;
|
95
|
+
};
|
96
|
+
|
97
|
+
/***********************************************************************/
|
98
|
+
|
99
|
+
class EVECACHE_API SStreamNode : public SNode {
|
100
|
+
public:
|
101
|
+
SStreamNode();
|
102
|
+
SStreamNode(EStreamCode t);
|
103
|
+
SStreamNode(const SStreamNode &rhs);
|
104
|
+
virtual ~SStreamNode() { }
|
105
|
+
virtual std::string repl() const;
|
106
|
+
virtual SStreamNode* clone() const;
|
107
|
+
protected:
|
108
|
+
|
109
|
+
};
|
110
|
+
|
111
|
+
/***********************************************************************/
|
112
|
+
|
113
|
+
class EVECACHE_API SDBHeader : public SNode {
|
114
|
+
public:
|
115
|
+
SDBHeader();
|
116
|
+
virtual std::string repl() const;
|
117
|
+
virtual SDBHeader* clone() const;
|
118
|
+
};
|
119
|
+
|
120
|
+
|
121
|
+
/***********************************************************************/
|
122
|
+
|
123
|
+
class EVECACHE_API STuple : public SNode {
|
124
|
+
public:
|
125
|
+
STuple(unsigned int len);
|
126
|
+
STuple(const STuple &rhs);
|
127
|
+
virtual ~STuple();
|
128
|
+
virtual unsigned int givenLength() const;
|
129
|
+
virtual void addMember(SNode* node);
|
130
|
+
virtual std::string repl() const;
|
131
|
+
virtual STuple* clone() const;
|
132
|
+
protected:
|
133
|
+
unsigned int _givenLength;
|
134
|
+
};
|
135
|
+
|
136
|
+
/***********************************************************************/
|
137
|
+
|
138
|
+
class EVECACHE_API SDict : public SNode {
|
139
|
+
public:
|
140
|
+
SDict(unsigned int len);
|
141
|
+
SDict(const SDict &);
|
142
|
+
virtual ~SDict();
|
143
|
+
virtual unsigned int givenLength() const;
|
144
|
+
virtual void addMember(SNode* node);
|
145
|
+
virtual std::string repl() const;
|
146
|
+
virtual SDict* clone() const;
|
147
|
+
virtual SNode* getByName(const std::string& target) const;
|
148
|
+
protected:
|
149
|
+
unsigned int _givenLength;
|
150
|
+
};
|
151
|
+
|
152
|
+
|
153
|
+
/***********************************************************************/
|
154
|
+
|
155
|
+
class EVECACHE_API SNone : public SNode {
|
156
|
+
public:
|
157
|
+
SNone();
|
158
|
+
virtual std::string repl() const;
|
159
|
+
virtual SNone* clone() const;
|
160
|
+
};
|
161
|
+
|
162
|
+
|
163
|
+
/***********************************************************************/
|
164
|
+
|
165
|
+
class EVECACHE_API SMarker : public SNode {
|
166
|
+
public:
|
167
|
+
SMarker(unsigned char id);
|
168
|
+
virtual unsigned char id() const;
|
169
|
+
virtual std::string string() const;
|
170
|
+
virtual std::string repl() const;
|
171
|
+
virtual SMarker* clone() const;
|
172
|
+
protected:
|
173
|
+
unsigned char _id;
|
174
|
+
};
|
175
|
+
|
176
|
+
/***********************************************************************/
|
177
|
+
|
178
|
+
class EVECACHE_API SIdent : public SNode {
|
179
|
+
public:
|
180
|
+
SIdent(const std::string& m);
|
181
|
+
virtual std::string name() const;
|
182
|
+
virtual std::string repl() const;
|
183
|
+
virtual SIdent* clone() const;
|
184
|
+
protected:
|
185
|
+
std::string _name;
|
186
|
+
};
|
187
|
+
|
188
|
+
/***********************************************************************/
|
189
|
+
|
190
|
+
class EVECACHE_API SString : public SNode {
|
191
|
+
public:
|
192
|
+
SString(const std::string& m);
|
193
|
+
virtual std::string string() const;
|
194
|
+
virtual std::string repl() const;
|
195
|
+
virtual SString* clone() const;
|
196
|
+
protected:
|
197
|
+
std::string _name;
|
198
|
+
};
|
199
|
+
|
200
|
+
/***********************************************************************/
|
201
|
+
|
202
|
+
class EVECACHE_API SInt : public SNode {
|
203
|
+
public:
|
204
|
+
SInt(int val);
|
205
|
+
virtual int value() const;
|
206
|
+
virtual std::string repl() const;
|
207
|
+
virtual SInt* clone() const;
|
208
|
+
private:
|
209
|
+
int _value;
|
210
|
+
};
|
211
|
+
|
212
|
+
/***********************************************************************/
|
213
|
+
|
214
|
+
class EVECACHE_API SReal : public SNode {
|
215
|
+
public:
|
216
|
+
SReal(double val);
|
217
|
+
virtual double value() const;
|
218
|
+
virtual std::string repl() const;
|
219
|
+
virtual SReal* clone() const;
|
220
|
+
private:
|
221
|
+
double _value;
|
222
|
+
};
|
223
|
+
|
224
|
+
|
225
|
+
/***********************************************************************/
|
226
|
+
|
227
|
+
class EVECACHE_API SLongLong : public SNode {
|
228
|
+
public:
|
229
|
+
SLongLong(long long val);
|
230
|
+
virtual long long value() const;
|
231
|
+
virtual std::string repl() const;
|
232
|
+
virtual SLongLong* clone() const;
|
233
|
+
private:
|
234
|
+
long long _value;
|
235
|
+
};
|
236
|
+
|
237
|
+
/***********************************************************************/
|
238
|
+
|
239
|
+
class EVECACHE_API SObject : public SNode {
|
240
|
+
public:
|
241
|
+
SObject();
|
242
|
+
virtual std::string name() const;
|
243
|
+
virtual std::string repl() const;
|
244
|
+
virtual SObject* clone() const;
|
245
|
+
private:
|
246
|
+
};
|
247
|
+
|
248
|
+
|
249
|
+
/***********************************************************************/
|
250
|
+
|
251
|
+
class EVECACHE_API SSubstream : public SNode {
|
252
|
+
public:
|
253
|
+
SSubstream(int len);
|
254
|
+
virtual std::string repl() const;
|
255
|
+
virtual SSubstream* clone() const;
|
256
|
+
private:
|
257
|
+
int _len;
|
258
|
+
};
|
259
|
+
|
260
|
+
/***********************************************************************/
|
261
|
+
|
262
|
+
class EVECACHE_API SDBRow : public SNode {
|
263
|
+
public:
|
264
|
+
SDBRow(int magic, const std::vector<unsigned char>& data);
|
265
|
+
bool isLast() const;
|
266
|
+
void setLast(bool l);
|
267
|
+
virtual std::string repl() const;
|
268
|
+
virtual SDBRow* clone() const;
|
269
|
+
private:
|
270
|
+
int _id;
|
271
|
+
bool _last;
|
272
|
+
std::vector<unsigned char> _data;
|
273
|
+
};
|
274
|
+
|
275
|
+
/***********************************************************************/
|
276
|
+
|
277
|
+
class EVECACHE_API SDBRecords : public SNode {
|
278
|
+
public:
|
279
|
+
SDBRecords();
|
280
|
+
virtual std::string repl() const;
|
281
|
+
virtual SDBRecords* clone() const;
|
282
|
+
};
|
283
|
+
|
284
|
+
/***********************************************************************/
|
285
|
+
|
286
|
+
class EVECACHE_API Parser {
|
287
|
+
public:
|
288
|
+
Parser(CacheFile_Iterator *iter);
|
289
|
+
~Parser();
|
290
|
+
void parse();
|
291
|
+
std::vector<SNode*> streams() const;
|
292
|
+
protected:
|
293
|
+
SNode* parseone();
|
294
|
+
void parse(SNode* node, int limit);
|
295
|
+
SNode* getDBRow();
|
296
|
+
int getLen();
|
297
|
+
unsigned int shareInit();
|
298
|
+
void shareAdd(SNode* obj);
|
299
|
+
SNode* shareGet(unsigned int id);
|
300
|
+
void shareSkip();
|
301
|
+
private:
|
302
|
+
std::vector<SNode*> _streams;
|
303
|
+
CacheFile_Iterator *_iter;
|
304
|
+
unsigned int _sharecount; // number of shared obj
|
305
|
+
unsigned int _sharecursor; // current index into
|
306
|
+
SNode **_shareobj; // list of already discovered shareds
|
307
|
+
unsigned int *_sharemap; // list of slot mappings
|
308
|
+
|
309
|
+
};
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
};
|
315
|
+
|
316
|
+
#endif
|