-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathfindinfiles.h
More file actions
36 lines (28 loc) · 864 Bytes
/
findinfiles.h
File metadata and controls
36 lines (28 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef FINDINFILES_H
#define FINDINFILES_H
#include "config.h"
#include <gtkmm.h>
#include <thread>
#include <mutex>
#include <queue>
class CFindInFiles {
public:
void SetResultCallback(std::function<bool (std::string)> cb);
void StartSearch(std::string basepath, std::string text);
private:
Glib::Dispatcher dispatcher;
std::thread *search_thread;
// mutex-protected queue for search thread->GUI thread
std::mutex find_mutex;
std::queue<std::string> finds;
// abort flag for GUI thread->search thread
bool abort;
// callback through which results are reported
std::function<bool (std::string)> result_cb;
// dispatcher emission
void on_notify();
// these run in the search thread
void SearchThread(std::string base, std::string path, std::string text);
void SearchFile(std::string base, std::string fname, std::string text);
};
#endif