code_device/hgdriver/hgdev/user-opt/offline_opt.h

34 lines
729 B
C++

#pragma once
// SANE-Options accessible offline
//
// created on 2022-09-22
//
#include "base_opt.h"
#include <functional>
#include <map>
class hguser;
class offline_opts : public sane_opt_provider
{
hguser* user_;
std::string drv_ver_;
std::map<std::string, std::function<int(bool/*read?*/, void*/*buf*/, int*/*len*/, bool/*read cur value*/)>> oper_;
void init(void);
public:
offline_opts(hguser* user);
protected:
virtual ~offline_opts();
public:
virtual std::string get_json_text(void) override;
virtual int get_value(const char* name, void* buf, int* len, bool curval = true) override;
virtual int set_value(const char* name, void* value) override;
virtual bool has_option(const char* name) override;
};