00001 /* Copyright (c) 2006, Gennady Bystritsky <bystr@mac.com> 00002 * 00003 * Distributed under the MIT Licence. 00004 * This is free software. See 'LICENSE' for details. 00005 * You must read and accept the license prior to use. 00006 */ 00007 00008 #ifndef _SK_IO_PTY_ 00009 #define _SK_IO_PTY_ 00010 00011 #include <sk/util/Holder.hxx> 00012 #include <sk/util/String.h> 00013 #include <sk/io/DelegatingTty.h> 00014 #include <sk/io/Pipe.h> 00015 #include <sk/io/FileDescriptorInputStream.h> 00016 #include <sk/io/FileDescriptorOutputStream.h> 00017 #include <sk/rt/Scope.h> 00018 00019 namespace sk { 00020 namespace io { 00021 class TtyFileDescriptor; 00022 00023 class Pty 00024 : public sk::io::DelegatingTty 00025 { 00026 public: 00027 Pty(); 00028 virtual ~Pty(); 00029 00030 const sk::util::String getName() const; 00031 00032 void close(); 00033 void closeTty(); 00034 00035 sk::io::Pipe& getMasterSlavePipe(); 00036 sk::io::Pipe& getSlaveMasterPipe(); 00037 00038 // sk::util::Object re-implementation. 00039 const sk::util::Class getClass() const; 00040 00041 private: 00042 Pty(const Pty& other); 00043 Pty& operator = (const Pty& other); 00044 00045 // sk::io::DelegatingTty implementation. 00046 sk::io::Tty& getTty(); 00047 const sk::io::Tty& getTty() const; 00048 00049 const sk::rt::Scope _scope; 00050 sk::util::String _name; 00051 sk::util::Holder<sk::io::TtyFileDescriptor> _ttyHolder; 00052 sk::util::Holder<sk::io::Pipe> _slaveMasterPipeHolder; 00053 sk::util::Holder<sk::io::Pipe> _masterSlavePipeHolder; 00054 }; 00055 } 00056 } 00057 00058 #endif /* _SK_IO_PTY_ */