duncan
Mom and Dad were wrong!
Public Member Functions
client::InputLine Class Reference

#include <inputline.h>

List of all members.

Public Member Functions

 InputLine (size_t mlen=16, size_t bwidth=16)
bool new_char (unsigned int)
void reset (size_t mlen=0, size_t bwidth=0)
void set_input (const std::string &)
size_t cursorpos ()
std::string & input ()
std::string & print ()

Detailed Description

Store and update a line of text input, and handle special characters (such as backspace and enter) when they are typed.

Author:
Harry Slatyer

see LICENSE


Constructor & Destructor Documentation

InputLine::InputLine ( size_t  mlen = 16,
size_t  bwidth = 16 
)

Initialise members.

Parameters:
mlenmaximum length of input string
bwidthwidth of box into which text is being entered

Member Function Documentation

size_t InputLine::cursorpos ( )

Get the position of the cursor.

Returns:
cursor position
std::string & InputLine::input ( )

Get the full input string.

Returns:
input string
bool InputLine::new_char ( unsigned int  ch)

Insert a new 'character' (possibly backspace, enter, left, right, etc..) into the string

Parameters:
chcharacter to be inserted
Returns:
whether or not 'enter' was pressed
std::string & InputLine::print ( )

Get the substring visible in the text box.

Returns:
visible substring
void InputLine::reset ( size_t  mlen = 0,
size_t  bwidth = 0 
)

Reset the line of input, changing the maximum length and box size if necessary.

Parameters:
mlenmaximum length of input string
bwidthwidth of box into which text is entered
void InputLine::set_input ( const std::string &  str)

Set the initial string.

Parameters:
strinitial string

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations