Flutter plugin for scanning and generating QR codes using the ZXing library, supporting Android, iOS, and desktop platforms
flutterbarcode-generatorbarcode-scannergeneratorqrqrcodeqrcode-generatorqrcode-scannerscannerzxingbarcodezxscanner
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
836 B
41 lines
836 B
#include "common.h" |
|
#include <chrono> |
|
#include <stdio.h> |
|
#include <stdarg.h> |
|
|
|
using namespace std; |
|
|
|
bool isLogEnabled; |
|
|
|
void setLoggingEnabled(bool enabled) |
|
{ |
|
isLogEnabled = enabled; |
|
} |
|
|
|
long long int get_now() |
|
{ |
|
return chrono::duration_cast<std::chrono::milliseconds>( |
|
chrono::system_clock::now().time_since_epoch()) |
|
.count(); |
|
} |
|
|
|
void platform_log(const char *fmt, ...) |
|
{ |
|
if (isLogEnabled) |
|
{ |
|
va_list args; |
|
va_start(args, fmt); |
|
#ifdef __ANDROID__ |
|
__android_log_vprint(ANDROID_LOG_VERBOSE, "ndk", fmt, args); |
|
#elif defined(IS_WIN32) |
|
char *buf = new char[4096]; |
|
std::fill_n(buf, 4096, '\0'); |
|
_vsprintf_p(buf, 4096, fmt, args); |
|
OutputDebugStringA(buf); |
|
delete[] buf; |
|
#else |
|
vprintf(fmt, args); |
|
#endif |
|
va_end(args); |
|
} |
|
} |