rlmm::basic_key_map< Lock > Struct Template Reference
[The Readline classes.]

#include <rlmm/key_map.hh>

Inheritance diagram for rlmm::basic_key_map< Lock >:

Inheritance graph
[legend]
Collaboration diagram for rlmm::basic_key_map< Lock >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<typename Lock>
struct rlmm::basic_key_map< Lock >

key_map.

class of key_maps

Examples:

rlmmtest.cc.


Public Types

typedef keymap_list::iterator iterator
typedef keymap_list::const_iterator const_iterator
enum  type { function, macro, map }

Public Member Functions

void set_to_system ()
void unset_from_system ()
Basic operations
 basic_key_map ()
 basic_key_map (const std::string &name)
 basic_key_map (bool empty)
 basic_key_map (const basic_key_map< Lock > &km)
 basic_key_map (void *ptr)
virtual ~basic_key_map ()
virtual std::string name () const
Adding and removing bindings in the keymap
virtual bool add (int key, command_t cmd)
virtual bool add (const std::string &keyseq, command_t cmd)
template<class T>
bool add (int key)
template<class T>
bool add (const std::string &keyseq)
virtual bool add_macro (const std::string &macro, const std::string &replace)
virtual bool remove (const std::string &name)
virtual bool remove (int key)
virtual bool remove (command_t cmd)
template<class T>
bool remove ()
Information on keymap
virtual command_t get (const std::string &keys, type &type) const
virtual std::list< std::string > keys (command_t cmd) const
template<class T>
std::list< std::string > keys () const
void list_bindings (bool readable=false)
void list_macros (bool readable=false)

Static Public Member Functions

Manipluate the keymap list
static iterator find_keymap (const std::string &name)
Utility functions
static iterator last ()
static std::string executing_macro ()
static iterator executing_keymap ()
static int ctrl (int key)
static int meta (int key)
static int ctrl_meta (int key)

Protected Types

typedef std::list< rlmm::basic_key_map<
Lock > * > 
keymap_list

Protected Member Functions

void do_activate ()
void do_deactivate ()

Static Protected Member Functions

static void init ()
static iterator find_keymap (void *m)

Protected Attributes

::Keymap _keymap

Static Protected Attributes

static bool _initialized = false
static keymap_list_keymaps = 0

Friends

class one_at_a_time


Member Typedef Documentation

template<typename Lock>
typedef keymap_list::const_iterator rlmm::basic_key_map< Lock >::const_iterator
 

Constant iterator.

template<typename Lock>
typedef keymap_list::iterator rlmm::basic_key_map< Lock >::iterator
 

Iterator.

template<typename Lock>
typedef std::list<rlmm::basic_key_map<Lock>*> rlmm::basic_key_map< Lock >::keymap_list [protected]
 

List of key maps.


Member Enumeration Documentation

template<typename Lock>
enum rlmm::basic_key_map::type
 

Type of action.

Enumerator:
function  If it's a function.
macro  If it's a macro.
map  If it's a key_map.


Constructor & Destructor Documentation

template<typename Lock>
rlmm::basic_key_map< Lock >::basic_key_map  )  [inline]
 

template<typename Lock>
rlmm::basic_key_map< Lock >::basic_key_map const std::string &  name  )  [inline]
 

Create a new (possibly empty) key_map.

template<typename Lock>
rlmm::basic_key_map< Lock >::basic_key_map bool  empty  )  [inline]
 

Create a new (possibly empty) key_map.

template<typename Lock>
rlmm::basic_key_map< Lock >::basic_key_map const basic_key_map< Lock > &  km  )  [inline]
 

Copy a key_map.

template<typename Lock>
rlmm::basic_key_map< Lock >::basic_key_map void *  ptr  )  [inline]
 

Set a key_map from pointer.

template<typename Lock>
rlmm::basic_key_map< Lock >::~basic_key_map  )  [inline, virtual]
 

Destroy a key_map.


Member Function Documentation

template<typename Lock>
template<class T>
bool rlmm::basic_key_map< Lock >::add const std::string &  keyseq  )  [inline]
 

Bind a command to a key sequence in this map.

The template argument should be a sub-class of rlmm::command.

Parameters:
keyseq the key sequence to bind.
Returns:
true on success, false otherwise

template<typename Lock>
template<class T>
bool rlmm::basic_key_map< Lock >::add int  key  )  [inline]
 

Bind a command to a key in this map.

The template argument should be a sub-class of rlmm::command.

Parameters:
key the key to bind.
Returns:
true on success, false otherwise

template<typename Lock>
bool rlmm::basic_key_map< Lock >::add const std::string &  keyseq,
command_t  cmd
[inline, virtual]
 

Bind a command to a key sequence in this map.

Parameters:
keyseq the key sequence to bind.
cmd the command to bind.
Returns:
true on success, false otherwise

template<typename Lock>
bool rlmm::basic_key_map< Lock >::add int  key,
command_t  cmd
[inline, virtual]
 

Bind key to a command in this map.

Parameters:
key the key to bind.
cmd the command to bind.
Returns:
true on success, false otherwise

template<typename Lock>
bool rlmm::basic_key_map< Lock >::add_macro const std::string &  macro,
const std::string &  replace
[inline, virtual]
 

Bind a macro.

To invalidate a macro pass an empty string for the replacment text.

Parameters:
macro is the macro name.
replace is the replacment text.
Returns:
true on success, false otherwise

