LibreOffice Module extensions (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Sane Class Reference

#include <sane.hxx>

Collaboration diagram for Sane:
[legend]

Public Member Functions

 Sane ()
 
 ~Sane ()
 
bool IsOpen () const
 
OUString GetOptionName (int n)
 
OUString GetOptionTitle (int n)
 
SANE_Value_Type GetOptionType (int n)
 
SANE_Unit GetOptionUnit (int n)
 
OUString GetOptionUnitName (int n)
 
SANE_Int GetOptionCap (int n)
 
SANE_Constraint_Type GetOptionConstraintType (int n)
 
const char ** GetStringConstraint (int n)
 
int GetRange (int, std::unique_ptr< double[]> &)
 
int GetOptionElements (int n)
 
int GetOptionByName (const char *)
 
bool GetOptionValue (int, bool &)
 
bool GetOptionValue (int, OString &)
 
bool GetOptionValue (int, double &, int nElement=0)
 
bool GetOptionValue (int, double *)
 
void SetOptionValue (int, bool)
 
void SetOptionValue (int, std::u16string_view)
 
void SetOptionValue (int, double, int nElement=0)
 
void SetOptionValue (int, double const *)
 
bool ActivateButtonOption (int)
 
int CountOptions ()
 
int GetDeviceNumber () const
 
bool Open (const char *)
 
bool Open (int)
 
void Close ()
 
void ReloadDevices ()
 
void ReloadOptions ()
 
bool Start (BitmapTransporter &)
 
Link< Sane &, void > SetReloadOptionsHdl (const Link< Sane &, void > &rLink)
 

Static Public Member Functions

static bool IsSane ()
 
static int CountDevices ()
 
static OUString GetName (int n)
 
static OUString GetVendor (int n)
 
static OUString GetModel (int n)
 
static OUString GetType (int n)
 

Private Member Functions

SANE_Status ControlOption (int, SANE_Action, void *)
 
bool CheckConsistency (const char *, bool bInit=false)
 

Static Private Member Functions

static oslGenericFunction LoadSymbol (const char *)
 
static void Init ()
 
static void DeInit ()
 

Private Attributes

std::unique_ptr< const SANE_Option_Descriptor *[]> mppOptions
 
int mnOptions
 
int mnDevice
 
SANE_Handle maHandle
 
Link< Sane &, void > maReloadOptionsLink
 

Static Private Attributes

static int nRefCount = 0
 
static oslModule pSaneLib = nullptr
 
static SANE_Status(* p_init )(SANE_Int *, SANE_Auth_Callback) = nullptr
 
static void(* p_exit )() = nullptr
 
static SANE_Status(* p_get_devices )(const SANE_Device ***, SANE_Bool) = nullptr
 
static SANE_Status(* p_open )(SANE_String_Const, SANE_Handle) = nullptr
 
static void(* p_close )(SANE_Handle) = nullptr
 
static const SANE_Option_Descriptor *(* p_get_option_descriptor )(SANE_Handle, SANE_Int) = nullptr
 
static SANE_Status(* p_control_option )(SANE_Handle, SANE_Int, SANE_Action, void *, SANE_Int *) = nullptr
 
static SANE_Status(* p_get_parameters )(SANE_Handle, SANE_Parameters *) = nullptr
 
static SANE_Status(* p_start )(SANE_Handle) = nullptr
 
static SANE_Status(* p_read )(SANE_Handle, SANE_Byte *, SANE_Int, SANE_Int *) = nullptr
 
static void(* p_cancel )(SANE_Handle) = nullptr
 
static SANE_Status(* p_set_io_mode )(SANE_Handle, SANE_Bool) = nullptr
 
static SANE_Status(* p_get_select_fd )(SANE_Handle, SANE_Int *) = nullptr
 
static SANE_String_Const(* p_strstatus )(SANE_Status) = nullptr
 
static SANE_Int nVersion = 0
 
static SANE_Device ** ppDevices = nullptr
 
static int nDevices = 0
 

Detailed Description

Definition at line 59 of file sane.hxx.

Constructor & Destructor Documentation

◆ Sane()

Sane::Sane ( )

Definition at line 151 of file sane.cxx.

References Init(), nRefCount, and pSaneLib.

◆ ~Sane()

Sane::~Sane ( )

Definition at line 161 of file sane.cxx.

References Close(), DeInit(), IsOpen(), nRefCount, and pSaneLib.

Member Function Documentation

◆ ActivateButtonOption()

bool Sane::ActivateButtonOption ( int  n)

Definition at line 990 of file sane.cxx.

References ControlOption(), and n.

◆ CheckConsistency()

bool Sane::CheckConsistency ( const char *  pMes,
bool  bInit = false 
)
private

Definition at line 511 of file sane.cxx.

References dbg_msg(), and mppOptions.

Referenced by ReloadOptions(), and Start().

◆ Close()

void Sane::Close ( )

Definition at line 320 of file sane.cxx.

References maHandle, mnDevice, mppOptions, and p_close.

Referenced by SaneDlg::InitDevices(), SaneDlg::LoadState(), ReloadDevices(), and ~Sane().

◆ ControlOption()

SANE_Status Sane::ControlOption ( int  nOption,
SANE_Action  nAction,
void *  pData 
)
private

◆ CountDevices()

static int Sane::CountDevices ( )
inlinestatic

Definition at line 115 of file sane.hxx.

References nDevices.

Referenced by IMPL_LINK(), SaneDlg::InitDevices(), and SaneDlg::LoadState().

◆ CountOptions()

int Sane::CountOptions ( )
inline

Definition at line 157 of file sane.hxx.

References mnOptions.

Referenced by SaneDlg::InitFields().

◆ DeInit()

void Sane::DeInit ( )
staticprivate

Definition at line 242 of file sane.cxx.

References p_exit, and pSaneLib.

Referenced by Init(), ReloadDevices(), and ~Sane().

◆ GetDeviceNumber()

int Sane::GetDeviceNumber ( ) const
inline

Definition at line 158 of file sane.hxx.

References mnDevice.

◆ GetModel()

static OUString Sane::GetModel ( int  n)
inlinestatic

Definition at line 121 of file sane.hxx.

References n, and ppDevices.

Referenced by IMPL_LINK().

◆ GetName()

static OUString Sane::GetName ( int  n)
inlinestatic

Definition at line 117 of file sane.hxx.

References n, name, and ppDevices.

Referenced by IMPL_LINK(), SaneDlg::InitDevices(), and SaneDlg::LoadState().

◆ GetOptionByName()

int Sane::GetOptionByName ( const char *  rName)

◆ GetOptionCap()

SANE_Int Sane::GetOptionCap ( int  n)
inline

Definition at line 135 of file sane.hxx.

References mppOptions, and n.

Referenced by SaneDlg::InitFields().

◆ GetOptionConstraintType()

SANE_Constraint_Type Sane::GetOptionConstraintType ( int  n)
inline

Definition at line 137 of file sane.hxx.

References mppOptions, and n.

◆ GetOptionElements()

int Sane::GetOptionElements ( int  n)
inline

Definition at line 172 of file sane.hxx.

References mppOptions, n, and type.

Referenced by SaneDlg::SaveState(), and SaneDlg::SetAdjustedNumericalValue().

◆ GetOptionName()

OUString Sane::GetOptionName ( int  n)
inline

◆ GetOptionTitle()

OUString Sane::GetOptionTitle ( int  n)
inline

Definition at line 128 of file sane.hxx.

References mppOptions, and n.

Referenced by SaneDlg::InitFields().

◆ GetOptionType()

SANE_Value_Type Sane::GetOptionType ( int  n)
inline

Definition at line 130 of file sane.hxx.

References mppOptions, and n.

Referenced by SaneDlg::InitFields(), and SaneDlg::SaveState().

◆ GetOptionUnit()

SANE_Unit Sane::GetOptionUnit ( int  n)
inline

Definition at line 132 of file sane.hxx.

References mppOptions, and n.

Referenced by SaneDlg::InitFields(), and Start().

◆ GetOptionUnitName()

OUString Sane::GetOptionUnitName ( int  n)

Definition at line 978 of file sane.cxx.

References mppOptions, n, ppUnits, and SAL_N_ELEMENTS.

Referenced by SaneDlg::EstablishNumericOption(), and SaneDlg::EstablishQuantumRange().

◆ GetOptionValue() [1/4]

bool Sane::GetOptionValue ( int  n,
bool &  rRet 
)

◆ GetOptionValue() [2/4]

bool Sane::GetOptionValue ( int  n,
double &  rRet,
int  nElement = 0 
)

Definition at line 371 of file sane.cxx.

References ControlOption(), maHandle, mppOptions, n, size, and type.

◆ GetOptionValue() [3/4]

bool Sane::GetOptionValue ( int  n,
double *  pSet 
)

Definition at line 392 of file sane.cxx.

References ControlOption(), i, maHandle, mppOptions, n, size, and type.

◆ GetOptionValue() [4/4]

bool Sane::GetOptionValue ( int  n,
OString &  rRet 
)

Definition at line 356 of file sane.cxx.

References ControlOption(), maHandle, mppOptions, n, size, and type.

◆ GetRange()

int Sane::GetRange ( int  n,
std::unique_ptr< double[]> &  rpDouble 
)

◆ GetStringConstraint()

const char ** Sane::GetStringConstraint ( int  n)
inline

Definition at line 139 of file sane.hxx.

References mppOptions, and n.

Referenced by SaneDlg::EstablishStringRange().

◆ GetType()

static OUString Sane::GetType ( int  n)
inlinestatic

Definition at line 123 of file sane.hxx.

References n, ppDevices, and type.

Referenced by IMPL_LINK().

◆ GetVendor()

static OUString Sane::GetVendor ( int  n)
inlinestatic

Definition at line 119 of file sane.hxx.

References n, and ppDevices.

Referenced by IMPL_LINK().

◆ Init()

void Sane::Init ( void  )
staticprivate

◆ IsOpen()

bool Sane::IsOpen ( ) const
inline

◆ IsSane()

static bool Sane::IsSane ( )
inlinestatic

◆ LoadSymbol()

oslGenericFunction Sane::LoadSymbol ( const char *  pSymbolname)
inlinestaticprivate

Definition at line 108 of file sane.cxx.

References bSaneSymbolLoadFailed, and pSaneLib.

Referenced by Init().

◆ Open() [1/2]

bool Sane::Open ( const char *  name)

Definition at line 287 of file sane.cxx.

References FAIL_STATE, i, maHandle, mnDevice, name, nDevices, p_open, ppDevices, and ReloadOptions().

Referenced by SaneDlg::InitDevices(), SaneDlg::LoadState(), and Open().

◆ Open() [2/2]

bool Sane::Open ( int  n)

Definition at line 310 of file sane.cxx.

References mnDevice, n, name, nDevices, Open(), and ppDevices.

◆ ReloadDevices()

void Sane::ReloadDevices ( )

Definition at line 254 of file sane.cxx.

References Close(), DeInit(), Init(), and IsOpen().

Referenced by SaneDlg::InitDevices().

◆ ReloadOptions()

void Sane::ReloadOptions ( )

◆ SetOptionValue() [1/4]

void Sane::SetOptionValue ( int  n,
bool  bSet 
)

◆ SetOptionValue() [2/4]

void Sane::SetOptionValue ( int  n,
double const *  pSet 
)

Definition at line 455 of file sane.cxx.

References ControlOption(), i, maHandle, mppOptions, n, size, and type.

◆ SetOptionValue() [3/4]

void Sane::SetOptionValue ( int  n,
double  fSet,
int  nElement = 0 
)

Definition at line 428 of file sane.cxx.

References ControlOption(), maHandle, mppOptions, n, size, and type.

◆ SetOptionValue() [4/4]

void Sane::SetOptionValue ( int  n,
std::u16string_view  rSet 
)

Definition at line 420 of file sane.cxx.

References ControlOption(), maHandle, mppOptions, n, OUStringToOString(), rSet, and type.

◆ SetReloadOptionsHdl()

Link< Sane &, void > Sane::SetReloadOptionsHdl ( const Link< Sane &, void > &  rLink)
inline

Definition at line 183 of file sane.hxx.

References maReloadOptionsLink.

Referenced by SaneDlg::SaneDlg(), and SaneDlg::~SaneDlg().

◆ Start()

bool Sane::Start ( BitmapTransporter rBitmap)

Member Data Documentation

◆ maHandle

SANE_Handle Sane::maHandle
private

◆ maReloadOptionsLink

Link<Sane&,void> Sane::maReloadOptionsLink
private

Definition at line 96 of file sane.hxx.

Referenced by ReloadOptions(), and SetReloadOptionsHdl().

◆ mnDevice

int Sane::mnDevice
private

Definition at line 93 of file sane.hxx.

Referenced by Close(), GetDeviceNumber(), and Open().

◆ mnOptions

int Sane::mnOptions
private

Definition at line 92 of file sane.hxx.

Referenced by CountOptions(), GetOptionByName(), and ReloadOptions().

◆ mppOptions

std::unique_ptr<const SANE_Option_Descriptor*[]> Sane::mppOptions
private

◆ nDevices

int Sane::nDevices = 0
staticprivate

Definition at line 89 of file sane.hxx.

Referenced by CountDevices(), Init(), and Open().

◆ nRefCount

int Sane::nRefCount = 0
staticprivate

Definition at line 62 of file sane.hxx.

Referenced by Sane(), and ~Sane().

◆ nVersion

SANE_Int Sane::nVersion = 0
staticprivate

Definition at line 87 of file sane.hxx.

Referenced by Init().

◆ p_cancel

void(* Sane::p_cancel)(SANE_Handle) = nullptr
staticprivate

Definition at line 82 of file sane.hxx.

Referenced by Init(), and Start().

◆ p_close

void(* Sane::p_close)(SANE_Handle) = nullptr
staticprivate

Definition at line 71 of file sane.hxx.

Referenced by Close(), and Init().

◆ p_control_option

SANE_Status(* Sane::p_control_option)(SANE_Handle, SANE_Int, SANE_Action, void *, SANE_Int *) = nullptr
staticprivate

Definition at line 74 of file sane.hxx.

Referenced by ControlOption(), Init(), and ReloadOptions().

◆ p_exit

void(* Sane::p_exit)() = nullptr
staticprivate

Definition at line 67 of file sane.hxx.

Referenced by DeInit(), and Init().

◆ p_get_devices

SANE_Status(* Sane::p_get_devices)(const SANE_Device ***, SANE_Bool) = nullptr
staticprivate

Definition at line 68 of file sane.hxx.

Referenced by Init().

◆ p_get_option_descriptor

const SANE_Option_Descriptor *(* Sane::p_get_option_descriptor)(SANE_Handle, SANE_Int) = nullptr
staticprivate

Definition at line 72 of file sane.hxx.

Referenced by Init(), and ReloadOptions().

◆ p_get_parameters

SANE_Status(* Sane::p_get_parameters)(SANE_Handle, SANE_Parameters *) = nullptr
staticprivate

Definition at line 77 of file sane.hxx.

Referenced by Init(), and Start().

◆ p_get_select_fd

SANE_Status(* Sane::p_get_select_fd)(SANE_Handle, SANE_Int *) = nullptr
staticprivate

Definition at line 84 of file sane.hxx.

Referenced by Init(), and Start().

◆ p_init

SANE_Status(* Sane::p_init)(SANE_Int *, SANE_Auth_Callback) = nullptr
staticprivate

Definition at line 65 of file sane.hxx.

Referenced by Init().

◆ p_open

SANE_Status(* Sane::p_open)(SANE_String_Const, SANE_Handle) = nullptr
staticprivate

Definition at line 70 of file sane.hxx.

Referenced by Init(), and Open().

◆ p_read

SANE_Status(* Sane::p_read)(SANE_Handle, SANE_Byte *, SANE_Int, SANE_Int *) = nullptr
staticprivate

Definition at line 80 of file sane.hxx.

Referenced by Init(), and Start().

◆ p_set_io_mode

SANE_Status(* Sane::p_set_io_mode)(SANE_Handle, SANE_Bool) = nullptr
staticprivate

Definition at line 83 of file sane.hxx.

Referenced by Init(), and Start().

◆ p_start

SANE_Status(* Sane::p_start)(SANE_Handle) = nullptr
staticprivate

Definition at line 79 of file sane.hxx.

Referenced by Init(), and Start().

◆ p_strstatus

SANE_String_Const(* Sane::p_strstatus)(SANE_Status) = nullptr
staticprivate

Definition at line 85 of file sane.hxx.

Referenced by Init(), and ReloadOptions().

◆ ppDevices

SANE_Device ** Sane::ppDevices = nullptr
staticprivate

Definition at line 88 of file sane.hxx.

Referenced by GetModel(), GetName(), GetType(), GetVendor(), Init(), and Open().

◆ pSaneLib

oslModule Sane::pSaneLib = nullptr
staticprivate

Definition at line 63 of file sane.hxx.

Referenced by DeInit(), Init(), IsSane(), LoadSymbol(), Sane(), and ~Sane().


The documentation for this class was generated from the following files: