$treeview $search $mathjax
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <readline/keymaps.h>
#include <string>
#include <fstream>
#include <vector>
#include <stdexcept>
#include <map>
#include <boost/algorithm/string/trim.hpp>
#include <boost/tokenizer.hpp>
#include <boost/function.hpp>
Go to the source code of this file.
Namespaces | |
| namespace | swift |
Classes | |
| class | swift::SKeymap |
| The readline keymap wrapper. More... | |
| class | swift::SReadline |
| The readline library wrapper. More... | |
Typedefs | |
| typedef std::vector< std::string > | TokensStorage |
| Tokens in a single variation of a user command. | |
| typedef std::vector< TokensStorage > | CompletionsStorage |
| Set of variations of user commands. | |
| typedef boost::function< int(int, int)> | KeyCallback |
| Pressed key callback. Must return 0 if OK, != 0 otherwise. | |
| typedef std::map< int, KeyCallback > | KeysBind |
| A set of keys binding. | |
Functions | |
| const size_t | DefaultHistoryLimit (64) |
| bool | KeymapWasSetup (false) |
| Keymap | Earlykeymap (0) |
| char * | Generator (const char *text, int State) |
| Custom completion generator. | |
| char ** | UserCompletion (const char *text, int start, int end) |
| The function is called before trying to complete a token. | |
| int | KeyDispatcher (int Count, int Key) |
| The function selects the set of bindings and makes the corresponding call. | |
| int | StartupHook (void) |
| The readline startup hook. It is required to setup the proper keymap. | |
| template<typename Container> | |
| bool | AreTokensEqual (const Container &Pattern, const Container &Input) |
| Compares all the Input tokens with starts tokens in the Pattern. | |
| template<typename ContainerType> | |
| void | SplitTokens (const std::string &Source, ContainerType &Container) |
| char ** | UserCompletion (const char *text, int start, int end) |
| char * | Generator (const char *text, int State) |
| int | KeyDispatcher (int Count, int Key) |
| int | StartupHook (void) |
Variables | |
| CompletionsStorage | Completions |
| TokensStorage | Tokens |
| std::map< Keymap, KeysBind > | Keymaps |
Supported: editing, history, custom completers, keymaps. Attention: implementation is not thread safe! It is mainly because the readline library provides pure C interface and has many calls for an "atomic" completion operation
Definition in file SReadline.hpp.
typedef std::vector<std::string> TokensStorage [static] |
typedef std::vector<TokensStorage> CompletionsStorage [static] |
typedef boost::function<int (int, int)> KeyCallback [static] |
Pressed key callback. Must return 0 if OK, != 0 otherwise.
Definition at line 64 of file SReadline.hpp.
typedef std::map<int, KeyCallback> KeysBind [static] |
| const size_t @0::DefaultHistoryLimit | ( | 64 | ) | [static] |
Default value for the history length.
| bool @0::KeymapWasSetup | ( | false | ) | [static] |
Has sense if a keymap was setup before the first readline call.
Referenced by swift::SReadline::SetKeymap(), and StartupHook().
| Keymap @0::Earlykeymap | ( | 0 | ) | [static] |
The keymap which was setup before the first readline call.
Referenced by swift::SReadline::SetKeymap(), and StartupHook().
| char* @0::Generator | ( | const char * | text, | |
| int | State | |||
| ) | [static] |
Custom completion generator.
| text | Pointer to a token to be completed | |
| State | 0 for a first call, non 0 for all consequent calls |
Referenced by UserCompletion().
| char** @0::UserCompletion | ( | const char * | text, | |
| int | start, | |||
| int | end | |||
| ) | [static] |
The function is called before trying to complete a token.
| text | A token to be completed | |
| start | Index of the beginning of the token in the readline buffer | |
| end | Index of the end of the token in the readline buffer |
Referenced by swift::SReadline::SReadline().
| int @0::KeyDispatcher | ( | int | Count, | |
| int | Key | |||
| ) | [static] |
The function selects the set of bindings and makes the corresponding call.
| Count | The parameter is passed by readline | |
| Key | The pressed key |
Referenced by swift::SKeymap::Bind().
| int @0::StartupHook | ( | void | ) | [static] |
The readline startup hook. It is required to setup the proper keymap.
Referenced by swift::SReadline::SReadline().
| bool @0::AreTokensEqual | ( | const Container & | Pattern, | |
| const Container & | Input | |||
| ) | [static] |
Compares all the Input tokens with starts tokens in the Pattern.
| Pattern | pattern tokens | |
| Input | user input tokens |
Definition at line 146 of file SReadline.hpp.
Referenced by Generator(), and UserCompletion().
| void @0::SplitTokens | ( | const std::string & | Source, | |
| ContainerType & | Container | |||
| ) | [static] |
Definition at line 169 of file SReadline.hpp.
Referenced by swift::SReadline::GetLine(), swift::SReadline::RegisterCompletions(), and UserCompletion().
| char** @0::UserCompletion | ( | const char * | text, | |
| int | start, | |||
| int | end | |||
| ) | [static] |
Definition at line 189 of file SReadline.hpp.
References AreTokensEqual(), Completions, Generator(), SplitTokens(), and Tokens.
| char* @0::Generator | ( | const char * | text, | |
| int | State | |||
| ) | [static] |
| int @0::KeyDispatcher | ( | int | Count, | |
| int | Key | |||
| ) | [static] |
| int @0::StartupHook | ( | void | ) | [static] |
CompletionsStorage Completions [static] |
Global storage of custom completions.
Definition at line 79 of file SReadline.hpp.
Referenced by Generator(), swift::SReadline::RegisterCompletions(), and UserCompletion().
TokensStorage Tokens [static] |
Tokens storage for a single completion session.
Definition at line 84 of file SReadline.hpp.
Referenced by Generator(), and UserCompletion().
Global storage for keymaps.
Definition at line 89 of file SReadline.hpp.
Referenced by swift::SKeymap::Bind(), KeyDispatcher(), swift::SKeymap::SKeymap(), swift::SKeymap::Unbind(), and swift::SKeymap::~SKeymap().
1.4.7
Generated on Sun Jun 7 15:18:12 2015 for StdAir by
1.4.7