Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXMemoryStream.h
1 /********************************************************************************
2 * *
3 * M e m o r y S t r e a m C l a s s e s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXMEMORYSTREAM_H
22 #define FXMEMORYSTREAM_H
23 
24 #ifndef FXSTREAM_H
25 #include "FXStream.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 class FXAPI FXMemoryStream : public FXStream {
33 protected:
34  virtual FXuval writeBuffer(FXuval count);
35  virtual FXuval readBuffer(FXuval count);
36 public:
37 
39  FXMemoryStream(const FXObject* cont=NULL);
40 
42  FXMemoryStream(FXStreamDirection save_or_load,FXuchar* data=NULL,FXuval size=~0UL,FXbool owned=false);
43 
55  FXbool open(FXStreamDirection save_or_load,FXuchar* data=NULL,FXuval size=~0UL,FXbool owned=false);
56 
58  void takeBuffer(FXuchar*& data,FXuval& size);
59 
61  void giveBuffer(FXuchar *data,FXuval size);
62 
64  FXlong position() const { return FXStream::position(); }
65 
67  virtual FXbool position(FXlong offset,FXWhence whence=FXFromStart);
68 
70  FXMemoryStream& operator<<(const FXuchar& v){ FXStream::operator<<(v); return *this; }
71  FXMemoryStream& operator<<(const FXchar& v){ FXStream::operator<<(v); return *this; }
72  FXMemoryStream& operator<<(const FXbool& v){ FXStream::operator<<(v); return *this; }
73  FXMemoryStream& operator<<(const FXushort& v){ FXStream::operator<<(v); return *this; }
74  FXMemoryStream& operator<<(const FXshort& v){ FXStream::operator<<(v); return *this; }
75  FXMemoryStream& operator<<(const FXuint& v){ FXStream::operator<<(v); return *this; }
76  FXMemoryStream& operator<<(const FXint& v){ FXStream::operator<<(v); return *this; }
77  FXMemoryStream& operator<<(const FXfloat& v){ FXStream::operator<<(v); return *this; }
78  FXMemoryStream& operator<<(const FXdouble& v){ FXStream::operator<<(v); return *this; }
79  FXMemoryStream& operator<<(const FXlong& v){ FXStream::operator<<(v); return *this; }
80  FXMemoryStream& operator<<(const FXulong& v){ FXStream::operator<<(v); return *this; }
81 
83  FXMemoryStream& save(const FXuchar* p,FXuval n){ FXStream::save(p,n); return *this; }
84  FXMemoryStream& save(const FXchar* p,FXuval n){ FXStream::save(p,n); return *this; }
85  FXMemoryStream& save(const FXbool* p,FXuval n){ FXStream::save(p,n); return *this; }
86  FXMemoryStream& save(const FXushort* p,FXuval n){ FXStream::save(p,n); return *this; }
87  FXMemoryStream& save(const FXshort* p,FXuval n){ FXStream::save(p,n); return *this; }
88  FXMemoryStream& save(const FXuint* p,FXuval n){ FXStream::save(p,n); return *this; }
89  FXMemoryStream& save(const FXint* p,FXuval n){ FXStream::save(p,n); return *this; }
90  FXMemoryStream& save(const FXfloat* p,FXuval n){ FXStream::save(p,n); return *this; }
91  FXMemoryStream& save(const FXdouble* p,FXuval n){ FXStream::save(p,n); return *this; }
92  FXMemoryStream& save(const FXlong* p,FXuval n){ FXStream::save(p,n); return *this; }
93  FXMemoryStream& save(const FXulong* p,FXuval n){ FXStream::save(p,n); return *this; }
94 
96  FXMemoryStream& operator>>(FXuchar& v){ FXStream::operator>>(v); return *this; }
97  FXMemoryStream& operator>>(FXchar& v){ FXStream::operator>>(v); return *this; }
98  FXMemoryStream& operator>>(FXbool& v){ FXStream::operator>>(v); return *this; }
99  FXMemoryStream& operator>>(FXushort& v){ FXStream::operator>>(v); return *this; }
100  FXMemoryStream& operator>>(FXshort& v){ FXStream::operator>>(v); return *this; }
101  FXMemoryStream& operator>>(FXuint& v){ FXStream::operator>>(v); return *this; }
102  FXMemoryStream& operator>>(FXint& v){ FXStream::operator>>(v); return *this; }
103  FXMemoryStream& operator>>(FXfloat& v){ FXStream::operator>>(v); return *this; }
104  FXMemoryStream& operator>>(FXdouble& v){ FXStream::operator>>(v); return *this; }
105  FXMemoryStream& operator>>(FXlong& v){ FXStream::operator>>(v); return *this; }
106  FXMemoryStream& operator>>(FXulong& v){ FXStream::operator>>(v); return *this; }
107 
109  FXMemoryStream& load(FXuchar* p,FXuval n){ FXStream::load(p,n); return *this; }
110  FXMemoryStream& load(FXchar* p,FXuval n){ FXStream::load(p,n); return *this; }
111  FXMemoryStream& load(FXbool* p,FXuval n){ FXStream::load(p,n); return *this; }
112  FXMemoryStream& load(FXushort* p,FXuval n){ FXStream::load(p,n); return *this; }
113  FXMemoryStream& load(FXshort* p,FXuval n){ FXStream::load(p,n); return *this; }
114  FXMemoryStream& load(FXuint* p,FXuval n){ FXStream::load(p,n); return *this; }
115  FXMemoryStream& load(FXint* p,FXuval n){ FXStream::load(p,n); return *this; }
116  FXMemoryStream& load(FXfloat* p,FXuval n){ FXStream::load(p,n); return *this; }
117  FXMemoryStream& load(FXdouble* p,FXuval n){ FXStream::load(p,n); return *this; }
118  FXMemoryStream& load(FXlong* p,FXuval n){ FXStream::load(p,n); return *this; }
119  FXMemoryStream& load(FXulong* p,FXuval n){ FXStream::load(p,n); return *this; }
120 
122  FXMemoryStream& saveObject(const FXObject* v){ FXStream::saveObject(v); return *this; }
123 
126 
128  virtual ~FXMemoryStream();
129  };
130 
131 }
132 
133 #endif

Copyright © 1997-2016 Jeroen van der Zijp