dlvhex  2.5.0
InputProvider Class Reference

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< Implpimpl

Detailed Description

Abstractly provides input to dlvhex from various sources.

Definition at line 50 of file InputProvider.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 62 of file InputProvider.cpp.

Destructor.

Definition at line 68 of file InputProvider.cpp.


Member Function Documentation

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.

Parameters:
filenameCSV file to read from (semicolon-separated).
predicatePredicate 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.

Parameters:
filenameFile 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.

Parameters:
iStream to read from.
contentnameUnique 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.

Parameters:
contentString to read from.
contentnameUnique 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.

Returns:
Vector of input names.

Definition at line 180 of file InputProvider.cpp.

References pimpl.

std::istream & InputProvider::getAsStream ( )

Get input as a single stream.

Returns:
Input 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.

Returns:
True if there is at least one input and false otherwise.

Definition at line 174 of file InputProvider.cpp.

References pimpl.

Referenced by getAsStream().


Field Documentation


The documentation for this class was generated from the following files: