2023-11-10 06:58:17 +00:00
|
|
|
#pragma once
|
2023-10-31 06:51:14 +00:00
|
|
|
|
|
|
|
// SANE-Option
|
|
|
|
//
|
|
|
|
// created on 2022-10-24
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
2023-11-10 06:58:17 +00:00
|
|
|
#include <hginclude/utils.h> // for refer
|
2023-10-31 06:51:14 +00:00
|
|
|
#include "../../../sdk/include/sane/sane_ex.h"
|
|
|
|
|
|
|
|
class sane_opt_provider : public refer
|
|
|
|
{
|
|
|
|
std::string opt_jsn_txt_;
|
|
|
|
std::string where_;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
std::map<std::string, sane_opt_provider*> following_;
|
|
|
|
|
|
|
|
public:
|
|
|
|
sane_opt_provider();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~sane_opt_provider();
|
|
|
|
|
|
|
|
bool set_opt_json_text(char* txt);
|
|
|
|
void set_where(const char* where);
|
|
|
|
|
|
|
|
public:
|
|
|
|
std::string get_opt_json(void);
|
|
|
|
std::string from(void);
|
|
|
|
void set_following_provider(const char* name, sane_opt_provider* following); // when option has provided by more than one
|
|
|
|
sane_opt_provider* get_following(const char* name); // caller should ->release returned value
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual std::string get_value(const char* name, void* value, int* err = nullptr);
|
|
|
|
virtual int set_value(const char* name, void* val);
|
|
|
|
virtual void enable(const char* name, bool able);
|
|
|
|
};
|
|
|
|
|