From 68d41d3b214856f8d321b4dbdffc0cd4c7333c36 Mon Sep 17 00:00:00 2001 From: Krzysztof Dermont Date: Mon, 23 Jun 2014 23:19:55 +0200 Subject: More work on streams --- src/common/resources/outputstreambuffer.h | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/common/resources/outputstreambuffer.h (limited to 'src/common/resources/outputstreambuffer.h') diff --git a/src/common/resources/outputstreambuffer.h b/src/common/resources/outputstreambuffer.h new file mode 100644 index 0000000..1d98791 --- /dev/null +++ b/src/common/resources/outputstreambuffer.h @@ -0,0 +1,45 @@ +// * This file is part of the COLOBOT source code +// * Copyright (C) 2014 Polish Portal of Colobot (PPC) +// * +// * This program is free software: you can redistribute it and/or modify +// * it under the terms of the GNU General Public License as published by +// * the Free Software Foundation, either version 3 of the License, or +// * (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have received a copy of the GNU General Public License +// * along with this program. If not, see http://www.gnu.org/licenses/. + +#pragma once + +#include +#include +#include + +class COutputStreamBuffer : public std::streambuf +{ +public: + COutputStreamBuffer(size_t buffer_size = 512); + virtual ~COutputStreamBuffer(); + + void open(const std::string &filename); + void close(); + bool is_open(); + +private: + int_type overflow(int_type ch); + int sync(); + + // copy ctor and assignment not implemented; + // copying not allowed + COutputStreamBuffer(const COutputStreamBuffer &); + COutputStreamBuffer &operator= (const COutputStreamBuffer &); + + PHYSFS_File *m_file; + char *m_buffer; + size_t m_buffer_size; +}; -- cgit v1.2.3-1-g7c22 From 6a1ceba8c0914691ebc873fd666e7cde1cffdb64 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Sun, 7 Sep 2014 19:26:06 +0200 Subject: Some cleaning up --- src/common/resources/outputstreambuffer.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/common/resources/outputstreambuffer.h') diff --git a/src/common/resources/outputstreambuffer.h b/src/common/resources/outputstreambuffer.h index 1d98791..1318530 100644 --- a/src/common/resources/outputstreambuffer.h +++ b/src/common/resources/outputstreambuffer.h @@ -25,7 +25,6 @@ class COutputStreamBuffer : public std::streambuf public: COutputStreamBuffer(size_t buffer_size = 512); virtual ~COutputStreamBuffer(); - void open(const std::string &filename); void close(); bool is_open(); @@ -38,7 +37,6 @@ private: // copying not allowed COutputStreamBuffer(const COutputStreamBuffer &); COutputStreamBuffer &operator= (const COutputStreamBuffer &); - PHYSFS_File *m_file; char *m_buffer; size_t m_buffer_size; -- cgit v1.2.3-1-g7c22 From 47ea8a1175488564c11e09f71447cb19515c6e6c Mon Sep 17 00:00:00 2001 From: krzys-h Date: Wed, 15 Oct 2014 21:14:34 +0200 Subject: Updated some more license headers --- src/common/resources/outputstreambuffer.h | 33 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/common/resources/outputstreambuffer.h') diff --git a/src/common/resources/outputstreambuffer.h b/src/common/resources/outputstreambuffer.h index 1318530..758c4df 100644 --- a/src/common/resources/outputstreambuffer.h +++ b/src/common/resources/outputstreambuffer.h @@ -1,18 +1,21 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2014 Polish Portal of Colobot (PPC) -// * -// * This program is free software: you can redistribute it and/or modify -// * it under the terms of the GNU General Public License as published by -// * the Free Software Foundation, either version 3 of the License, or -// * (at your option) any later version. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program. If not, see http://www.gnu.org/licenses/. +/* + * This file is part of the Colobot: Gold Edition source code + * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam + * http://epsiteс.ch; http://colobot.info; http://github.com/colobot + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://gnu.org/licenses + */ #pragma once -- cgit v1.2.3-1-g7c22