Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
kome::core::ManualSelector Class Reference

selector class More...

#include <ManualSelector.h>

Inheritance diagram for kome::core::ManualSelector:
Inheritance graph
[legend]
Collaboration diagram for kome::core::ManualSelector:
Collaboration graph
[legend]

Public Member Functions

 ManualSelector ()
 constructor
 
virtual ~ManualSelector ()
 destructor
 
void setSelected (const int item, const bool selected)
 sets selection status More...
 
- Public Member Functions inherited from kome::core::Selector
 Selector ()
 constructor
 
virtual ~Selector ()
 destructor
 
void clearItems ()
 clear items
 
void addItem (const char *name)
 adds item More...
 
void addItem (const char *name, const char *value)
 adds item More...
 
unsigned int getNumberOfItems ()
 gets the number of items More...
 
const char * getItemName (const unsigned int index)
 gets item name More...
 
const char * getItemValue (const unsigned int index)
 gets item value More...
 
bool isSelected (const unsigned int index)
 gets selection flag value More...
 
int getSelection ()
 [in] gets selected item More...
 
bool select ()
 selects item More...
 

Protected Member Functions

virtual bool onSelect (const unsigned int num, const char **items, const char **values, bool *selected)
 This method is called by select method. (override method) More...
 

Protected Attributes

std::set< int > m_selectedItemSet
 
- Protected Attributes inherited from kome::core::Selector
std::vector< std::pair
< std::string, std::string > > 
m_items
 
std::vector< bool > m_selected
 
int m_sel
 

Detailed Description

selector class

Definition at line 28 of file ManualSelector.h.

Member Function Documentation

bool kome::core::ManualSelector::onSelect ( const unsigned int  num,
const char **  items,
const char **  values,
bool *  selected 
)
protectedvirtual

This method is called by select method. (override method)

Parameters
[in]numthe number of items
[in]itemsthe array of item names
[in]valuesthe array of item values
[out]selectedthe array to store selected flags
Returns
If true, the selection was normally done.

Implements kome::core::Selector.

Definition at line 52 of file ManualSelector.cpp.

52  {
53  // initialize
54  for( unsigned int i = 0; i < num; i++ ) {
55  selected[ i ] = false;
56  }
57 
58  // get selection
59  for( std::set< int >::iterator it = m_selectedItemSet.begin();
60  it != m_selectedItemSet.end(); it++ ) {
61  int item = *it;
62  if( item >= 0 && item < (int)num ) {
63  selected[ item ] = true;
64  }
65  }
66 
67  return true;
68 }
std::set< int > m_selectedItemSet
void kome::core::ManualSelector::setSelected ( const int  item,
const bool  selected 
)

sets selection status

Parameters
[in]itemitem index
[in]selectedselection status

Definition at line 36 of file ManualSelector.cpp.

36  {
37  // check the item
38  if( item < 0 ) {
39  return;
40  }
41 
42  // set status
43  if( selected ) {
44  m_selectedItemSet.insert( item );
45  }
46  else {
47  m_selectedItemSet.erase( item );
48  }
49 }
std::set< int > m_selectedItemSet

Member Data Documentation

std::set< int > kome::core::ManualSelector::m_selectedItemSet
protected

selected items

Definition at line 44 of file ManualSelector.h.


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