diff options
Diffstat (limited to 'wxstreamex.h')
| -rw-r--r-- | wxstreamex.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/wxstreamex.h b/wxstreamex.h new file mode 100644 index 0000000..6174894 --- /dev/null +++ b/wxstreamex.h | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | /* | ||
| 2 | * This program is free software; you can redistribute it and/or modify | ||
| 3 | * it under the terms of the GNU General Public License as published by | ||
| 4 | * the Free Software Foundation; version 2 of the License. | ||
| 5 | * | ||
| 6 | * This program is distributed in the hope that it will be useful, | ||
| 7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 9 | * GNU General Public License for more details. | ||
| 10 | * | ||
| 11 | * You should have received a copy of the GNU General Public License | ||
| 12 | * along with this program; if not, write to the Free Software | ||
| 13 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 14 | * | ||
| 15 | * Authors: Manuel Mausz (manuel@mausz.at) | ||
| 16 | * Christian Raschko (c.raschko@netcore.at) | ||
| 17 | */ | ||
| 18 | |||
| 19 | #ifndef WXSTREAMEX_H | ||
| 20 | #define WXSTREAMEX_H | ||
| 21 | |||
| 22 | // Libraries | ||
| 23 | #include <wx/wx.h> | ||
| 24 | #include <wx/stream.h> | ||
| 25 | #include <wx/datstrm.h> | ||
| 26 | |||
| 27 | #define TS_MAX_LENGTH 4069 | ||
| 28 | |||
| 29 | //! wxDataOutputStreamEx. | ||
| 30 | /*! wxDataOutputStreamEx. | ||
| 31 | */ | ||
| 32 | class wxDataOutputStreamEx : public wxDataOutputStream | ||
| 33 | { | ||
| 34 | public: | ||
| 35 | wxDataOutputStreamEx(wxOutputStream &s) : wxDataOutputStream(s) | ||
| 36 | { | ||
| 37 | strm = &s; | ||
| 38 | } | ||
| 39 | |||
| 40 | /*! Writes a fixed string on the stream. | ||
| 41 | * \param str String to write. | ||
| 42 | * \param size Size of fixed string, filled with zeros. | ||
| 43 | * \return Returns false if fails. | ||
| 44 | */ | ||
| 45 | bool WriteFixedString(wxString const &str, wxUint8 size = 30); | ||
| 46 | |||
| 47 | /*! Writes zero terminated string on the stream with zero. | ||
| 48 | * \param str String to write. | ||
| 49 | * \return Returns false if fails. | ||
| 50 | */ | ||
| 51 | bool WriteZeroString(wxString const &str); | ||
| 52 | |||
| 53 | private: | ||
| 54 | wxOutputStream *strm; | ||
| 55 | }; | ||
| 56 | |||
| 57 | //! wxDataInputStreamEx. | ||
| 58 | /*! wxDataInputStreamEx. | ||
| 59 | */ | ||
| 60 | class wxDataInputStreamEx : public wxDataInputStream | ||
| 61 | { | ||
| 62 | public: | ||
| 63 | wxDataInputStreamEx(wxInputStream &s) : wxDataInputStream(s) | ||
| 64 | { | ||
| 65 | strm = &s; | ||
| 66 | } | ||
| 67 | |||
| 68 | /*! Reades a fixed string from the stream. | ||
| 69 | * \param str String to write to. | ||
| 70 | * \param size Size of the fixed string. | ||
| 71 | * \return Returns true if successful. | ||
| 72 | */ | ||
| 73 | bool ReadFixedString(wxString &str, wxUint8 size = 30); | ||
| 74 | |||
| 75 | /*! Reades a zero terminated string from the stream. | ||
| 76 | * \param str String to write to. | ||
| 77 | * \return Returns true if successful. | ||
| 78 | */ | ||
| 79 | bool ReadZeroString(wxString &str); | ||
| 80 | |||
| 81 | private: | ||
| 82 | wxInputStream *strm; | ||
| 83 | }; | ||
| 84 | |||
| 85 | #endif | ||
