dlvhex  2.5.0
include/dlvhex2/InputProvider.h
Go to the documentation of this file.
00001 /* dlvhex -- Answer-Set Programming with external interfaces.
00002  * Copyright (C) 2005-2007 Roman Schindlauer
00003  * Copyright (C) 2006-2015 Thomas Krennwallner
00004  * Copyright (C) 2009-2016 Peter Schüller
00005  * Copyright (C) 2011-2016 Christoph Redl
00006  * Copyright (C) 2015-2016 Tobias Kaminski
00007  * Copyright (C) 2015-2016 Antonius Weinzierl
00008  *
00009  * This file is part of dlvhex.
00010  *
00011  * dlvhex is free software; you can redistribute it and/or modify it
00012  * under the terms of the GNU Lesser General Public License as
00013  * published by the Free Software Foundation; either version 2.1 of
00014  * the License, or (at your option) any later version.
00015  *
00016  * dlvhex is distributed in the hope that it will be useful, but
00017  * WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with dlvhex; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00024  * 02110-1301 USA.
00025  */
00026 
00035 #ifndef INPUT_PROVIDER_HPP_INCLUDED_14012011
00036 #define INPUT_PROVIDER_HPP_INCLUDED_14012011
00037 
00038 #include "dlvhex2/PlatformDefinitions.h"
00039 
00040 #include <boost/scoped_ptr.hpp>
00041 #include <boost/shared_ptr.hpp>
00042 
00043 #include <vector>
00044 #include <string>
00045 #include <iosfwd>
00046 
00047 DLVHEX_NAMESPACE_BEGIN
00048 
00050 class DLVHEX_EXPORT InputProvider
00051 {
00052     public:
00054         InputProvider();
00056         ~InputProvider();
00057 
00061         void addStreamInput(std::istream& i, const std::string& contentname);
00065         void addStringInput(const std::string& content, const std::string& contentname);
00068         void addFileInput(const std::string& filename);
00075         void addCSVFileInput(const std::string& predicate, const std::string& filename);
00076     #ifdef HAVE_CURL
00077 
00080         void addURLInput(const std::string& url);
00081     #endif
00082 
00084         bool hasContent() const;
00087         const std::vector<std::string>& contentNames() const;
00088 
00091         std::istream& getAsStream();
00092 
00093     private:
00094         class Impl;
00095         boost::scoped_ptr<Impl> pimpl;
00096 };
00097 typedef boost::shared_ptr<InputProvider> InputProviderPtr;
00098 
00099 DLVHEX_NAMESPACE_END
00100 #endif                           // INPUT_PROVIDER_HPP_INCLUDED_14012011
00101 
00102 // vim:expandtab:ts=4:sw=4:
00103 // mode: C++
00104 // End: