bux API Reference
1.12.6
Static library of whatever are seen required in general purpose but not directly supported from Modern C++. Or whatever reusable originated from my side projects.
Toggle main menu visibility
Loading...
Searching...
No Matches
src
ParserBase.cpp
Go to the documentation of this file.
1
#include "
ParserBase.h
"
2
//----------------------------------------------------------
3
#include <format>
// std::format()
4
#include <ostream>
// std::ostream
5
6
namespace
bux
{
7
8
//
9
// Implement Classes
10
//
11
void
C_ParserLogCount::log
(
E_LogLevel
ll,
const
C_SourcePos
&pos, std::string_view message)
12
{
13
++
m_count
.at(ll);
14
static
constinit
char
const
*
const
LELEL_NAMES[]{
"Fatal"
,
"Error"
,
"Warn"
,
"Info"
,
"Verbose"
};
15
println
(std::format(
"{} {}: {}"
,
toStr
(pos), LELEL_NAMES[ll], message));
16
}
17
18
std::string
C_ParserLogCount::toStr
(
const
C_SourcePos
&pos)
const
19
{
20
if
(pos.
m_Source
.empty())
21
return
std::format(
"({},{})"
, pos.
m_Line
, pos.
m_Col
);
22
else
23
return
std::format(
"{}@({},{})"
, pos.
m_Source
, pos.
m_Line
, pos.
m_Col
);
24
}
25
26
void
C_ParserOStreamCount::println(
const
std::string &line)
27
{
28
m_out <<line <<
'\n'
;
29
}
30
31
}
//namespace bux
ParserBase.h
bux::C_ParserLogCount::println
virtual void println(const std::string &line)=0
bux::C_ParserLogCount::m_count
std::array< unsigned, LL_VERBOSE+1 > m_count
Definition
ParserBase.h:84
bux::C_ParserLogCount::log
void log(E_LogLevel ll, const C_SourcePos &pos, std::string_view message)
Definition
ParserBase.cpp:11
bux::C_ParserLogCount::toStr
virtual std::string toStr(const C_SourcePos &pos) const
Definition
ParserBase.cpp:18
bux
THE common namespace of bux library.
Definition
AtomiX.cpp:3
bux::E_LogLevel
E_LogLevel
Definition
LogLevel.h:9
bux::C_SourcePos
Definition
LexBase.h:39
bux::C_SourcePos::m_Col
unsigned m_Col
Definition
LexBase.h:43
bux::C_SourcePos::m_Source
std::string_view m_Source
Definition
LexBase.h:41
bux::C_SourcePos::m_Line
unsigned m_Line
Definition
LexBase.h:42
Generated by
1.18.0