00001 /* 00002 * rwpipe.h - bidirectional pipe 00003 * Copyright (C) 2003 Charles Yates <charles.yates@pandora.be> 00004 * Copyright (C) 2003-2007 Dan Dennedy <dan@dennedy.org> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #ifndef _RWPIPE_H 00022 #define _RWPIPE_H 00023 00024 #include <string> 00025 using std::string; 00026 #include <vector> 00027 using std::vector; 00028 00029 #include <glib.h> 00030 00031 class RWPipe 00032 { 00033 private: 00034 int m_pid; 00035 00036 protected: 00037 int m_reader; 00038 int m_writer; 00039 GError *m_error; 00040 00041 public: 00042 RWPipe( ); 00043 ~RWPipe( ); 00044 bool run( string command ); 00045 bool isRunning( ); 00046 int readData( void *data, int size ); 00047 int readLine( char *text, int max ); 00048 int writeData( void *data, int size ); 00049 void stop( ); 00050 00051 }; 00052 00053 #endif
1.4.2