ALib C++ Library
Library Version:
2312 R0
Documentation generated by
home
dev
A-Worx
ALib
src
alib
text
text.hpp
Go to the documentation of this file.
1
/** ************************************************************************************************
2
* \file
3
* This header file is part of module \alib_text of the \aliblong.
4
*
5
* \emoji :copyright: 2013-2023 A-Worx GmbH, Germany.
6
* Published under \ref mainpage_license "Boost Software License".
7
**************************************************************************************************/
8
#ifndef HPP_ALIB_TEXT_TEXT
9
#define HPP_ALIB_TEXT_TEXT 1
10
11
#if !defined(HPP_ALIB_TEXT_FWDS)
12
#include "
alib/text/fwds.hpp
"
13
#endif
14
15
#if !defined(HPP_ALIB_RESULTS_EXCEPTION)
16
#include "
alib/results/exception.hpp
"
17
#endif
18
19
#if !defined(HPP_ALIB_FS_MODULES_MODULE)
20
# include "
alib/lib/fs_modules/module.hpp
"
21
#endif
22
23
#if ALIB_TIME
24
# if !defined(HPP_ALIB_TIME_TICKS)
25
# include "
alib/time/ticks.hpp
"
26
# endif
27
# if !defined(HPP_ALIB_TIME_DATETIME)
28
# include "
alib/time/datetime.hpp
"
29
# endif
30
#endif
31
32
namespace
aworx
{
namespace
lib {
namespace
text {
33
34
/** ****************************************************************************************
35
* Enumeration of exceptions thrown with classes found in module \alib_text.
36
******************************************************************************************/
37
enum class
Exceptions
38
{
39
/** Argument index '0' not allowed. */
40
ArgumentIndexIs0
=11,
41
42
/** Argument index greater than number of arguments available. */
43
ArgumentIndexOutOfBounds
=12,
44
45
/** Incompatible type code given argument type found. */
46
IncompatibleTypeCode
=13,
47
48
49
/** Thrown by \alib{text,FormatterPythonStyle,FormatterPythonStyle}:
50
* Closing bracket <c>'}'</c> not found. */
51
MissingClosingBracket
=101,
52
53
/** Thrown by \alib{text,FormatterPythonStyle,FormatterPythonStyle}:
54
* Missing precision integral value after <c>'.'</c> character. */
55
MissingPrecisionValuePS
=102,
56
57
/** Thrown by \alib{text,FormatterPythonStyle,FormatterPythonStyle}:
58
* Duplicate type code. */
59
DuplicateTypeCode
=103,
60
61
/** Thrown by \alib{text,FormatterPythonStyle,FormatterPythonStyle}:
62
* Unknown type code. */
63
UnknownTypeCode
=104,
64
65
/** Thrown by \alib{text,FormatterPythonStyle,FormatterPythonStyle}:
66
* Expected <c>'!'</c> not found. */
67
ExclamationMarkExpected
=105,
68
69
/** Thrown by \alib{text,FormatterPythonStyle,FormatterPythonStyle}:
70
* Unknown conversion after <c>'!'</c>. */
71
UnknownConversionPS
=106,
72
73
/** Thrown by \alib{text,FormatterPythonStyle,FormatterPythonStyle}:
74
* Precision specification not allowed with integer types. */
75
PrecisionSpecificationWithInteger
=107,
76
77
/** Thrown by \alib{text,FormatterPythonStyle,FormatterPythonStyle}:
78
* Missing replacement strings after conversion <c>!Replace</c>.*/
79
MissingReplacementStrings
=108,
80
81
82
83
// Formatter Java Style
84
/** Thrown by \alib{text,FormatterJavaStyle,FormatterJavaStyle}:
85
* Formatting of negative values in brackets is not supported. */
86
NegativeValuesInBracketsNotSupported
=201,
87
88
/** Thrown by \alib{text,FormatterJavaStyle,FormatterJavaStyle}:
89
* Missing precision integral value after <c>'.'</c> character. */
90
MissingPrecisionValueJS
=202,
91
92
/** Thrown by \alib{text,FormatterJavaStyle,FormatterJavaStyle}:
93
* Output of floating point values in hexadecimal format not supported. */
94
HexadecimalFloatFormatNotSupported
=203,
95
96
/** Thrown by \alib{text,FormatterJavaStyle,FormatterJavaStyle}:
97
* The alternate form '#' is not supported with given conversion. */
98
NoAlternateFormOfConversion
=204,
99
100
/** Thrown by \alib{text,FormatterJavaStyle,FormatterJavaStyle}:
101
* Precision specification is not supported with given conversion. */
102
NoPrecisionWithConversion
=205,
103
104
/** Thrown by \alib{text,FormatterJavaStyle,FormatterJavaStyle}:
105
* Unknown conversion suffix with with data/time conversion. */
106
UnknownDateTimeConversionSuffix
=206,
107
108
/** Thrown by \alib{text,FormatterJavaStyle,FormatterJavaStyle}:
109
* Unknown conversion character. */
110
UnknownConversionJS
=207,
111
112
113
// PropertyFormatter and PropertyFormatters
114
/**
115
* Thrown by constructor of \alib{text,PropertyFormatter}
116
* when a property identifier parsed from the format string has no corresponding entry in the
117
* \alib{text,PropertyFormatter::TCallbackTable,TCallbackTable} provided.
118
*/
119
UnknownPropertyInFormatString
=501,
120
121
/**
122
* Exception entry added in method \alib{text,PropertyFormatter::Format}
123
* when the underlying formatter throws.
124
*/
125
ErrorInResultingFormatString
=502,
126
127
/**
128
* Thrown by \alib{text,PropertyFormatters::Format} if a configuration variable
129
* can not be loaded or is empty.
130
*
131
* \note To prevent this, software using this class should provide
132
* \aworx{lib,Module::GetResourcePool,resourced} default values for each formatter variable.
133
*/
134
MissingConfigurationVariable
=510,
135
136
137
// class Paragraphs
138
/**
139
* Thrown by \alib{text,Paragraphs::AddMarked}
140
* when an unknown marker token was found.
141
*/
142
UnknownMarker
=601,
143
144
/**
145
* Thrown by \alib{text,Paragraphs::AddMarked}
146
* when a property identifier parsed from the format string has no corresponding entry in the
147
* \alib{text,PropertyFormatter::TCallbackTable,TCallbackTable} provided.
148
*/
149
EndmarkerWithoutStart
=602,
150
151
};
// Exceptions
152
153
/** ************************************************************************************************
154
* This is a strict singleton class representing module \alib_text.
155
*
156
* The only instance is found with namespace variable \ref aworx::lib::TEXT.
157
**************************************************************************************************/
158
class
Text
:
public
Module
159
{
160
public
:
161
/** ****************************************************************************************
162
* Constructor.<br>
163
* While this is public, it must not be invoked as this is a strict singleton type.
164
* (See notes in \ref alib_manual_bootstrapping_class_module_singletons).
165
******************************************************************************************/
166
Text
();
167
168
protected
:
169
/** ****************************************************************************************
170
* Initializes namespace \alib \ref aworx::lib::text.
171
*
172
* @param phase The initialization phase to perform.
173
* @param argc The number of command line arguments. Defaults to \c 0.
174
* @param argv List of command line arguments if given as single byte character strings.
175
* @param wargv List of command line arguments if given as multi-byte character strings.
176
******************************************************************************************/
177
virtual
void
bootstrap
(
BootstrapPhases
phase,
178
int
argc,
const
char
**argv,
179
const
wchar_t
**wargv )
override
;
180
181
/** ****************************************************************************************
182
* Terminates this module.
183
* @param phase The shutdown phase to perform.
184
******************************************************************************************/
185
virtual
void
shutdown
(
ShutdownPhases
phase )
override
;
186
187
};
// class Text
188
}
// namespace aworx::lib[::text]
189
190
/** The singleton of module-class \alib{text,Text}. */
191
extern
ALIB_API
text::Text
TEXT
;
192
193
}}
// namespace [aworx::lib]
194
195
ALIB_BOXING_VTABLE_DECLARE
(
aworx::lib::text::Exceptions
, vt_text_exceptions )
196
197
198
ALIB_ENUMS_ASSIGN_RECORD
(
aworx::lib::text::Exceptions
,
aworx::lib::results::ERException
)
199
ALIB_RESOURCED_IN_MODULE
(
aworx::lib::text::Exceptions
,
aworx::lib::TEXT
,
"E"
)
200
201
#endif // HPP_ALIB_TEXT_TEXT
202
ALIB_RESOURCED_IN_MODULE
#define ALIB_RESOURCED_IN_MODULE(T, Module, ResName)
Definition:
resources.hpp:648
aworx::lib::text::Exceptions::DuplicateTypeCode
aworx::lib::text::Exceptions::UnknownConversionJS
aworx::lib::text::Exceptions::PrecisionSpecificationWithInteger
aworx::lib::text::Text::shutdown
virtual void shutdown(ShutdownPhases phase) override
Definition:
text.cpp:202
aworx::lib::Module::ShutdownPhases
ShutdownPhases
Definition:
module.hpp:88
aworx::lib::text::Text::bootstrap
virtual void bootstrap(BootstrapPhases phase, int argc, const char **argv, const wchar_t **wargv) override
Definition:
text.cpp:69
aworx::lib::text::Exceptions::NoPrecisionWithConversion
aworx::lib::text::Exceptions::UnknownMarker
aworx::lib::text::Exceptions::IncompatibleTypeCode
aworx::lib::text::Exceptions::MissingPrecisionValuePS
aworx::lib::Module::BootstrapPhases
BootstrapPhases
Definition:
module.hpp:78
datetime.hpp
aworx::lib::text::Exceptions::UnknownTypeCode
ALIB_BOXING_VTABLE_DECLARE
#define ALIB_BOXING_VTABLE_DECLARE(TMapped, Identifier)
Definition:
vtable.inl:477
ticks.hpp
aworx::lib::text::Exceptions::UnknownDateTimeConversionSuffix
aworx::lib::text::Exceptions::MissingClosingBracket
aworx::lib::text::Exceptions
Exceptions
Definition:
text.hpp:37
aworx::lib::text::Exceptions::NegativeValuesInBracketsNotSupported
aworx::lib::text::Exceptions::MissingConfigurationVariable
aworx::lib::text::Exceptions::UnknownPropertyInFormatString
aworx::lib::results::ERException
Definition:
exception.hpp:62
aworx
Definition:
alox/alox.hpp:40
aworx::lib::text::Exceptions::EndmarkerWithoutStart
aworx::lib::text::Text::Text
Text()
Definition:
text.cpp:61
aworx::lib::text::Exceptions::ErrorInResultingFormatString
aworx::lib::TEXT
text::Text TEXT
Definition:
text.cpp:48
module.hpp
ALIB_ENUMS_ASSIGN_RECORD
#define ALIB_ENUMS_ASSIGN_RECORD(TEnum, TRecord)
Definition:
records.hpp:769
aworx::lib::text::Exceptions::ArgumentIndexIs0
ALIB_API
#define ALIB_API
Definition:
compilers.hpp:150
aworx::lib::text::Exceptions::MissingReplacementStrings
exception.hpp
aworx::lib::text::Text
Definition:
text.hpp:158
aworx::lib::text::Exceptions::ArgumentIndexOutOfBounds
aworx::lib::Module
Definition:
module.hpp:74
aworx::lib::text::Exceptions::UnknownConversionPS
aworx::lib::text::Exceptions::ExclamationMarkExpected
aworx::lib::text::Exceptions::NoAlternateFormOfConversion
aworx::lib::text::Exceptions::MissingPrecisionValueJS
fwds.hpp
aworx::lib::text::Exceptions::HexadecimalFloatFormatNotSupported