32 #include <itpp/itexports.h>
39 #pragma warning( disable : 4250 )
49 bool exist(
const std::string& name);
89 if (switch_endianity) {
90 if (native_endianity == l_endian)
96 return native_endianity;
111 if (native_endianity == e)
112 switch_endianity =
false;
114 switch_endianity =
true;
130 namespace binfile_details
161 std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary);
165 void open (
const char * filename,
166 std::ios_base::openmode mode = std::ios_base::out | std::ios_base::binary )
167 {_str->open(filename,mode);}
173 {_str->
write(c,n);
return *
this;}
176 {_str->
put(c);
return *
this;};
178 std::streampos tellp()
179 {
return _str->
tellp();}
182 {_str->
seekp(pos);
return *
this;}
185 {_str->
seekp(pos,way);
return *
this;}
188 {_str->
flush();
return *
this;}
191 bool good()
const {
return _str->good();}
193 bool eof()
const {
return _str->eof();}
195 bool fail()
const {
return _str->fail();}
197 bool bad()
const {
return _str->bad();}
202 operator bool()
const {
return _str->good();}
205 std::ios_base::iostate
rdstate()
const {
return _str->rdstate();}
207 void setstate (std::ios_base::iostate state) {_str->setstate(state);}
209 void clear (std::ios_base::iostate state = std::ios_base::goodbit) {_str->clear(state);}
211 std::ios_base::iostate
exceptions()
const {
return _str->exceptions();}
213 void exceptions (std::ios_base::iostate except) {_str->exceptions(except);}
251 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary);
254 {
return _str->is_open();}
256 void open (
const char * filename,
257 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::binary)
258 {_str->open(filename,mode);}
262 std::streamsize
gcount()
const {
return _str->gcount();}
264 int get() {
return _str->get();}
269 {_str->
get(s,n);
return *
this;}
272 {_str->
get(s,n,delim);
return *
this;}
275 {_str->
getline(s,n);
return *
this;}
277 {_str->
getline(s,n,delim);
return *
this;}
280 {_str->
ignore(n,delim);
return *
this;}
282 int peek() {
return _str->peek();}
285 {_str->
read(s,n);
return *
this;}
287 std::streamsize readsome (
char* s, std::streamsize n)
291 {_str->
putback(c);
return *
this;}
295 std::streampos
tellg() {
return _str->tellg();}
298 {_str->
seekg(pos);
return *
this;}
301 {_str->
seekg(pos,way);
return *
this;}
304 bool good()
const {
return _str->good();}
306 bool eof()
const {
return _str->eof();}
308 bool fail()
const {
return _str->fail();}
310 bool bad()
const {
return _str->bad();}
315 operator bool()
const {
return _str->good();}
318 std::ios_base::iostate
rdstate()
const {
return _str->rdstate();}
320 void setstate (std::ios_base::iostate state) {_str->setstate(state);}
322 void clear (std::ios_base::iostate state = std::ios_base::goodbit) {_str->clear(state);}
324 std::ios_base::iostate
exceptions()
const {
return _str->exceptions();}
326 void exceptions (std::ios_base::iostate except) {_str->exceptions(except);}
365 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out | std::ios_base::binary);
369 void open (
const char * filename,
370 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out | std::ios_base::binary)
371 {_str->open(filename,mode);}
377 {_str->
write(c,n);
return *
this;};
380 {_str->
put(c);
return *
this;};
382 std::streampos
tellp() {
return _str->tellp();}
385 {_str->
seekp(pos);
return *
this;}
388 {_str->
seekp(pos,way);
return *
this;}
392 std::streamsize
gcount()
const {
return _str->gcount();}
394 int get() {
return _str->get();}
399 {_str->
get(s,n);
return *
this;}
402 {_str->
get(s,n,delim);
return *
this;}
405 {_str->
getline(s,n);
return *
this;}
407 {_str->
getline(s,n,delim);
return *
this;}
410 {_str->
ignore(n,delim);
return *
this;}
412 int peek() {
return _str->peek();}
415 {_str->
read(s,n);
return *
this;}
417 std::streamsize readsome (
char* s, std::streamsize n)
421 {_str->
putback(c);
return *
this;}
424 {_str->
unget();
return *
this;}
426 std::streampos
tellg() {
return _str->tellg();}
429 {_str->
seekg(pos);
return *
this;}
432 {_str->
seekg(pos,way);
return *
this;}
435 bool good()
const {
return _str->good();}
437 bool eof()
const {
return _str->eof();}
439 bool fail()
const {
return _str->fail();}
441 bool bad()
const {
return _str->bad();}
446 operator bool()
const {
return _str->good();}
449 std::ios_base::iostate
rdstate()
const {
return _str->rdstate();}
451 void setstate (std::ios_base::iostate state) {_str->setstate(state);}
453 void clear (std::ios_base::iostate state = std::ios_base::goodbit)
454 {_str->clear(state);}
456 std::ios_base::iostate
exceptions()
const {
return _str->exceptions();}
458 void exceptions (std::ios_base::iostate except) {_str->exceptions(except);}
502 void open(
const std::string& name,
bool trunc =
false, endian e = b_endian);
564 void open(
const std::string& name, endian e = b_endian);
630 void open(
const std::string& name,
bool trunc =
false, endian e = b_endian);
639 void open_readonly(
const std::string& name, endian e = b_endian);
706 #endif // #ifndef BINFILE_H