Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ExternalDataSource.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013    File:       ExternalDataSource.h
00014 
00015    Author:     Andreas Schwab <schwab@suse.de>
00016    Maintainer: Thomas Roelz <tom@suse.de>
00017 
00018 /-*/
00019 
00020 #ifndef ExternalDataSource_h
00021 #define ExternalDataSource_h
00022 
00023 #include <stdio.h>
00024 
00025 #include <string>
00026 
00030 class ExternalDataSource
00031 {
00032 protected:
00033     FILE *inputfile;
00034     FILE *outputfile;
00035 
00036 private:
00037     char *linebuffer;
00038     size_t linebuffer_size;
00039 
00040 public:
00047     ExternalDataSource(FILE *inputfile = 0, FILE *outputfile = 0);
00048 
00052     virtual ~ExternalDataSource();
00053 
00059     bool send (const char *buffer, size_t length);
00060 
00065     bool send (std::string s);
00066 
00073     size_t receive(char *buffer, size_t length);
00074 
00079     std::string receiveLine();
00080 
00085     std::string receiveUpto(char c);
00091     void setBlocking(bool mode);
00092 
00096     virtual int close();
00097 
00101     FILE *inputFile() const  { return inputfile; }
00102 
00106     FILE *outputFile() const { return outputfile; }
00107 };
00108 
00109 
00110 #endif // ExternalDataSource_h
00111 

Generated on Thu Feb 23 23:56:10 2006 for liby2util by doxygen 1.3.6