/[svn]/linuxsampler/trunk/src/shell/TerminalCtrl.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/shell/TerminalCtrl.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2515 - (show annotations) (download) (as text)
Wed Feb 5 20:45:18 2014 UTC (10 years, 1 month ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 1436 byte(s)
* WIP: Introducing the LSCP shell: for now, providing color
  highlighting while typing (indicating correct part bold white,
  incorrect part red, and turning green when the command is
  complete. The shell application is implemented as thin client,
  that is the parser work is performed on sampler side and the
  shell application is just providing output formatting.
* Bumped version (1.0.0.svn28).

1 /*
2 * LSCP Shell
3 *
4 * Copyright (c) 2014 Christian Schoenebeck
5 *
6 * This program is part of LinuxSampler and released under the same terms.
7 */
8
9 #ifndef TERMINALCTRL_H
10 #define TERMINALCTRL_H
11
12 #include <vector>
13 #include <string>
14
15 class TerminalCtrl;
16
17 /**
18 * Represents a state of the command line terminal for being restored later on
19 * at arbitrary time.
20 */
21 class TerminalSetting {
22 public:
23 TerminalSetting();
24 TerminalSetting(const TerminalSetting& ts);
25 virtual ~TerminalSetting();
26 bool valid() const;
27 protected:
28 void* p;
29 friend class TerminalCtrl;
30 };
31
32 /**
33 * OS dependent implementation for controlling keyboard input behavior and
34 * retrieving terminal screen size (rows and columns).
35 *
36 * Current implementation assumes a POSIX compatible system.
37 *
38 * This is a lite-weight class to prevent a dependency to i.e. libncurses.
39 */
40 class TerminalCtrl {
41 public:
42 static std::vector<char> getChars(int max, int blockUntilMin, int burstDeciSeconds = 0);
43 static std::vector<char> getCharsToDelimiter(char delimiter, bool includeDelimiter = false);
44 static std::string getStringToDelimiter(char delimiter, bool includeDelimiter = false);
45 static int echoInput(bool b);
46 static int immediateInput(bool b);
47 static int reset();
48 static int restore(const TerminalSetting& setting);
49 static TerminalSetting now();
50 static int columns();
51 static int rows();
52 };
53
54 #endif // TERMINALCTRL_H

  ViewVC Help
Powered by ViewVC