1 #ifndef PIPE_READER_H__
2 #define PIPE_READER_H__
6 * PROJECT: System regression tool for ReactOS
7 * LICENSE: GPL - See COPYING in the top level directory
8 * FILE: tools/sysreg/conf_parser.h
9 * PURPOSE: file reading support
10 * PROGRAMMERS: Johannes Anderwald (johannes.anderwald at sbox tugraz at)
15 #include "user_types.h"
16 #include "data_source.h"
26 //---------------------------------------------------------------------------------------
30 /// Description: this class implements a pipe reader. It uses _popen to perform opening of
33 class PipeReader
: public DataSource
37 //---------------------------------------------------------------------------------------
41 /// Description: constructor of class PipeReader
45 //---------------------------------------------------------------------------------------
47 /// virtual ~PipeReader
49 /// Description: destructor of class PipeReader
51 virtual ~PipeReader();
53 //---------------------------------------------------------------------------------------
57 /// Description: this function attempts to open a pipe. If an pipe is already open or
58 /// it fails to open a pipe, the function returns false
60 /// @param PipeCmd command of the pipe to open
61 /// @param AccessMode on how to open the pipe
62 /// accepted modes are t ... text mode - not compatible with b
63 /// b ... binary mode - not compatible with t
64 /// r ... allows reading from the pipe
65 /// w ... allows writing to the pipe
68 virtual bool openSource(const string
& PipeCmd
);
70 //---------------------------------------------------------------------------------------
74 /// Description: closes a pipe. Returns true on success
78 virtual bool closeSource();
80 //---------------------------------------------------------------------------------------
84 /// Description: attempts to read from the pipe. Returns true on success. If it returns
85 /// false, call PipeReader::isEoF() to determine if the pipe should be closed
87 /// @param Buffer to be written to
88 /// @return string::size_type
90 bool readSource(std::vector
<string
> & lines
);
92 //---------------------------------------------------------------------------------------
96 /// Description: returns true if the pipe has reached end of file. The caller should call
97 /// closePipe if this function returns true
99 virtual bool isSourceOpen();
104 }; // end of class PipeReader
106 } // end of namespace System_
110 #endif /* end of PIPE_READER_H__ */