libzeep

PrevUpHomeNext

Class file_loader

zeep::http::file_loader — actual implementation of a zeep::resource_loader that loads files from disk

Synopsis

// In header: <zeep/http/template-processor.hpp>


class file_loader : public zeep::http::resource_loader {
public:
  // construct/copy/destruct
  file_loader(const std::filesystem::path & = ".");

  // public member functions
  virtual std::filesystem::file_time_type 
  file_time(const std::string &, std::error_code &) noexcept;
  virtual std::istream * 
  load_file(const std::string &, std::error_code &) noexcept;
};

Description

Load the resources from the directory specified in the docroot constructor parameter.

file_loader public construct/copy/destruct

  1. file_loader(const std::filesystem::path & docroot = ".");
    constructor

    Throws a runtime_error if the docroot does not exist

    Parameters:

    docroot

    Path to the directory where the 'resources' are located

file_loader public member functions

  1. virtual std::filesystem::file_time_type 
    file_time(const std::string & file, std::error_code & ec) noexcept;
    return last_write_time of file
  2. virtual std::istream * 
    load_file(const std::string & file, std::error_code & ec) noexcept;
    basic loader, returns error in ec if file was not found

PrevUpHomeNext