SOFA API  63d8fd06
Open source framework for multi-physics simuation
sofa::helper::OptionsGroup Class Reference

#include <OptionsGroup.h>

OptionsGroup is a kind of data for a radio button. It has a list of text representing a list of choices, and a interger number indicating the choice selected. More...

Detailed Description

OptionsGroup is a kind of data for a radio button. It has a list of text representing a list of choices, and a interger number indicating the choice selected.

Protected Attributes

helper::vector< std::string > textItems
 
unsigned int selectedItem
 

Public Member Functions

int isInOptionsList (const std::string &m_string) const
 
Constructors

Default constructor

 OptionsGroup ()
 
 OptionsGroup (int nbofRadioButton,...)
 
template<class T >
 OptionsGroup (const T &list)
 generic constructor taking other string container like list<string>, set<string>, vector<string> More...
 
 OptionsGroup (const OptionsGroup &m_radiotrick)
 Copy constructor. More...
 
setting operators
void setNbItems (unsigned int nbofRadioButton)
 Set the number of items. More...
 
void setItemName (unsigned int id_item, const std::string &name)
 Set the name of the id-th item. More...
 
void setNames (int nbofRadioButton,...)
 
void setSelectedItem (unsigned int id_item)
 Setting the activated item by its id. More...
 
void setSelectedItem (const std::string &)
 Setting the activated item by its value (string) More...
 
void readFromStream (std::istream &stream)
 
getting informations operators
unsigned int getSelectedId () const
 
const std::string & getSelectedItem () const
 
const std::string & operator[] (const unsigned int i) const
 
size_t size () const
 
void writeToStream (std::ostream &stream) const
 
OptionsGroupoperator= (const OptionsGroup &m_radiotrick)
 

Attribute details

unsigned int sofa::helper::OptionsGroup::selectedItem
protected
helper::vector<std::string> sofa::helper::OptionsGroup::textItems
protected

Constructor details

sofa::helper::OptionsGroup::OptionsGroup ( )
sofa::helper::OptionsGroup::OptionsGroup ( int  nbofRadioButton,
  ... 
)

Constructor by given the number of argument following by the variable arguments Example OptionsGroup m_options(4,"button0","button1","button2","button3");

template<class T >
sofa::helper::OptionsGroup::OptionsGroup ( const T &  list)
inline

generic constructor taking other string container like list<string>, set<string>, vector<string>

sofa::helper::OptionsGroup::OptionsGroup ( const OptionsGroup m_radiotrick)

Copy constructor.

Function details

unsigned int sofa::helper::OptionsGroup::getSelectedId ( ) const
const std::string & sofa::helper::OptionsGroup::getSelectedItem ( ) const
int sofa::helper::OptionsGroup::isInOptionsList ( const std::string &  m_string) const

return the id_item of the string if found in string list button -1 if not found

OptionsGroup & sofa::helper::OptionsGroup::operator= ( const OptionsGroup m_radiotrick)
const std::string& sofa::helper::OptionsGroup::operator[] ( const unsigned int  i) const
inline
void sofa::helper::OptionsGroup::readFromStream ( std::istream &  stream)

Setting the activated item by a input-stream. the istream is converted to string. If the reading string is in options list, its value is setted activated, else push a warning.

void sofa::helper::OptionsGroup::setItemName ( unsigned int  id_item,
const std::string &  name 
)

Set the name of the id-th item.

void sofa::helper::OptionsGroup::setNames ( int  nbofRadioButton,
  ... 
)

Reinitializing options by a pre-constructed optionsgroup objected Example m_options.setNames(4,"button0","button1","button2","button3");

void sofa::helper::OptionsGroup::setNbItems ( unsigned int  nbofRadioButton)

Set the number of items.

void sofa::helper::OptionsGroup::setSelectedItem ( unsigned int  id_item)

Setting the activated item by its id.

void sofa::helper::OptionsGroup::setSelectedItem ( const std::string &  m_string)

Setting the activated item by its value (string)

size_t sofa::helper::OptionsGroup::size ( void  ) const
inline
void sofa::helper::OptionsGroup::writeToStream ( std::ostream &  stream) const