ARTS 2.5.4 (git: 31ce4f0e)
bofstream.h
Go to the documentation of this file.
1/* Copyright (C) 2003-2012 Oliver Lemke <olemke@core-dump.info>
2
3 This program is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 USA. */
17
19// File description
21
30#ifndef BOFSTREAM_H_INCLUDED
31#define BOFSTREAM_H_INCLUDED
32
33#include <fstream>
34
35#include "binio.h"
36
38
42class bofstream : public binostream, public ofstream {
43 public:
44 bofstream() : ofstream() {}
45
46 explicit bofstream(const char* name,
47 ios::openmode mode = ios::out | ios::trunc | ios::binary)
48 : ofstream(name, mode) {}
49
50 void seek(long spos, Offset offs) override final;
51 streampos pos() override final;
52
53 void putByte(bofstream::Byte b) override final;
54 void putRaw(const char* c, streamsize n) override final { this->write(c, n); }
55};
56
57/* Overloaded output operators */
58bofstream& operator<<(bofstream& bof, double n);
59
60bofstream& operator<<(bofstream& bof, float n);
61
62bofstream& operator<<(bofstream& bof, std::int64_t n);
63
64bofstream& operator<<(bofstream& bof, int n);
65
66#endif
bofstream & operator<<(bofstream &bof, double n)
Definition: bofstream.cc:76
enum { Set, Add, End } Offset
Definition: binio.h:64
unsigned char Byte
Definition: binio.h:82
Binary output file stream class.
Definition: bofstream.h:42
streampos pos() override final
Definition: bofstream.cc:53
void putByte(bofstream::Byte b) override final
Definition: bofstream.cc:61
void seek(long spos, Offset offs) override final
Definition: bofstream.cc:34
bofstream(const char *name, ios::openmode mode=ios::out|ios::trunc|ios::binary)
Definition: bofstream.h:46
bofstream()
Definition: bofstream.h:44
void putRaw(const char *c, streamsize n) override final
Definition: bofstream.h:54
#define c
#define b