36#ifndef _uhal_utilities_files_hpp_
37#define _uhal_utilities_files_hpp_
43#include <boost/filesystem/path.hpp>
60 UHAL_DEFINE_EXCEPTION_CLASS ( UriListParsingError ,
"Exception class to handle the case where the string is not a comma-delimiter list of URIs." )
78 void ParseSemicolonDelimitedUriList (
const std::string& aSemicolonDelimitedUriList , std::vector< std::pair<std::string, std::string> >& aUriList );
87 void ShellExpandFilenameExpr (
const std::string& aFilenameExpr ,
const boost::filesystem::path& aParentPath , std::vector< boost::filesystem::path >& aFiles );
96 template <
bool DebugInfo >
97 bool HttpGet (
const std::string& aURL , HttpResponseType& aResponse );
102 typedef std::function<void (
const std::string&,
const boost::filesystem::path&, std::vector<uint8_t>& aCallback)>
FileCallback_t;
131 void OpenFile (
const std::string& aProtocol ,
const std::string& aFilenameExpr ,
const boost::filesystem::path& aParentPath ,
const detail::FileCallback_t& aCallback );
Wrapper to generate a new Python exception type.
\rst Holds a reference to a Python object (no reference counting)
#define UHAL_DEFINE_EXCEPTION_CLASS(ClassName, ClassDescription)
std::function< void(const std::string &, const boost::filesystem::path &, std::vector< uint8_t > &aCallback)> FileCallback_t
void ParseSemicolonDelimitedUriList(const std::string &aSemicolonDelimitedUriList, std::vector< std::pair< std::string, std::string > > &aUriList)
Parse a semicolon delimited list of URIs into a vector of protocol/address pairs.
bool HttpGet(const std::string &aURL, HttpResponseType &aResponse)
Retrieve a file by HTTP.
void OpenFileLocal(const std::string &aFilenameExpr, const boost::filesystem::path &aParentPath, const detail::FileCallback_t &aCallback)
Given a linux shell expression, open all files which match it and call the callback function on each ...
void ShellExpandFilenameExpr(const std::string &aFilenameExpr, const boost::filesystem::path &aParentPath, std::vector< boost::filesystem::path > &aFiles)
Perform shell expansion of a linux shell expression ( e.g.
void OpenFileHttp(const std::string &aURL, const detail::FileCallback_t &aCallback)
Given a URL, retrieve the file and call the callback function on each of them.
void OpenFile(const std::string &aProtocol, const std::string &aFilenameExpr, const boost::filesystem::path &aParentPath, const detail::FileCallback_t &aCallback)
Given a protocol and either a URL or a linux shell expression, open the file and call the callback fu...