Definition at line 28 of file listing.cpp.
◆ Content
◆ Parser() [1/2]
Definition at line 123 of file listing.cpp.
124 static const int SIZE = 1024;
127 while (!stream.
eof()) {
128 std::memset(buffer, 0, SIZE);
129 stream(buffer, SIZE);
131 while (i < SIZE && buffer[i] != 0) {
132 if (buffer[i] ==
'\n') {
std::vector< Listing::Block > * currentChapter
void processLine(std::string line)
◆ Parser() [2/2]
Beatmup::Listing::Parser::Parser |
( |
std::istream & |
stream, |
|
|
Content & |
chapters |
|
) |
| |
|
inline |
Definition at line 145 of file listing.cpp.
146 for (std::string line; std::getline(stream, line); )
◆ extractKeyValuePair()
void Beatmup::Listing::Parser::extractKeyValuePair |
( |
std::string |
line | ) |
|
|
inlineprivate |
Definition at line 37 of file listing.cpp.
38 const auto delim = line.find(
":");
39 if (delim != std::string::npos) {
41 while (i < line.size() && line[i] ==
' ')
43 currentChapter->back().mapping.emplace(line.substr(0, delim), line.substr(i));
std::string to_string(Beatmup::NNets::ActivationFunction function)
◆ processLine()
void Beatmup::Listing::Parser::processLine |
( |
std::string |
line | ) |
|
|
inlineprivate |
Definition at line 49 of file listing.cpp.
50 const std::string originalLine = line;
57 if (line.back() ==
'\r')
61 auto numberSign = line.find(
'#');
62 if (numberSign != std::string::npos) {
64 for (
size_t i = 0; i < numberSign - 1; ++i)
69 line = line.substr(0, numberSign);
73 auto l = line.find_last_not_of(
' ');
74 if (l == std::string::npos)
76 if (l != line.length() - 1)
77 line = line.substr(0, l + 1);
84 if (line.front() !=
' ' && line.front() !=
'-' && line.back() ==
':') {
86 auto it =
chapters.emplace(std::piecewise_construct, std::forward_as_tuple(line), std::forward_as_tuple());
95 auto i = line.find_first_not_of(
' ');
96 if (i != std::string::npos && i + 2 < line.length() && line[i] ==
'-' && line[i + 1] ==
' ') {
112 else if (line.find_first_not_of(
' ') ==
chapterIndent.length()) {
void extractKeyValuePair(std::string line)
std::string chapterIndent
◆ chapters
Content& Beatmup::Listing::Parser::chapters |
|
private |
◆ currentChapter
◆ chapterIndent
std::string Beatmup::Listing::Parser::chapterIndent |
|
private |
◆ lineCounter
int Beatmup::Listing::Parser::lineCounter |
|
private |
The documentation for this class was generated from the following file: