ewmscp  ..
followRequestProvider.cpp
Go to the documentation of this file.
2 
4  "accept deletion requests", false);
6  "use NUL as delimiter", false);
7 
8 
9 followRequestProvider::followRequestProvider(decltype(requests) aRequests,
10  decltype(delayedRequests) aDelayedRequests,
11  decltype(parents) aParents,
12  decltype(InputHandler) aInputHandler,
13  decltype(OutputHandler) aOutputHandler):
14  requestProvider(aRequests, aDelayedRequests, aParents,
15  aInputHandler, aOutputHandler) {
16 }
17 
18 void followRequestProvider::processSources(const std::vector<std::string>& sources) {
19  for (auto& source : sources) {
20  if (source == "-") {
21  followStream(std::cin);
22  } else {
23  std::ifstream stream(source);
24  followStream(stream);
25  }
26  }
27 }
28 
29 
30 
31 void followRequestProvider::handleMove(const std::string& srcPath,
32  const std::string& dstPath,
33  const std::string& fromPath,
34  const std::string& origPath,
35  const singleMap& mapEntry,
36  copyRequest::clock_type::time_point timestamp) {
38  dstPath, fromPath, origPath, mapEntry);
39 }
40 
41 void followRequestProvider::handleOther(const std::string& srcPath,
42  const std::string& dstPath,
43  const singleMap& mapEntry,
44  copyRequest::clock_type::time_point timestamp,
45  bool requestForRemoval) {
46  if (mayDelete || !requestForRemoval) {
47  enqueueOrAppend(srcPath,
48  requestForRemoval ? copyRequest::fileInWork::slotTypes::unlink :
50  timestamp,
51  dstPath, mapEntry, requestForRemoval);
52  }
53 }
copyRequest::fileInWork::slotTypes::copy
@ copy
copyRequest::fileInWork::slotTypes::move
@ move
followRequestProvider::enqueueOrAppend
void enqueueOrAppend(const std::string &srcPath, copyRequest::fileInWork::slotTypes type, copyRequest::clock_type::time_point timestamp, Types ... args)
Definition: followRequestProvider.h:25
followRequestProvider::handleMove
virtual void handleMove(const std::string &srcPath, const std::string &dstPath, const std::string &fromPath, const std::string &origPath, const singleMap &mapEntry, copyRequest::clock_type::time_point timestamp)
Definition: followRequestProvider.cpp:31
followRequestProvider::mayDelete
static options::single< bool > mayDelete
Definition: followRequestProvider.h:19
requestProvider
generic provider of copy requests
Definition: requestProvider.h:13
copyRequest::fileInWork::slotTypes::unlink
@ unlink
followRequestProvider::nullDelimiter
static options::single< bool > nullDelimiter
Definition: followRequestProvider.h:20
followRequestProvider::followRequestProvider
followRequestProvider(decltype(requests) aRequests, decltype(delayedRequests) aDelayedRequests, decltype(parents) aParents, decltype(InputHandler) aInputHandler, decltype(OutputHandler) aOutputHandler)
Definition: followRequestProvider.cpp:9
followRequestProvider.h
followRequestProvider::processSources
void processSources(const std::vector< std::string > &sources) override
Definition: followRequestProvider.cpp:18
singleMap
std::pair< std::string, std::string > singleMap
Definition: copyRequest.h:52
followRequestProvider::followStream
virtual void followStream(std::istream &stream)=0
followRequestProvider::handleOther
virtual void handleOther(const std::string &srcPath, const std::string &dstPath, const singleMap &mapEntry, copyRequest::clock_type::time_point timestamp, bool requestForRemoval)
Definition: followRequestProvider.cpp:41
defineStatic
#define defineStatic(var,...)
defines a static variable and instatitates the constructor with the variable number of arguments.
Definition: ewmscp.h:42