]> git.saurik.com Git - wxWidgets.git/blame - include/wx/txtstrm.h
Project file update
[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
15#ifdef __GNUG__
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
28f5bdb4 31class WXDLLEXPORT wxTextInputStream
c7a9fa36 32{
fae05df5 33public:
c7a9fa36
RR
34 wxTextInputStream(wxInputStream& s, const wxString &sep=wxT(" \t") );
35 ~wxTextInputStream();
36
37 wxUint32 Read32();
38 wxUint16 Read16();
39 wxUint8 Read8();
40 double ReadDouble();
41 wxString ReadString(); // deprecated use ReadLine or ReadWord instead
42 wxString ReadLine();
43 wxString ReadWord();
44
45 wxString GetStringSeparators() const { return m_separators; }
46 void SetStringSeparators(const wxString &c) { m_separators = c; }
47
48 // Operators
49 wxTextInputStream& operator>>(wxString& word);
f6bcfd97 50 wxTextInputStream& operator>>(char& c);
c7a9fa36
RR
51 wxTextInputStream& operator>>(wxInt16& i);
52 wxTextInputStream& operator>>(wxInt32& i);
53 wxTextInputStream& operator>>(wxUint16& i);
54 wxTextInputStream& operator>>(wxUint32& i);
55 wxTextInputStream& operator>>(double& i);
56 wxTextInputStream& operator>>(float& f);
28f5bdb4 57
c7a9fa36 58 wxTextInputStream& operator>>( __wxTextInputManip func) { return func(*this); }
28f5bdb4 59
c7a9fa36
RR
60protected:
61 wxInputStream &m_input;
62 wxString m_separators;
191549ed 63
c7a9fa36
RR
64 bool EatEOL(const wxChar &c);
65 wxChar NextNonSeparators();
66 void SkipIfEndOfLine( wxChar c );
fae05df5
GL
67};
68
c7a9fa36
RR
69typedef enum {
70 wxEOL_NATIVE,
71 wxEOL_UNIX,
72 wxEOL_MAC,
28f5bdb4 73 wxEOL_DOS
c7a9fa36 74} wxEOL;
fae05df5 75
28f5bdb4 76class WXDLLEXPORT wxTextOutputStream
c7a9fa36
RR
77{
78public:
79 wxTextOutputStream( wxOutputStream& s, wxEOL mode = wxEOL_NATIVE );
80 virtual ~wxTextOutputStream();
81
82 void SetMode( wxEOL mode = wxEOL_NATIVE );
83 wxEOL GetMode() { return m_mode; }
84
85 void Write32(wxUint32 i);
86 void Write16(wxUint16 i);
87 void Write8(wxUint8 i);
88 virtual void WriteDouble(double d);
89 virtual void WriteString(const wxString& string);
28f5bdb4 90
c7a9fa36
RR
91 wxTextOutputStream& operator<<(const wxChar *string);
92 wxTextOutputStream& operator<<(const wxString& string);
f6bcfd97 93 wxTextOutputStream& operator<<(char c);
c7a9fa36
RR
94 wxTextOutputStream& operator<<(wxInt16 c);
95 wxTextOutputStream& operator<<(wxInt32 c);
96 wxTextOutputStream& operator<<(wxUint16 c);
97 wxTextOutputStream& operator<<(wxUint32 c);
98 wxTextOutputStream& operator<<(double f);
99 wxTextOutputStream& operator<<(float f);
28f5bdb4 100
c7a9fa36 101 wxTextOutputStream& operator<<( __wxTextOutputManip func) { return func(*this); }
28f5bdb4 102
c7a9fa36
RR
103protected:
104 wxOutputStream &m_output;
105 wxEOL m_mode;
fae05df5
GL
106};
107
108#endif
109 // wxUSE_STREAMS
110
111#endif
112 // _WX_DATSTREAM_H_