dlvhex
2.5.0
|
Abstractly provides input to dlvhex from various sources. More...
#include <include/dlvhex2/InputProvider.h>
Data Structures | |
class | Impl |
Public Member Functions | |
InputProvider () | |
Constructor. | |
~InputProvider () | |
Destructor. | |
void | addStreamInput (std::istream &i, const std::string &contentname) |
Add input from a stream. | |
void | addStringInput (const std::string &content, const std::string &contentname) |
Add input from a string. | |
void | addFileInput (const std::string &filename) |
Add input from a file. | |
void | addCSVFileInput (const std::string &predicate, const std::string &filename) |
Add input from a file in CSV format. | |
bool | hasContent () const |
Checks if there is at least one input. | |
const std::vector< std::string > & | contentNames () const |
Returns the list of input names. | |
std::istream & | getAsStream () |
Get input as a single stream. | |
Private Attributes | |
boost::scoped_ptr< Impl > | pimpl |
Abstractly provides input to dlvhex from various sources.
Definition at line 50 of file InputProvider.h.
Constructor.
Definition at line 62 of file InputProvider.cpp.
Destructor.
Definition at line 68 of file InputProvider.cpp.
void InputProvider::addCSVFileInput | ( | const std::string & | predicate, |
const std::string & | filename | ||
) |
Add input from a file in CSV format.
Each line in the CSV file is stored as tuple in the extension of a given predicate, where the first element is the line number in the original file.
filename | CSV file to read from (semicolon-separated). |
predicate | Predicate used to store the CSV content. |
Definition at line 104 of file InputProvider.cpp.
References pimpl.
void InputProvider::addFileInput | ( | const std::string & | filename | ) |
Add input from a file.
filename | File to read from. |
Definition at line 90 of file InputProvider.cpp.
References pimpl.
void InputProvider::addStreamInput | ( | std::istream & | i, |
const std::string & | contentname | ||
) |
Add input from a stream.
i | Stream to read from. |
contentname | Unique name for this input. |
Definition at line 73 of file InputProvider.cpp.
References pimpl.
void InputProvider::addStringInput | ( | const std::string & | content, |
const std::string & | contentname | ||
) |
Add input from a string.
content | String to read from. |
contentname | Unique name for this input. |
Definition at line 83 of file InputProvider.cpp.
References pimpl.
const std::vector< std::string > & InputProvider::contentNames | ( | ) | const |
Returns the list of input names.
Definition at line 180 of file InputProvider.cpp.
References pimpl.
std::istream & InputProvider::getAsStream | ( | ) |
Get input as a single stream.
Definition at line 186 of file InputProvider.cpp.
References hasContent(), and pimpl.
bool InputProvider::hasContent | ( | ) | const |
Checks if there is at least one input.
Definition at line 174 of file InputProvider.cpp.
References pimpl.
Referenced by getAsStream().
boost::scoped_ptr<Impl> InputProvider::pimpl [private] |
Definition at line 94 of file InputProvider.h.
Referenced by addCSVFileInput(), addFileInput(), addStreamInput(), addStringInput(), contentNames(), getAsStream(), and hasContent().