PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
conchan.h
Go to the documentation of this file.
1 /*
2  * conchan.h
3  *
4  * Console I/O channel class.
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25  * All Rights Reserved.
26  *
27  * Contributor(s): ______________________________________.
28  *
29  */
30 
31 #ifndef PTLIB_CONSOLECHANNEL_H
32 #define PTLIB_CONSOLECHANNEL_H
33 
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
37 
39 
40 // Console Channel
42 
43 
45 class PConsoleChannel : public PChannel
46 {
47  PCLASSINFO(PConsoleChannel, PChannel);
48 
49  public:
50  enum ConsoleType {
53  StandardError
54  };
55 
57  enum {
58  KeyLeft = 0x10000, // Larger than possible Unicode character return
69 
70  KeyFuncBase = 0x10100,
71  KeyF1 = KeyFuncBase+1,
83  // Additional function keys have codes from here
84 
85  MouseEvent = 0x40000000,
86  MouseButton1 = 1,
87  MouseButton2 = 2,
88  MouseButton3 = 4,
89  MouseButton4 = 8,
90  MouseClickShift = 4,
91  MouseDoubleClick = 0x80,
92  MouseShiftKey = 0x100,
93  MouseCtrlKey = 0x100,
94  MouseAltKey = 0x200,
95  MouseRowShift = 20,
96  MouseColShift = 12,
97  };
98 
101  PConsoleChannel();
103 
106  ConsoleType type
107  );
108 
110  ~PConsoleChannel() { Close(); }
112 
120  virtual PString GetName() const;
121 
126  virtual PBoolean Close();
127 
135  virtual int ReadChar();
136 
144  virtual bool SetLocalEcho(
145  bool localEcho
146  );
147 
154  virtual bool SetLineBuffered(
155  bool lineBuffered
156  );
158 
165  virtual PBoolean Open(
166  ConsoleType type
167  );
168 
171  virtual bool GetTerminalSize(
172  unsigned & rows,
173  unsigned & columns
174  );
176 
177 
178 // Include platform dependent part of class
179 #ifdef _WIN32
180 #include "msos/ptlib/conchan.h"
181 #else
182 #include "unix/ptlib/conchan.h"
183 #endif
184 
185 };
186 
187 
188 #endif // PTLIB_CONSOLECHANNEL_H
189 
190 
191 // End Of File ///////////////////////////////////////////////////////////////
Definition: conchan.h:79
Definition: conchan.h:78
Definition: conchan.h:77
Definition: conchan.h:75
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:2164
Definition: conchan.h:52
Definition: conchan.h:73
ConsoleType
Definition: conchan.h:50
Definition: conchan.h:65
Definition: conchan.h:82
Definition: conchan.h:68
Definition: conchan.h:51
This class defines an I/O channel that communicates via a console.
Definition: conchan.h:45
~PConsoleChannel()
Make sure dtor closes channel.
Definition: conchan.h:110
Definition: conchan.h:66
Abstract class defining I/O channel semantics.
Definition: channel.h:103
bool PBoolean
Definition: object.h:174
Definition: conchan.h:59
Definition: conchan.h:63
The character string class.
Definition: pstring.h:108
#define P_PUSH_MSVC_WARNINGS(warnings)
Definition: object.h:153
Definition: conchan.h:64
Definition: conchan.h:72
Definition: conchan.h:80
Definition: conchan.h:61
Definition: conchan.h:81
Definition: conchan.h:67
Definition: conchan.h:76
Definition: conchan.h:60
Definition: conchan.h:62
Definition: conchan.h:74