NetBurner 3.5.6
PDF Version
config_chooser Class Reference

Chooser Configuration Variable - Select From a List of Items. More...

#include <config_obj.h>

Inherits config_obj.

Public Member Functions

 config_chooser (config_obj &owner, const char *name, const char *in_value, const char *in_choices, const char *desc=NULL)
 Object constructor with the parent/owner leaf parameter.
 
 config_chooser (const char *name, const char *in_value, const char *in_choices, const char *desc=NULL)
 Object constructor.
 
bool IsSelected (const char *choice)
 Check if a particular choice option is selected.
 
bool IsSelected (const NBString &s)
 Check if a particular choice option is selected.
 
bool IsInChoices (const char *str, size_t strLen)
 Check if a string is in the list of possible choices. A comparison will continue until a null character is found, or the length of the longer of the two strings being compared is reached (strLen is used to determine if str is longer than the current element being compared.)
 
bool IsInChoices (const NBString &str, size_t strLen)
 Check if a string is in the list of possible choices. A comparison will continue until a null character is found, or the length of the longer of the two strings being compared is reached (strLen is used to determine if str is longer than the current element being compared.)
 
const config_stringGetChoices ()
 Get the list of choices.
 
const config_stringSetChoices (const char *in_choices)
 Set the list of choices.
 
 operator NBString () const
 Returns the object value.
 
config_chooseroperator= (const char *p)
 Assign the selected list item from a const char* value.
 
config_chooseroperator= (const NBString &s)
 Assign the config_string object value from a NBString object.
 
config_chooseroperator= (const config_chooser &ci)
 Copy one config_chooser object to another.
 
virtual void GetTypeValue (NBString &s) override
 Assigns the object type value to the specified NBString object.
 
- Public Member Functions inherited from config_obj
 config_obj (config_obj &owner, const char *name, const char *desc)
 Object constructor with the parent/owner leaf parameter.
 
 config_obj (const char *name, const char *desc)
 Object constructor.
 
virtual void GetTextValue (NBString &s) override
 Get the object value as a text string to the specified NBString object.
 

Detailed Description

Chooser Configuration Variable - Select From a List of Items.

The config_chooser class provides a list of options with the ability to select one. If used on a web page it would appear as a drop down box. For example, the choices could be "one", "two", or "three", and "two" could be the item selected. Since the items are JSON, the selected item is identified by the option name, not a list index.

Note
All modifictions to configuration objects are marked as pending. A call to SaveConfigToStorage is required to save changes to flash memory.

Constructor & Destructor Documentation

◆ config_chooser() [1/2]

config_chooser::config_chooser ( config_obj & owner,
const char * name,
const char * in_value,
const char * in_choices,
const char * desc = NULL )
inline

Object constructor with the parent/owner leaf parameter.

Parameters
ownerReference to owner/parent leaf
nameField name assigned to the value
in_valueThe option value selected
in_choicesThe list of option choices
descDescription used for info/tool tip

◆ config_chooser() [2/2]

config_chooser::config_chooser ( const char * name,
const char * in_value,
const char * in_choices,
const char * desc = NULL )
inline

Object constructor.

Parameters
nameField name assigned to the value
in_valueThe option value selected
in_choicesThe list of option choices
descDescription used for info/tool tip

Member Function Documentation

◆ GetChoices()

const config_string & config_chooser::GetChoices ( )
inline

Get the list of choices.

Returns
A config_string object containing the list of choices

◆ GetTypeValue()

virtual void config_chooser::GetTypeValue ( NBString & s)
inlineoverridevirtual

Assigns the object type value to the specified NBString object.

The type value "object" is written to the NBString object.

Parameters
sNBString object to hold the type value string

Reimplemented from config_obj.

◆ IsInChoices() [1/2]

bool config_chooser::IsInChoices ( const char * str,
size_t strLen )
inline

Check if a string is in the list of possible choices. A comparison will continue until a null character is found, or the length of the longer of the two strings being compared is reached (strLen is used to determine if str is longer than the current element being compared.)

Parameters
strNBString to attempt to find inside the list of choices
strLenLength of str. This value is used to determine the amount of characters to compare for each element in the list of choices.
Return values
trueif str is found as an option in list of choices
falseif str is not found in the list of choices

◆ IsInChoices() [2/2]

bool config_chooser::IsInChoices ( const NBString & str,
size_t strLen )
inline

Check if a string is in the list of possible choices. A comparison will continue until a null character is found, or the length of the longer of the two strings being compared is reached (strLen is used to determine if str is longer than the current element being compared.)

Parameters
strNBString to attempt to find inside the list of choices
strLenLength of str. This value is used to determine the amount of characters to compare for each element in the list of choices.
Return values
trueif str is found as an option in list of choices
falseif str is not found in the list of choices

◆ IsSelected() [1/2]

bool config_chooser::IsSelected ( const char * choice)
inline

Check if a particular choice option is selected.

Parameters
choiceChoice to test as a string type
Return values
trueSelected
falseNot Selected

◆ IsSelected() [2/2]

bool config_chooser::IsSelected ( const NBString & s)
inline

Check if a particular choice option is selected.

Parameters
sChoice to test as a NBString type
Return values
trueSelected
falseNot Selected

◆ operator NBString()

config_chooser::operator NBString ( ) const
inline

Returns the object value.

Returns
The currently selected list option as a NBString

◆ operator=() [1/3]

config_chooser & config_chooser::operator= ( const char * p)
inline

Assign the selected list item from a const char* value.

Parameters
pSelected list item to assign

◆ operator=() [2/3]

config_chooser & config_chooser::operator= ( const config_chooser & ci)
inline

Copy one config_chooser object to another.

Parameters
ciReference to a config_chooser object

◆ operator=() [3/3]

config_chooser & config_chooser::operator= ( const NBString & s)
inline

Assign the config_string object value from a NBString object.

Parameters
sReference to a NBString object

◆ SetChoices()

const config_string & config_chooser::SetChoices ( const char * in_choices)
inline

Set the list of choices.

Parameters
in_choicesThe list of option choices
Returns
A config_string object containing the list of choices

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