@@ -26,10 +26,11 @@ template<typename Stream>
26
26
class OverrideStream
27
27
{
28
28
Stream* stream;
29
- public:
29
+
30
30
const int nType;
31
31
const int nVersion;
32
32
33
+ public:
33
34
OverrideStream (Stream* stream_, int nType_, int nVersion_) : stream(stream_), nType(nType_), nVersion(nVersion_) {}
34
35
35
36
template <typename T>
@@ -66,9 +67,10 @@ class CDataStream
66
67
typedef CSerializeData vector_type;
67
68
vector_type vch;
68
69
unsigned int nReadPos;
69
- public:
70
+
70
71
int nType;
71
72
int nVersion;
73
+ public:
72
74
73
75
typedef vector_type::allocator_type allocator_type;
74
76
typedef vector_type::size_type size_type;
@@ -251,9 +253,9 @@ class CDataStream
251
253
int in_avail () { return size (); }
252
254
253
255
void SetType (int n) { nType = n; }
254
- int GetType () { return nType; }
256
+ int GetType () const { return nType; }
255
257
void SetVersion (int n) { nVersion = n; }
256
- int GetVersion () { return nVersion; }
258
+ int GetVersion () const { return nVersion; }
257
259
258
260
void read (char * pch, size_t nSize)
259
261
{
@@ -380,17 +382,15 @@ class CAutoFile
380
382
CAutoFile (const CAutoFile&);
381
383
CAutoFile& operator =(const CAutoFile&);
382
384
383
- int nType;
384
- int nVersion;
385
-
385
+ const int nType;
386
+ const int nVersion;
387
+
386
388
FILE* file;
387
389
388
390
public:
389
- CAutoFile (FILE* filenew, int nTypeIn, int nVersionIn)
391
+ CAutoFile (FILE* filenew, int nTypeIn, int nVersionIn) : nType(nTypeIn), nVersion(nVersionIn)
390
392
{
391
393
file = filenew;
392
- nType = nTypeIn;
393
- nVersion = nVersionIn;
394
394
}
395
395
396
396
~CAutoFile ()
@@ -425,10 +425,8 @@ class CAutoFile
425
425
//
426
426
// Stream subset
427
427
//
428
- void SetType (int n) { nType = n; }
429
- int GetType () { return nType; }
430
- void SetVersion (int n) { nVersion = n; }
431
- int GetVersion () { return nVersion; }
428
+ int GetType () const { return nType; }
429
+ int GetVersion () const { return nVersion; }
432
430
433
431
void read (char * pch, size_t nSize)
434
432
{
@@ -500,8 +498,8 @@ class CBufferedFile
500
498
CBufferedFile (const CBufferedFile&);
501
499
CBufferedFile& operator =(const CBufferedFile&);
502
500
503
- int nType;
504
- int nVersion;
501
+ const int nType;
502
+ const int nVersion;
505
503
506
504
FILE *src; // source file
507
505
uint64_t nSrcPos; // how many bytes have been read from source
@@ -531,11 +529,9 @@ class CBufferedFile
531
529
532
530
public:
533
531
CBufferedFile (FILE *fileIn, uint64_t nBufSize, uint64_t nRewindIn, int nTypeIn, int nVersionIn) :
534
- nSrcPos (0 ), nReadPos(0 ), nReadLimit((uint64_t )(-1 )), nRewind(nRewindIn), vchBuf(nBufSize, 0 )
532
+ nType (nTypeIn), nVersion(nVersionIn), nSrcPos(0 ), nReadPos(0 ), nReadLimit((uint64_t )(-1 )), nRewind(nRewindIn), vchBuf(nBufSize, 0 )
535
533
{
536
534
src = fileIn;
537
- nType = nTypeIn;
538
- nVersion = nVersionIn;
539
535
}
540
536
541
537
~CBufferedFile ()
0 commit comments