yast2-core
ExternalDataSource.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
8 | |
9 | core system |
10 | (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12 
13  File: ExternalDataSource.h
14 
15  Author: Andreas Schwab <schwab@suse.de>
16  Maintainer: Thomas Roelz <tom@suse.de>
17 
18 /-*/
19 
20 #ifndef ExternalDataSource_h
21 #define ExternalDataSource_h
22 
23 #include <stdio.h>
24 
25 #include <string>
26 
31 {
32 protected:
33  FILE *inputfile;
34  FILE *outputfile;
35 
36 private:
37  char *linebuffer;
39 
40 public:
47  ExternalDataSource(FILE *inputfile = 0, FILE *outputfile = 0);
48 
52  virtual ~ExternalDataSource();
53 
59  bool send (const char *buffer, size_t length);
60 
65  bool send (std::string s);
66 
73  size_t receive(char *buffer, size_t length);
74 
79  std::string receiveLine();
80 
85  std::string receiveUpto(char c);
91  void setBlocking(bool mode);
92 
96  virtual int close();
97 
101  FILE *inputFile() const { return inputfile; }
102 
106  FILE *outputFile() const { return outputfile; }
107 };
108 
109 
110 #endif // ExternalDataSource_h
111 
ExternalDataSource(FILE *inputfile=0, FILE *outputfile=0)
Definition: ExternalDataSource.cc:37
size_t receive(char *buffer, size_t length)
Definition: ExternalDataSource.cc:110
void setBlocking(bool mode)
Definition: ExternalDataSource.cc:118
char * linebuffer
Definition: ExternalDataSource.h:37
virtual ~ExternalDataSource()
Definition: ExternalDataSource.cc:46
FILE * outputFile() const
Definition: ExternalDataSource.h:106
bool send(const char *buffer, size_t length)
Definition: ExternalDataSource.cc:55
std::string receiveUpto(char c)
Definition: ExternalDataSource.cc:76
size_t linebuffer_size
Definition: ExternalDataSource.h:38
FILE * inputfile
Definition: ExternalDataSource.h:33
Bidirectional stream to external data.
Definition: ExternalDataSource.h:30
FILE * outputfile
Definition: ExternalDataSource.h:34
std::string receiveLine()
Definition: ExternalDataSource.cc:144
virtual int close()
Definition: ExternalDataSource.cc:160
FILE * inputFile() const
Definition: ExternalDataSource.h:101

Generated on a sunny day for yast2-core by doxygen 1.8.11