gphoto2pp
A C++ Wrapper for libgphoto2
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
gphoto2pp::ChoicesWidget Class Reference

#include <choices_widget.hpp>

Inheritance diagram for gphoto2pp::ChoicesWidget:
Collaboration diagram for gphoto2pp::ChoicesWidget:

Public Member Functions

int countChoices () const
 Counts the number of choices/options to set for this widget.
int getChoice () const
 Gets the currently set choice at the specified index.
void setChoice (int index)
 Sets the choice at the specified index.
std::vector< std::string > getChoices () const
 Gets all the possible choices.
std::string choiceToString (int index) const
 Gets the string representation of the choice at the specified index.
std::string choicesToString (std::string &&separator=" ") const
 Formats the choices into a string with optional separator.
- Public Member Functions inherited from gphoto2pp::StringWidget
std::string getValue () const override
 Gets the widget's value in terms of std::string.
void setValue (std::string const &value) override
 Sets the widget's value in terms of std::string.

Protected Member Functions

 ChoicesWidget (gphoto2::_CameraWidget *cameraWidget)
- Protected Member Functions inherited from gphoto2pp::StringWidget
 StringWidget (gphoto2::_CameraWidget *cameraWidget)
- Protected Member Functions inherited from gphoto2pp::ValueWidgetBase< std::string >
 ValueWidgetBase (gphoto2::_CameraWidget *cameraWidget)
- Protected Member Functions inherited from gphoto2pp::CameraWidgetWrapper
 CameraWidgetWrapper (gphoto2::_CameraWidget *cameraWidget)
void ref ()
 Adds a reference count to the internal gphoto2::CameraWidget struct.
void unref ()
 Subtracts a reference count to the internal gphoto2::CameraWidget struct.
gphoto2::_CameraWidget * getRootDefault () const
 Gets the unwrapped CameraWidget struct pointer of the root.
gphoto2::_CameraWidget * getParentDefault () const
 Gets the unwrapped CameraWidget struct pointer of the parent.

Friends

class NonValueWidget

Additional Inherited Members

- Protected Attributes inherited from gphoto2pp::CameraWidgetWrapper
gphoto2::_CameraWidget * m_cameraWidget = nullptr

Detailed Description

A class representing gphoto2 widgets which are of the widget type GPhoto2pp::CameraWidgetTypeWrapper::Menu or GPhoto2pp::CameraWidgetTypeWrapper::Radio

Constructor & Destructor Documentation

gphoto2pp::ChoicesWidget::ChoicesWidget ( gphoto2::_CameraWidget *  cameraWidget)
protected

Member Function Documentation

std::string gphoto2pp::ChoicesWidget::choicesToString ( std::string &&  separator = " ") const

Formats the choices into a string with optional separator.

Parameters
[in]separatorused to insert inbetween all the choices for concatenation
Returns
the string of choices
Exceptions
GPhoto2pp::exceptions::gphoto2_exception
std::string gphoto2pp::ChoicesWidget::choiceToString ( int  index) const

Gets the string representation of the choice at the specified index.

Parameters
[in]indexof the choice to get
Returns
the choices value
Note
Direct wrapper for gp_widget_get_choice(...)
Exceptions
GPhoto2pp::exceptions::IndexOutOfRangeif the index is greater than countChoices of choices
GPhoto2pp::exceptions::gphoto2_exception
int gphoto2pp::ChoicesWidget::countChoices ( ) const

Counts the number of choices/options to set for this widget.

Returns
the number of choices
Note
Direct wrapper for gp_widget_count_choices(...)
Exceptions
GPhoto2pp::exceptions::gphoto2_exception
int gphoto2pp::ChoicesWidget::getChoice ( ) const

Gets the currently set choice at the specified index.

Returns
the choices index
Note
Direct wrapper for gp_widget_get_choice(...)
Exceptions
GPhoto2pp::exceptions::IndexOutOfRangeif the index is greater than countChoices of choices
GPhoto2pp::exceptions::gphoto2_exception
std::vector<std::string> gphoto2pp::ChoicesWidget::getChoices ( ) const

Gets all the possible choices.

Returns
the choices
Note
Helper which iterates through all choices compiling them into a vector
Exceptions
GPhoto2pp::exceptions::gphoto2_exception
void gphoto2pp::ChoicesWidget::setChoice ( int  index)

Sets the choice at the specified index.

Parameters
[in]indexof the choice to set
Note
Helper which calls getChoice with the provided index and then setValue with the response
Exceptions
GPhoto2pp::exceptions::IndexOutOfRangeif the index is greater than countChoices
GPhoto2pp::exceptions::gphoto2_exception

Friends And Related Function Documentation

friend class NonValueWidget
friend

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