Numworks Epsilon
1.4.1
Graphing Calculator Operating System
console_line.h
Go to the documentation of this file.
1
#ifndef CODE_CONSOLE_LINE_H
2
#define CODE_CONSOLE_LINE_H
3
4
#include <
stddef.h
>
5
6
namespace
Code
{
7
8
class
ConsoleLine
{
9
public
:
10
enum class
Type
{
11
CurrentSessionCommand
= 0,
12
CurrentSessionResult
= 1,
13
PreviousSessionCommand
= 2,
14
PreviousSessionResult
= 3
15
};
16
ConsoleLine
(
Type
type
=
Type::CurrentSessionCommand
,
const
char
*
text
=
nullptr
) :
17
m_type(
type
), m_text(
text
) {}
18
Type
type
()
const
{
return
m_type; }
19
const
char
*
text
()
const
{
return
m_text; }
20
bool
isFromCurrentSession
()
const
{
return
m_type ==
Type::CurrentSessionCommand
|| m_type ==
Type::CurrentSessionResult
; }
21
bool
isCommand
()
const
{
return
m_type ==
Type::CurrentSessionCommand
|| m_type ==
Type::PreviousSessionCommand
; }
22
bool
isResult
()
const
{
return
m_type ==
Type::CurrentSessionResult
|| m_type ==
Type::PreviousSessionResult
; }
23
static
inline
size_t
sizeOfConsoleLine
(
size_t
textLength) {
24
return
1 + textLength + 1;
// Marker, text, null termination
25
}
26
private
:
27
Type
m_type;
28
const
char
* m_text;
29
};
30
31
}
32
33
#endif
Code::ConsoleLine::sizeOfConsoleLine
static size_t sizeOfConsoleLine(size_t textLength)
Definition:
console_line.h:23
Code::ConsoleLine::Type::CurrentSessionResult
Code::ConsoleLine::Type::PreviousSessionCommand
Code::ConsoleLine::ConsoleLine
ConsoleLine(Type type=Type::CurrentSessionCommand, const char *text=nullptr)
Definition:
console_line.h:16
Code::ConsoleLine::isFromCurrentSession
bool isFromCurrentSession() const
Definition:
console_line.h:20
Code::ConsoleLine::Type::CurrentSessionCommand
Code::ConsoleLine::type
Type type() const
Definition:
console_line.h:18
Code
Definition:
app.cpp:7
Code::ConsoleLine::text
const char * text() const
Definition:
console_line.h:19
Code::ConsoleLine::isResult
bool isResult() const
Definition:
console_line.h:22
stddef.h
Code::ConsoleLine::Type
Type
Definition:
console_line.h:10
Code::ConsoleLine::isCommand
bool isCommand() const
Definition:
console_line.h:21
Code::ConsoleLine::Type::PreviousSessionResult
Code::ConsoleLine
Definition:
console_line.h:8
epsilon
apps
code
console_line.h
Generated by
1.8.14