File: Shell.h

package info (click to toggle)
glgrib 1.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,861,496 kB
  • sloc: cpp: 20,811; ansic: 6,530; perl: 2,902; sh: 513; makefile: 147; python: 58; sql: 18
file content (99 lines) | stat: -rw-r--r-- 3,603 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#pragma once

#include "glGrib/Options.h"

#include <string>
#include <vector>
#include <map>
#include <list>
#include <functional>
#include <stdexcept>

namespace glGrib
{

class Render;

class Shell
{
public:
  virtual void setup (const OptionsShell &)  = 0;
  virtual void start (class WindowSet *)  = 0;
  virtual void run ()  = 0;
  virtual void execute (const std::vector<std::string> &);
  bool closed () { return close; }
  void setClosed () { close = true; }

  virtual void lock ()  = 0;
  virtual void unlock ()  = 0;
  virtual void wait () = 0;

  const OptionsShell & getOptions () const { return opts; }
  void setOptions (const OptionsShell & o) { opts = o; }
  bool started () { return wset != nullptr; }

  // Run command and store result in listStr
  void do_help          (const std::vector<std::string> &, glGrib::Render *);
  void do_get           (const std::vector<std::string> &, glGrib::Render *);
  void do_json          (const std::vector<std::string> &, glGrib::Render *);
  void do_close         (const std::vector<std::string> &, glGrib::Render *);
  void do_snapshot      (const std::vector<std::string> &, glGrib::Render *);
  void do_sleep         (const std::vector<std::string> &, glGrib::Render *);
  void do_clone         (const std::vector<std::string> &, glGrib::Render *);
  void do_set           (const std::vector<std::string> &, glGrib::Render *);
  void do_window        (const std::vector<std::string> &, glGrib::Render *);
  void do_window_select (const std::vector<std::string> &, glGrib::Render *);
  void do_window_list   (const std::vector<std::string> &, glGrib::Render *);
  void do_clear         (const std::vector<std::string> &, glGrib::Render *);
  void do_list          (const std::vector<std::string> &, glGrib::Render *);
  void do_resolve       (const std::vector<std::string> &, glGrib::Render *);
  void do_goto          (const std::vector<std::string> &, glGrib::Render *);

  // Process command output
  virtual void process_help          (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_get           (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_json          (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_close         (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_snapshot      (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_sleep         (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_clone         (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_set           (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_window        (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_clear         (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_list          (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_resolve       (const std::vector<std::string> &, glGrib::Render *) {}
  virtual void process_goto          (const std::vector<std::string> &, glGrib::Render *) {}

  const std::vector<std::string> & getList ()
  {
    return listStr;
  }

  void setWindowSet (WindowSet *);

  WindowSet * getWindowSet ();

  void clearWindowSet ();

  int getWindowId () const
  {
    return windowid;
  }

  Render * getWindow ();

  Render * getFirstWindow ();

private:

  int close = 0;
  int windowid = 0;

  OptionsShell opts;
  WindowSet * wset = nullptr;

  std::vector<std::string> listStr;

};

}