26 #ifndef CCUTIL_OCRCLASS_H_ 27 #define CCUTIL_OCRCLASS_H_ 123 auto chrono_end_time = std::chrono::time_point<std::chrono::steady_clock,
124 std::chrono::milliseconds>();
125 timePointToTimeval(chrono_end_time, &
end_time);
130 if (deadline_msecs > 0) {
131 auto chrono_end_time = std::chrono::steady_clock::now() +
132 std::chrono::milliseconds(deadline_msecs);
133 timePointToTimeval(chrono_end_time, &
end_time);
141 auto chrono_now = std::chrono::steady_clock::now();
143 timePointToTimeval(chrono_now, &now);
144 return (now.tv_sec >
end_time.tv_sec ||
149 static void timePointToTimeval(
150 std::chrono::steady_clock::time_point chrono_point,
struct timeval* tv) {
151 auto millisecs = std::chrono::duration_cast<std::chrono::milliseconds>(
152 chrono_point.time_since_epoch());
153 tv->tv_sec = millisecs.count() / 1000;
154 tv->tv_usec = (millisecs.count() % 1000) * 1000;
157 static bool default_progress_func(
ETEXT_DESC* ths,
int left,
int right,
158 int top,
int bottom) {
167 #endif // CCUTIL_OCRCLASS_H_
CANCEL_FUNC cancel
for errcode use
int16_t progress
chars in this buffer(0)
ETEXT_DESC()
character data
int8_t err_code
ocr sets to 1, HP 0
volatile int8_t ocr_alive
true if not last
bool deadline_exceeded() const
int8_t more_to_come
percent complete increasing (0-100)
PROGRESS_FUNC progress_callback
returns true to cancel
bool(*)(void *, int) CANCEL_FUNC
struct timeval end_time
this or other data for cancel
bool(*)(int, int, int, int, int) PROGRESS_FUNC
bool(*)(ETEXT_DESC *, int, int, int, int) PROGRESS_FUNC2
void set_deadline_msecs(int32_t deadline_msecs)
PROGRESS_FUNC2 progress_callback2
called whenever progress increases
void * cancel_this
monitor-aware progress callback