SerUt  1.1.1 (development version)
dummyserializer.h
Go to the documentation of this file.
1 /*
2 
3  This file is a part of SerUt, a library containing some serialization
4  utilities.
5 
6  Copyright (C) 2008-2018 Jori Liesenborgs
7 
8  Contact: jori.liesenborgs@gmail.com
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23  USA
24 
25 */
26 
31 #ifndef SERUT_DUMMYSERIALIZER_H
32 
33 #define SERUT_DUMMYSERIALIZER_H
34 
35 #include "serutconfig.h"
36 #include "serializationinterface.h"
37 
38 namespace serut
39 {
40 
43 class SERUT_IMPORTEXPORT DummySerializer : public SerializationInterface
44 {
45 public:
46  DummySerializer() { m_counter = 0; }
47  ~DummySerializer() { }
48 
50  size_t getBytesWritten() const { return m_counter; }
51 
52  bool readBytes(void *pBuffer, size_t amount);
53  bool writeBytes(const void *pBuffer, size_t amount) { m_counter += amount; return true; }
54 private:
55  size_t m_counter;
56 };
57 
58 } // end namespace
59 
60 #endif // SERUT_DUMMYSERIALIZER_H
61 
A dummy serializer which simply counts the number of bytes written but does not actually write any da...
Definition: dummyserializer.h:44
size_t getBytesWritten() const
Returns the number of bytes that currently have been written.
Definition: dummyserializer.h:50
Generic serialization interface.
Definition: serializationinterface.h:58