]> git.saurik.com Git - wxWidgets.git/blame - include/wx/txtstrm.h
Added simplistic makefile/project files for wxWinCE.
[wxWidgets.git] / include / wx / txtstrm.h
CommitLineData
fae05df5
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: txtstrm.h
3// Purpose: Text stream classes
4// Author: Guilhem Lavaux
5// Modified by:
6// Created: 28/06/1998
7// RCS-ID: $Id$
8// Copyright: (c) Guilhem Lavaux
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_TXTSTREAM_H_
13#define _WX_TXTSTREAM_H_
14
af49c4b8 15#if defined(__GNUG__) && !defined(__APPLE__)
fae05df5
GL
16#pragma interface "txtstrm.h"
17#endif
18
ed58dbea 19#include "wx/stream.h"
fae05df5
GL
20
21#if wxUSE_STREAMS
22
65045edd
RR
23class WXDLLEXPORT wxTextInputStream;
24class WXDLLEXPORT wxTextOutputStream;
25
26typedef wxTextInputStream& (*__wxTextInputManip)(wxTextInputStream&);
27typedef wxTextOutputStream& (*__wxTextOutputManip)(wxTextOutputStream&);
28
29WXDLLEXPORT wxTextOutputStream &endl( wxTextOutputStream &stream );
30
2b5f62a0 31
28f5bdb4 32class WXDLLEXPORT wxTextInputStream
c7a9fa36 33{
fae05df5 34public:
2b5f62a0
VZ
35#if wxUSE_UNICODE
36 wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t"), wxMBConv& conv = wxConvUTF8 );
37#else
c7a9fa36 38 wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t") );
2b5f62a0 39#endif
c7a9fa36
RR
40 ~wxTextInputStream();
41
42 wxUint32 Read32();
43 wxUint16 Read16();
44 wxUint8 Read8();
45 double ReadDouble();
46 wxString ReadString(); // deprecated use ReadLine or ReadWord instead
47 wxString ReadLine();
48 wxString ReadWord();
49
50 wxString GetStringSeparators() const { return m_separators; }
51 void SetStringSeparators(const wxString &c) { m_separators = c; }
52
53 // Operators
54 wxTextInputStream& operator>>(wxString& word);
f6bcfd97 55 wxTextInputStream& operator>>(char& c);
c7a9fa36
RR
56 wxTextInputStream& operator>>(wxInt16& i);
57 wxTextInputStream& operator>>(wxInt32& i);
58 wxTextInputStream& operator>>(wxUint16& i);
59 wxTextInputStream& operator>>(wxUint32& i);
60 wxTextInputStream& operator>>(double& i);
61 wxTextInputStream& operator>>(float& f);
28f5bdb4 62
c7a9fa36 63 wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); }
28f5bdb4 64
c7a9fa36
RR
65protected:
66 wxInputStream &m_input;
67 wxString m_separators;
2b5f62a0
VZ
68
69#if wxUSE_UNICODE
70 wxMBConv &m_conv;
71#endif
191549ed 72
c7a9fa36
RR
73 bool EatEOL(const wxChar &c);
74 wxChar NextNonSeparators();
75 void SkipIfEndOfLine( wxChar c );
fae05df5
GL
76};
77
2b5f62a0
VZ
78typedef enum
79{
c7a9fa36
RR
80 wxEOL_NATIVE,
81 wxEOL_UNIX,
82 wxEOL_MAC,
28f5bdb4 83 wxEOL_DOS
c7a9fa36 84} wxEOL;
fae05df5 85
28f5bdb4 86class WXDLLEXPORT wxTextOutputStream
c7a9fa36
RR
87{
88public:
2b5f62a0
VZ
89#if wxUSE_UNICODE
90 wxTextOutputStream( wxOutputStream& s, wxEOL mode = wxEOL_NATIVE, wxMBConv& conv = wxConvUTF8 );
91#else
c7a9fa36 92 wxTextOutputStream( wxOutputStream& s, wxEOL mode = wxEOL_NATIVE );
2b5f62a0 93#endif
c7a9fa36
RR
94 virtual ~wxTextOutputStream();
95
96 void SetMode( wxEOL mode = wxEOL_NATIVE );
97 wxEOL GetMode() { return m_mode; }
98
99 void Write32(wxUint32 i);
100 void Write16(wxUint16 i);
101 void Write8(wxUint8 i);
102 virtual void WriteDouble(double d);
103 virtual void WriteString(const wxString& string);
28f5bdb4 104
c7a9fa36
RR
105 wxTextOutputStream& operator<<(const wxChar *string);
106 wxTextOutputStream& operator<<(const wxString& string);
f6bcfd97 107 wxTextOutputStream& operator<<(char c);
c7a9fa36
RR
108 wxTextOutputStream& operator<<(wxInt16 c);
109 wxTextOutputStream& operator<<(wxInt32 c);
110 wxTextOutputStream& operator<<(wxUint16 c);
111 wxTextOutputStream& operator<<(wxUint32 c);
112 wxTextOutputStream& operator<<(double f);
113 wxTextOutputStream& operator<<(float f);
28f5bdb4 114
c7a9fa36 115 wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); }
28f5bdb4 116
c7a9fa36
RR
117protected:
118 wxOutputStream &m_output;
119 wxEOL m_mode;
2b5f62a0
VZ
120
121#if wxUSE_UNICODE
122 wxMBConv &m_conv;
123#endif
124
fae05df5
GL
125};
126
127#endif
128 // wxUSE_STREAMS
129
130#endif
131 // _WX_DATSTREAM_H_