os_option


A text string choice within a selection object.

An os_option is a text string choice within an os_select , and is described by a content string. The content string is displayed within the os_select , is specified in a constructor, and can be modified through the content() member function.

An os_option can also specify a value. If unspecified, the value defaults to the content string. The value can be specified through either a constructor or the value() member function.

The initial status of an os_option can be specified through either a constructor or the status() member function. If unspecified, the status defaults to not_selected .

When the os_form is submitted, a name/value pair is transmitted for each selected os_option where the name is the name of the containing os_select and the value is the value of the os_option .

Declaration

#include <ospace/web/option.h>
class os_option : public os_element

Enums

enum os_option::option_status
  {
  not_selected,  // Sets the option to the unselected state.
  selected,      // Sets the option to the selected state.
  disabled       // Prevents the option from being selected or unselected.
  };
	

Interface

Constructor
os_option( const string& content, option_status , status )
Constructs an option with content content and status status (default not_selected ).
Constructor
os_option( const string& content, const string& value , option_status status )
Constructs an option with content content , value value , and status status (default not_selected ).
Constructor
os_option( const os_option& rhs )
Constructs an option that is a copy of rhs .
Destructor
/* virtual */ ~os_option()
Destroys the option.
=
os_option& operator=( const os_option& rhs )
Replaces the option contents with a copy of rhs and returns a reference to the option.
clone
/* virtual */ os_element* clone() const
Returns a base class pointer to a heap-based deep copy of the option.
content
os_option& content( const string& content )
Sets the content to content , and returns a reference to the option.
content
string content() const
Returns the content.
print
/* virtual */ void print( ostream& os ) const
Prints the option to os.
status
os_option& status( option_status status )
Sets the status to status and returns a reference to the option.
status
int status() const
Returns the status setting.
value
os_option& value( const string& value )
Sets the value to value and returns a reference to the option.
value
string value() const
Returns the value, or the empty string if not set.

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved