MCPcopy Create free account
hub / github.com/NanoMichael/MicroTeX / readSamples

Method readSamples

src/samples/samples.h:19–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 vector<wstring> _samples;
18
19 void readSamples(const string& file = "") {
20 string path = file;
21 if (path.empty()) path = LaTeX::getResRootPath() + "/SAMPLES.tex";
22 string line = "";
23 string sample = "";
24 std::ifstream f(path);
25 if (f.is_open()) {
26 while (getline(f, line)) {
27 if (!line.empty() &&
28 !isSpace(line) &&
29 std::all_of(line.begin(), line.end(), [](char c) { return c == '%'; })) {
30 add(sample);
31 sample = "";
32 } else {
33 if (!line.empty() && !isSpace(line)) sample += line + "\n";
34 }
35 }
36 f.close();
37 }
38 add(sample);
39 }
40
41 void add(const string& str) {
42 if (str.empty()) return;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected