Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Concepts
Prompt.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <deque>
9
11
12class Prompt {
13 std::deque < std::shared_ptr < cli::LineInterface > > m_lineInterfaces;
14
15 cli::Environment m_environment;
16
17 Prompt ( cli::Environment environment );
18
19public:
20 Prompt ( const Prompt & ) = delete;
21
22 Prompt ( Prompt && ) = delete;
23
24 Prompt & operator = ( const Prompt & ) = delete;
25
26 Prompt & operator = ( Prompt && ) = delete;
27
28 static Prompt & getPrompt ( ) {
29 static Prompt instance { cli::Environment ( ) };
30 return instance;
31 }
32
33 template < class LineInterface >
34 void appendCharSequence ( LineInterface && lineInterface ) {
35 m_lineInterfaces.push_back ( std::make_shared < LineInterface > ( std::forward < LineInterface > ( lineInterface ) ) );
36 }
37
38 template < class LineInterface >
39 void prependCharSequence ( LineInterface && lineInterface ) {
40 m_lineInterfaces.push_front ( std::make_shared < LineInterface > ( std::forward < LineInterface > ( lineInterface ) ) );
41 }
42
44
46 return m_environment;
47 }
48};
49
Definition: Prompt.h:12
Prompt & operator=(const Prompt &)=delete
Prompt(const Prompt &)=delete
static Prompt & getPrompt()
Definition: Prompt.h:28
void appendCharSequence(LineInterface &&lineInterface)
Definition: Prompt.h:34
cli::Environment & getEnvironment()
Definition: Prompt.h:45
Prompt(Prompt &&)=delete
void prependCharSequence(LineInterface &&lineInterface)
Definition: Prompt.h:39
Definition: Environment.h:29
cli::CommandResult run()
Definition: Prompt.cpp:11
CommandResult
Definition: CommandResult.h:10