Skip to content

Commit 0149680

Browse files
committed
- Reformat code.
1 parent 6749629 commit 0149680

File tree

27 files changed

+3765
-3619
lines changed

27 files changed

+3765
-3619
lines changed

src/byteio/byteio.cpp

Lines changed: 319 additions & 294 deletions
Large diffs are not rendered by default.

src/byteio/byteio.h

Lines changed: 135 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -11,184 +11,191 @@ typedef unsigned short UKWORD;
1111
typedef unsigned int UKDWORD;
1212

1313
//----------------------------------------------------
14-
class ByteStream {
15-
public:
16-
virtual ~ByteStream(){};
14+
class ByteStream
15+
{
16+
public:
17+
virtual ~ByteStream()
18+
{
19+
};
1720
};
1821

1922
//----------------------------------------------------
20-
class ByteInStream: public ByteStream
23+
class ByteInStream : public ByteStream
2124
{
22-
public:
23-
virtual int getNext(UKBYTE &b) = 0;
24-
virtual int peekNext(UKBYTE &b) = 0;
25-
virtual int unget(UKBYTE b) = 0;
25+
public:
26+
virtual int getNext(UKBYTE &b) = 0;
27+
virtual int peekNext(UKBYTE &b) = 0;
28+
virtual int unget(UKBYTE b) = 0;
2629

27-
virtual int getNextW(UKWORD &w) = 0;
28-
virtual int peekNextW(UKWORD &w) = 0;
30+
virtual int getNextW(UKWORD &w) = 0;
31+
virtual int peekNextW(UKWORD &w) = 0;
2932

30-
virtual int getNextDW(UKDWORD &dw) = 0;
33+
virtual int getNextDW(UKDWORD &dw) = 0;
3134

32-
virtual int bookmark() //no support for bookmark by default
33-
{
34-
return 0;
35-
}
35+
virtual int bookmark() //no support for bookmark by default
36+
{
37+
return 0;
38+
}
3639

37-
virtual int gotoBookmark()
38-
{
39-
return 0;
40-
}
40+
virtual int gotoBookmark()
41+
{
42+
return 0;
43+
}
4144

42-
virtual int eos() = 0; //end of stream
43-
virtual int close() = 0;
45+
virtual int eos() = 0; //end of stream
46+
virtual int close() = 0;
4447
};
4548

4649
//----------------------------------------------------
47-
class ByteOutStream: public ByteStream
50+
class ByteOutStream : public ByteStream
4851
{
49-
public:
50-
virtual int putB(UKBYTE b) = 0;
51-
virtual int putW(UKWORD w) = 0;
52-
virtual int puts(const char *s, int size = -1) = 0; // write an 8-bit string
53-
virtual int isOK() = 0;// get current stream state
52+
public:
53+
virtual int putB(UKBYTE b) = 0;
54+
virtual int putW(UKWORD w) = 0;
55+
virtual int puts(const char *s, int size = -1) = 0; // write an 8-bit string
56+
virtual int isOK() = 0;// get current stream state
5457
};
5558

5659
//----------------------------------------------------
5760
class StringBIStream : public ByteInStream
5861
{
59-
protected:
60-
int m_eos;
61-
UKBYTE *m_data, *m_current;
62-
int m_len, m_left;
63-
64-
struct {
65-
int eos;
66-
UKBYTE *data, *current;
67-
int len, left;
68-
} m_bookmark;
69-
70-
int m_didBookmark;
71-
72-
public:
73-
StringBIStream(UKBYTE *data, int len, int elementSize = 1);
74-
virtual int getNext(UKBYTE &b);
75-
virtual int peekNext(UKBYTE &b);
76-
virtual int unget(UKBYTE b);
77-
78-
virtual int getNextW(UKWORD &w);
79-
virtual int peekNextW(UKWORD &w);
80-
81-
virtual int getNextDW(UKDWORD &dw);
62+
protected:
63+
int m_eos;
64+
UKBYTE *m_data, *m_current;
65+
int m_len, m_left;
66+
67+
struct
68+
{
69+
int eos;
70+
UKBYTE *data, *current;
71+
int len, left;
72+
} m_bookmark;
73+
74+
int m_didBookmark;
75+
76+
public:
77+
StringBIStream(UKBYTE *data, int len, int elementSize = 1);
78+
virtual int getNext(UKBYTE &b);
79+
virtual int peekNext(UKBYTE &b);
80+
virtual int unget(UKBYTE b);
81+
82+
virtual int getNextW(UKWORD &w);
83+
virtual int peekNextW(UKWORD &w);
84+
85+
virtual int getNextDW(UKDWORD &dw);
8286

8387
virtual int eos(); //end of stream
84-
virtual int close();
88+
virtual int close();
8589

86-
virtual int bookmark();
87-
virtual int gotoBookmark();
90+
virtual int bookmark();
91+
virtual int gotoBookmark();
8892

89-
void reopen();
90-
int left() {
91-
return m_left;
92-
}
93+
void reopen();
94+
int left()
95+
{
96+
return m_left;
97+
}
9398
};
9499

95100
//----------------------------------------------------
96101
class FileBIStream : public ByteInStream
97102
{
98-
protected:
99-
FILE *m_file;
100-
int m_bufSize;
101-
char *m_buf;
102-
int m_own;
103-
int m_didBookmark;
103+
protected:
104+
FILE *m_file;
105+
int m_bufSize;
106+
char *m_buf;
107+
int m_own;
108+
int m_didBookmark;
104109

105-
struct {
106-
long pos;
107-
} m_bookmark;
110+
struct
111+
{
112+
long pos;
113+
} m_bookmark;
108114

109-
//some systems don't have wide char IO functions
110-
//we have to use this variables to implement that
111-
UKBYTE m_readByte;
112-
int m_readAhead;
113-
int m_lastIsAhead;
115+
//some systems don't have wide char IO functions
116+
//we have to use this variables to implement that
117+
UKBYTE m_readByte;
118+
int m_readAhead;
119+
int m_lastIsAhead;
114120

115-
public:
121+
public:
116122

117-
FileBIStream(int bufsize = 8192, char *buf = NULL);
118-
// FileBIStream(char *fileName, int bufsize = 8192, void *buf = NULL);
123+
FileBIStream(int bufsize = 8192, char *buf = NULL);
124+
// FileBIStream(char *fileName, int bufsize = 8192, void *buf = NULL);
119125

120-
int open(const char *fileName);
121-
void attach(FILE *f);
122-
virtual int close();
126+
int open(const char *fileName);
127+
void attach(FILE *f);
128+
virtual int close();
123129

124-
virtual int getNext(UKBYTE &b);
125-
virtual int peekNext(UKBYTE &b);
126-
virtual int unget(UKBYTE b);
130+
virtual int getNext(UKBYTE &b);
131+
virtual int peekNext(UKBYTE &b);
132+
virtual int unget(UKBYTE b);
127133

128-
virtual int getNextW(UKWORD &w);
129-
virtual int peekNextW(UKWORD &w);
134+
virtual int getNextW(UKWORD &w);
135+
virtual int peekNextW(UKWORD &w);
130136

131137
virtual int getNextDW(UKDWORD &dw);
132138

133139
virtual int eos(); //end of stream
134140

135-
virtual int bookmark();
136-
virtual int gotoBookmark();
141+
virtual int bookmark();
142+
virtual int gotoBookmark();
137143

138-
virtual ~FileBIStream();
144+
virtual ~FileBIStream();
139145
};
140146

141-
142147
//----------------------------------------------------
143148
class StringBOStream : public ByteOutStream
144149
{
145-
protected:
146-
UKBYTE *m_buf, *m_current;
147-
int m_out;
148-
int m_len;
149-
int m_bad;
150-
public:
151-
StringBOStream(UKBYTE *buf, int len);
152-
virtual int putB(UKBYTE b);
153-
virtual int putW(UKWORD w);
154-
virtual int puts(const char *s, int size = -1);
155-
virtual int isOK(); // get current stream state
156-
157-
virtual int close()
158-
{
159-
return 1;
160-
};
161-
162-
void reopen();
163-
int getOutBytes() {
164-
return m_out;
165-
}
150+
protected:
151+
UKBYTE *m_buf, *m_current;
152+
int m_out;
153+
int m_len;
154+
int m_bad;
155+
public:
156+
StringBOStream(UKBYTE *buf, int len);
157+
virtual int putB(UKBYTE b);
158+
virtual int putW(UKWORD w);
159+
virtual int puts(const char *s, int size = -1);
160+
virtual int isOK(); // get current stream state
161+
162+
virtual int close()
163+
{
164+
return 1;
165+
};
166+
167+
void reopen();
168+
int getOutBytes()
169+
{
170+
return m_out;
171+
}
166172
};
167173

168174
//----------------------------------------------------
169175
class FileBOStream : public ByteOutStream
170176
{
171-
protected:
172-
FILE *m_file;
173-
int m_bufSize;
174-
char *m_buf;
175-
int m_own;
176-
int m_bad;
177-
178-
public:
179-
FileBOStream(int bufsize = 8192, char *buf = NULL);
180-
// FileBOStream(char *fileName, int bufsize = 8192, void *buf = NULL);
181-
182-
int open(const char *fileName);
183-
void attach(FILE *);
184-
virtual int close();
185-
186-
virtual int putB(UKBYTE b);
187-
virtual int putW(UKWORD w);
188-
virtual int puts(const char *s, int size = -1);
189-
virtual int isOK(); // get current stream state
190-
virtual ~FileBOStream();
177+
protected:
178+
FILE *m_file;
179+
int m_bufSize;
180+
char *m_buf;
181+
int m_own;
182+
int m_bad;
183+
184+
public:
185+
FileBOStream(int bufsize = 8192, char *buf = NULL);
186+
/*
187+
FileBOStream(char *fileName, int bufsize = 8192, void *buf = NULL);
188+
*/
189+
190+
int open(const char *fileName);
191+
void attach(FILE *);
192+
virtual int close();
193+
194+
virtual int putB(UKBYTE b);
195+
virtual int putW(UKWORD w);
196+
virtual int puts(const char *s, int size = -1);
197+
virtual int isOK(); // get current stream state
198+
virtual ~FileBOStream();
191199
};
192200

193-
194201
#endif

src/byteio/prehdr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#define AFX_STDAFX_H__E9288DDD_DB2B_413C_A8E3_E079B0E3C763__INCLUDED_
88

99
#if _MSC_VER > 1000
10-
#pragma once
10+
#pragma once
1111
#endif // _MSC_VER > 1000
1212

13-
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
13+
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
1414

1515

1616
// TODO: reference additional headers your program requires here

0 commit comments

Comments
 (0)