QPipe.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                            Named pipe i/o device                              *
00004 *                                                                               *
00005 *********************************************************************************
00006 *        Copyright (C) 2002-2006 by Niall Douglas.   All Rights Reserved.       *
00007 *       NOTE THAT I DO NOT PERMIT ANY OF MY CODE TO BE PROMOTED TO THE GPL      *
00008 *********************************************************************************
00009 * This code is free software; you can redistribute it and/or modify it under    *
00010 * the terms of the GNU Library General Public License v2.1 as published by the  *
00011 * Free Software Foundation EXCEPT that clause 3 does not apply ie; you may not  *
00012 * "upgrade" this code to the GPL without my prior written permission.           *
00013 * Please consult the file "License_Addendum2.txt" accompanying this file.       *
00014 *                                                                               *
00015 * This code is distributed in the hope that it will be useful,                  *
00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                          *
00018 *********************************************************************************
00019 * $Id:                                                                          *
00020 ********************************************************************************/
00021 
00022 
00023 #ifndef QPIPE_H
00024 #define QPIPE_H
00025 #include "QIODeviceS.h"
00026 
00027 namespace FX {
00028 
00033 class FXString;
00034 
00108 struct QPipePrivate;
00109 class FXAPIR QPipe : public QIODeviceS
00110 {
00111     QPipePrivate *p;
00112     bool creator, anonymous;
00113     QPipe(const QPipe &);
00114     QPipe &operator=(const QPipe &);
00115     virtual FXDLLLOCAL void *int_getOSHandle() const;
00116     friend class FXIPCChannel;
00117     void FXDLLLOCAL int_hack_makeWriteNonblocking() const;
00118     friend class QChildProcess;
00119     friend struct QChildProcessPrivate;
00120     void FXDLLLOCAL int_hack_makeHandlesInheritable() throw();
00121     void FXDLLLOCAL int_getOSHandles(void **buf) const throw();
00122     void FXDLLLOCAL int_setOSHandles(void **buf) throw();
00123 public:
00124     QPipe();
00130     QPipe(const FXString &name, bool isDeepPipe=false);
00131     ~QPipe();
00132 
00134     const FXString &name() const;
00136     void setName(const FXString &name);
00138     bool isUnique() const { return anonymous; }
00140     void setUnique(bool a) { anonymous=a; }
00141 
00143     bool create(FXuint mode=IO_ReadWrite);
00145     bool open(FXuint mode=IO_ReadWrite);
00147     void close();
00149     void flush();
00151     bool reset();
00152 
00154     bool atEnd() const;
00156     FXfval size() const;
00158     void truncate(FXfval size);
00160     FXfval at() const;
00162     bool at(FXfval newpos);
00163     virtual const FXACL &permissions() const;
00164     virtual void setPermissions(const FXACL &perms);
00166     static FXACL permissions(const FXString &name);
00168     static void setPermissions(const FXString &name, const FXACL &perms);
00169 
00178     FXuval readBlock(char *data, FXuval maxlen);
00188     FXuval writeBlock(const char *data, FXuval maxlen);
00189 
00191     int ungetch(int);
00192 public:
00197     FXuval maxAtomicLength();
00198 };
00199 
00200 } // namespace
00201 
00202 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:26 2009 for TnFOX by doxygen v1.4.7