template<typename Lock>
int rlmm::basic_key_map< Lock >::ctrl int  key  )  [inline, static]
 

Make a C-<key> encoding.

template<typename Lock>
static int rlmm::basic_key_map< Lock >::ctrl_meta int  key  )  [inline, static]
 

Make a C-M-<key> encoding.

template<typename Lock>
void rlmm::basic_key_map< Lock >::do_activate  )  [inline, protected, virtual]
 

Set the current key_map.

Implements rlmm::one_at_a_time< basic_key_map, Lock >.

template<typename Lock>
void rlmm::basic_key_map< Lock >::do_deactivate  )  [inline, protected, virtual]
 

Set the current key_map.

Implements rlmm::one_at_a_time< basic_key_map, Lock >.

template<typename Lock>
basic_key_map< Lock >::iterator rlmm::basic_key_map< Lock >::executing_keymap  )  [inline, static]
 

Return the key_map where current command is executing.

template<typename Lock>
std::string rlmm::basic_key_map< Lock >::executing_macro  )  [inline, static]
 

Return name of currently executing macro, if any.

template<typename Lock>
basic_key_map< Lock >::iterator rlmm::basic_key_map< Lock >::find_keymap const std::string &  name  )  [inline, static]
 

Find a key_map by name.

template<typename Lock>
basic_key_map< Lock >::iterator rlmm::basic_key_map< Lock >::find_keymap void *  m  )  [inline, static, protected]
 

Find a key_map.

Parameters:
m The internal key_map object that identifies the sought key_map.
Returns:
a pointer to rlmm::key_map that contains the argument, or new key_map that contains the argument.

template<typename Lock>
command_t rlmm::basic_key_map< Lock >::get const std::string &  keys,
type type
const [inline, virtual]
 

Get command invoked by key sequence.

Parameters:
keys The key sequence to find the command for.
type The type of the returend command.
Returns:
a pointer to wrapper function, or 0 on failure.

template<typename Lock>
void rlmm::basic_key_map< Lock >::init  )  [inline, static, protected]
 

template<typename Lock>
template<class T>
std::list< std::string > rlmm::basic_key_map< Lock >::keys  )  const [inline]
 

Get a list of keysequences that invokes a command.

Template argument should be a sub-class of rlmm::command.

Returns:
list of keysequences (possibly empty).

template<typename Lock>
std::list< std::string > rlmm::basic_key_map< Lock >::keys command_t  cmd  )  const [inline, virtual]
 

Get a list of keysequences that invokes a command.

Parameters:
cmd The command to find the keysequences for.
Returns:
list of keysequences (possibly empty).

template<typename Lock>
basic_key_map< Lock >::iterator rlmm::basic_key_map< Lock >::last  )  [inline, static]
 

Return last key_map that had a binding.

template<typename Lock>
void rlmm::basic_key_map< Lock >::list_bindings bool  readable = false  )  [inline]
 

List all key-bindings in this map.

Parameters:
readable If true, then output in a format suitable for an INPUTRC file.

template<typename Lock>
void rlmm::basic_key_map< Lock >::list_macros bool  readable = false  )  [inline]
 

List all macrosin this map.

Parameters:
readable If true, then output in a format suitable for an INPUTRC file.

template<typename Lock>
int rlmm::basic_key_map< Lock >::meta int  key  )  [inline, static]
 

Make a M-<key> encoding.

template<typename Lock>
std::string rlmm::basic_key_map< Lock >::name  )  const [inline, virtual]
 

Get the name of the key_map.

template<typename Lock>
template<class T>
bool rlmm::basic_key_map< Lock >::remove  )  [inline]
 

Unbind all keys to a command in this map.

Template argument should be a sub-class of rlmm::commmand.

Returns:
true on success, false otherwise

template<typename Lock>
bool rlmm::basic_key_map< Lock >::remove command_t  cmd  )  [inline, virtual]
 

Unbind all keys bound to a command in this map.

Parameters:
cmd command which should have no keys bound.
Returns:
true on success, false otherwise

template<typename Lock>
bool rlmm::basic_key_map< Lock >::remove int  key  )  [inline, virtual]
 

Unbind a key in this map.

Parameters:
key The key to unbind.
Returns:
true on success, false otherwise

template<typename Lock>
bool rlmm::basic_key_map< Lock >::remove const std::string &  name  )  [inline, virtual]
 

Unbind a named function in this map.

Parameters:
name the macro that should be unbound.
Returns:
true on success, false otherwise

template<typename Lock>
void rlmm::basic_key_map< Lock >::set_to_system  )  [inline]
 

template<typename Lock>
void rlmm::basic_key_map< Lock >::unset_from_system  )  [inline]
 


Friends And Related Function Documentation

template<typename Lock>
friend class one_at_a_time [friend]
 

We befriend out base class.


Member Data Documentation

template<typename Lock>
bool rlmm::basic_key_map< Lock >::_initialized = false [static, protected]
 

template<typename Lock>
::Keymap rlmm::basic_key_map< Lock >::_keymap [protected]
 

Pointer to internal readline struct.

template<typename Lock>
basic_key_map< Lock >::keymap_list * rlmm::basic_key_map< Lock >::_keymaps = 0 [static, protected]
 

List of key_maps.


The documentation for this struct was generated from the following file:
Top of page
Last update Fri Aug 26 15:19:53 2005
Christian Holm
Created by DoxyGen 1.4.4