Conversation
| Event(const EventType type, const std::string &directory, const std::string &fileA, const std::string &fileB) : | ||
| type(type), directory(directory), fileA(fileA), fileB(fileB) {} | ||
| type(type), directory(directory), fileA(fileA), fileB(fileB) { | ||
| timePoint = std::chrono::high_resolution_clock::now(); |
There was a problem hiding this comment.
rename timePoint to the more idiomatic name timestamp, please
There was a problem hiding this comment.
with forgiveness I think it is a time point because the std::chrono libraries doesn't know any 'timestamps' just a lot of time points
see: http://en.cppreference.com/w/cpp/chrono/time_point
"Class template std::chrono::time_point represents a point in time. It is implemented as if it stores a value of type Duration indicating the time interval from the start of the Clock's epoch."
if we rename this as "timestamp" there is confusion with some known timestamps
| return transform(std::move(vecEvents)); | ||
| } | ||
|
|
||
| virtual VecEvents transform(VecEvents vecEvents) = 0; |
There was a problem hiding this comment.
style: NSFW uses two-spaced tabs.
| [this](std::unique_ptr<Event> &event){ | ||
| std::regex self_regex(regex, | ||
| std::regex_constants::ECMAScript | ||
| | std::regex_constants::icase); |
There was a problem hiding this comment.
not sure about the detailed semantics here. Though, my feeling is that you should set up self_regex outside the lambda and capture it. Otherwise it would recompile the regex several times, no?
| ExcludeDirectories(const std::string ®ex) | ||
| : regex(regex) {} | ||
|
|
||
| VecEvents transform(VecEvents vecEvents) { |
There was a problem hiding this comment.
please implement that in a *.cpp file.
| return vecEvents; | ||
| } | ||
|
|
||
| virtual ~ExcludeDirectories() {} |
test/u_ExcludeDirectories.cpp
Outdated
| std::string regex = "/bar$"; | ||
| ExcludeDirectories exDir(regex); | ||
|
|
||
| SECTION("directory name does match") { |
| auto transformed = exDir(std::move(vec)); | ||
| REQUIRE(transformed->size() == 0); | ||
| } | ||
| } |
There was a problem hiding this comment.
another test with both matching and non-matching dir names would be great.
test/u_ExcludeFiles.cpp
Outdated
| std::string regex = "~[a-zA-Z_][a-zA-Z_0-9]*\\.tmp"; | ||
| ExcludeFiles exFiles(regex); | ||
|
|
||
| SECTION("file name does match") { |
test/u_FileWatcher.cpp
Outdated
|
|
||
| #include "test_helper.h" | ||
|
|
||
| std::string getDirectoryFromFile(const std::string &path) { |
There was a problem hiding this comment.
should be static (i.e. not part of the public interface of this compilation unit)
test/u_FileWatcher.cpp
Outdated
| std::string executionPath(getDirectoryFromFile(programmName)); | ||
| TestFileSystemAdapter testWatcher(executionPath, | ||
| std::chrono::milliseconds(10)); | ||
| auto comparation = [](const Event &lhs, const Event &rhs) { |
includes/Listener.hpp
Outdated
| void notify(Args&&... args) { | ||
| std::lock_guard<std::mutex> lock(mListenersMutex); | ||
| for(const auto &func : mListeners) { | ||
| func.second(std::move(std::forward<Args>(args)...)); |
There was a problem hiding this comment.
Retrofitting this into our private code base I noticed that the template parameter unpacking is wrong here. It doesn't work for multi-argument Listener<> callbacks. Needs to look like this:
// move closing paren of std::move _before_ param unpacking
func.second(std::move(std::forward<Args>(args))...);
includes/Listener.hpp
Outdated
|
|
||
| template <class CallbackType> | ||
| class Listener | ||
| { |
| } | ||
|
|
||
| VecEvents ExcludeDirectories::transform(VecEvents vecEvents) { | ||
| std::regex self_regex(mRegex, |
|
@implausible @maxkorp Any thoughts on that? :-) |
|
Hello again! @reneme I will get to this over the weekend. |
add namespaces change the includes to a relativpath independent path
implausible
left a comment
There was a problem hiding this comment.
Test framework should run on travis/appveyor.
|
okay :) the test framework run on travis and appveyor.. except the mac implementation.. |
|
That's a little strange. There's also some inconsistency on windows as well. |
this is a PR for the future work of #34
what we have worked on?
With this changes we can use and test the library with c++.
After the installation of cmake you can run the following command
cmake . && make -j