cppx-core
cppx-core
text
data
ascii-character-names.hpp
Go to the documentation of this file.
1
#pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi").
2
3
namespace
cppx
4
{
5
namespace
ascii
6
{
7
const
char
null
=
'\0'
;
// '\0' 0x00
8
const
char
bell
=
'\a'
;
// '\a' 0x07, ^G
9
const
char
backspace
=
'\b'
;
// '\b' 0x07, ^H
10
const
char
tab
=
'\t'
;
// '\t' 0x08, ^I, horizontal tab
11
const
char
linefeed
=
'\n'
;
// '\n' 0x09, ^J
12
const
char
vtab
=
'\v'
;
// '\v' 0x0A, ^K
13
const
char
formfeed
=
'\f'
;
// '\f' 0x0B, ^L
14
const
char
enter
=
'\r'
;
// '\r' 0x0C, ^M
15
const
char
xon
=
'\x11'
;
// 0x11, ^Q, "continue"
16
const
char
xoff
=
'\x13'
;
// 0x13, ^S, "stop"
17
const
char
end_of_text
=
'\x1A'
;
// 0x1A, ^Z, non-std MS meaning.
18
const
char
escape
=
'\x1B'
;
// 0x1B
19
const
char
del
=
'\x7F'
;
// 0x7F
20
21
const
char
first_char
= char( 0 ); static_assert(
first_char
==
null
);
22
const
char
last_char
= char( 127 ); static_assert(
last_char
==
del
);
23
24
// Standard but unfortunately uppercase abbreviations as per ASCII '67:
25
const
char
NUL
=
null
;
26
const
char
BEL
=
bell
;
27
const
char
BS
=
backspace
;
28
const
char
HT
=
tab
;
// “Horizontal tab”
29
const
char
LF
=
linefeed
;
30
const
char
VT
=
vtab
;
// “Vertical tab”
31
const
char
FF
=
formfeed
;
32
const
char
CR
=
enter
;
// “Carriage return”
33
const
char
DC1
=
xon
;
// “Device control 1”
34
const
char
DC3
=
xoff
;
// “Device control 3”
35
const
char
SUB
=
end_of_text
;
// “Substitute”, but see below!
36
const
char
ESC
=
escape
;
37
const
char
DEL
=
del
;
// “Delete”
38
39
// ASCII DEL, code 0x7F = 127, “delete”, can be used as a replacement for encoding
40
// errors or unrepresentable code point.
41
//
42
// ASCII has a character dedicated to the purpose: SUB “substitute”, code 26,
43
// ^Z. But in Windows ^Z is used as an EOF marker for text streams. So ^Z as
44
// replacement is not usable in Windows, i.e. it's not a general solution.
45
//
46
// Unicode, an extension of ASCII, also has its own character dedicated to
47
// the purpose, namely code U+FFFD “replacement character”. It translates to
48
// at least two UTF-8 bytes so it's not trivial to check for. And it can't be
49
// represented in simple single byte encodings such as codepage 437, so it's
50
// not usable in single byte encodings, i.e. it's not a general solution.
51
//
52
// Using ASCII DEL as a replacement character does not preclude using it also to
53
// represent the DEL key in a keyboard interface, for in that context there is no
54
// possibility of encoding errors or unrepresentable code point. It doesn't appear
55
// in ordinary text. And it even has some mnemonic value as a deleted character.
56
//
57
// For these reasons I recommend using ASCII DEL as replacement and error
58
// indication character:
59
60
const
char
bad_char
=
del
;
61
62
}
// namespace ascii
63
64
const
char
std_ascii_bad_char
=
ascii::end_of_text
;
65
const
wchar_t
std_unicode_bad_char
= L
'\uFFFD'
;
66
67
}
// namespace cppx
cppx::ascii::CR
const char CR
Definition:
ascii-character-names.hpp:32
cppx::ascii::DC1
const char DC1
Definition:
ascii-character-names.hpp:33
cppx::ascii::DEL
const char DEL
Definition:
ascii-character-names.hpp:37
cppx::ascii::tab
const char tab
Definition:
ascii-character-names.hpp:10
cppx::ascii::linefeed
const char linefeed
Definition:
ascii-character-names.hpp:11
cppx::ascii::end_of_text
const char end_of_text
Definition:
ascii-character-names.hpp:17
cppx::ascii::BEL
const char BEL
Definition:
ascii-character-names.hpp:26
cppx::ascii::escape
const char escape
Definition:
ascii-character-names.hpp:18
cppx::ascii::last_char
const char last_char
Definition:
ascii-character-names.hpp:22
cppx::ascii::del
const char del
Definition:
ascii-character-names.hpp:19
cppx::ascii::HT
const char HT
Definition:
ascii-character-names.hpp:28
cppx::ascii::bell
const char bell
Definition:
ascii-character-names.hpp:8
cppx::ascii::formfeed
const char formfeed
Definition:
ascii-character-names.hpp:13
cppx::ascii::backspace
const char backspace
Definition:
ascii-character-names.hpp:9
cppx::ascii::SUB
const char SUB
Definition:
ascii-character-names.hpp:35
cppx::ascii::BS
const char BS
Definition:
ascii-character-names.hpp:27
cppx::ascii::vtab
const char vtab
Definition:
ascii-character-names.hpp:12
cppx
Definition:
dynamic-size-checking.hpp:12
cppx::ascii::xon
const char xon
Definition:
ascii-character-names.hpp:15
cppx::ascii::xoff
const char xoff
Definition:
ascii-character-names.hpp:16
cppx::std_unicode_bad_char
const wchar_t std_unicode_bad_char
Definition:
ascii-character-names.hpp:65
cppx::std_ascii_bad_char
const char std_ascii_bad_char
Definition:
ascii-character-names.hpp:64
cppx::ascii::first_char
const char first_char
Definition:
ascii-character-names.hpp:21
cppx::ascii::FF
const char FF
Definition:
ascii-character-names.hpp:31
cppx::ascii::VT
const char VT
Definition:
ascii-character-names.hpp:30
cppx::ascii::enter
const char enter
Definition:
ascii-character-names.hpp:14
cppx::ascii::NUL
const char NUL
Definition:
ascii-character-names.hpp:25
cppx::ascii::LF
const char LF
Definition:
ascii-character-names.hpp:29
cppx::ascii::DC3
const char DC3
Definition:
ascii-character-names.hpp:34
cppx::ascii::ESC
const char ESC
Definition:
ascii-character-names.hpp:36
cppx::ascii::bad_char
const char bad_char
Definition:
ascii-character-names.hpp:60
Generated by
1.8.15