version 2.98.0

remove PIFile::readLine()
partially migrate PIConfig to text stream
add more "override"
This commit is contained in:
2022-08-01 18:13:22 +03:00
parent 97734953dd
commit b0d48caaad
8 changed files with 127 additions and 156 deletions

View File

@@ -1,5 +1,6 @@
#include "parser.h"
#include "piconfig.h"
#include "piiostream.h"
PIVector<ParserSection> parse(const PIString & path) {
@@ -32,9 +33,10 @@ ParserEntry makeEntry(PIString filename, const PIString & dir) {
PIVector<ParserSection> parseConf(PIFile & file, const PIString & dir) {
PIVector<ParserSection> ret;
if (!file.isOpened()) return ret;
PIIOTextStream ts(&file);
ParserSection ps;
while (!file.isEnd()) {
PIString line = file.readLine().trim();
while (!ts.isEnd()) {
PIString line = ts.readLine().trim();
if (line.isEmpty()) continue;
if (line.startsWith("[") && line.endsWith("]")) {
if (!ps.files.isEmpty()) ret << ps;
@@ -61,10 +63,11 @@ PIVector<ParserSection> parseConf(PIFile & file, const PIString & dir) {
PIVector<ParserSection> parseQRC(PIFile & file, const PIString & dir) {
PIVector<ParserSection> ret;
if (!file.isOpened()) return ret;
PIIOTextStream ts(&file);
ParserSection ps;
bool is_files = false;
while (!file.isEnd()) {
PIString line = file.readLine().trim();
while (!ts.isEnd()) {
PIString line = ts.readLine().trim();
if (line.isEmpty()) continue;
if (line.startsWith("<qresource")) {
if (!ps.files.isEmpty()) ret << ps;