Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
IReadLine.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2015 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * File: IReadLine.h
21 *
22 */
23#ifndef IREADLINE_H
24#define IREADLINE_H
25
26#include <functional>
27#include <memory>
28#include <string>
29#include <vector>
30#include <list>
31
32
34{
35public:
36 virtual ~IReadLineContext() = default;
37
38 virtual void quit() const = 0;
39 virtual void printLn(const char *fmt, ...) const __attribute__ ((format (printf, 2, 3))) = 0;
40 virtual void printLnError(const char *fmt, ...) const __attribute__ ((format (printf, 2, 3))) = 0;
41};
42
43
45{
46public:
47 static std::shared_ptr<IReadLine> create();
48
49public:
50 virtual ~IReadLine() = default;
51
52public:
53 virtual bool isValid() const = 0;
54 virtual void run()= 0;
55
56 virtual std::shared_ptr<const IReadLineContext> getContext() const = 0;
57
58 typedef std::function<void (const std::shared_ptr<const IReadLineContext>& readLine,
59 const std::vector<std::string>& args)> CommandHandler;
60
61 virtual bool addCommand(const std::string& name, CommandHandler handler,
62 const std::string& desc, const std::string& help,
63 const std::string& opts) = 0;
64
65 virtual void runCommand(int argc, char* const *argv) = 0;
66};
67
68
69#endif // !defined(IREADLINE_H)
Definition IReadLine.h:34
Definition IReadLine.h:45