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

@@ -27,6 +27,7 @@
#define PICONFIG_H
#include "piiodevice.h"
#include "piiostream.h"
#define PICONFIG_GET_VALUE \
Entry & getValue(const PIString & vname, const char * def, bool * exists = 0) {return getValue(vname, PIString(def), exists);} \
@@ -68,7 +69,7 @@ public:
PIConfig(PIString * string, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
//! Contructs and read configuration from custom device "device" in mode "mode"
PIConfig(PIIODevice * device = 0, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
PIConfig(PIIODevice * device = nullptr, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
~PIConfig();
@@ -328,12 +329,15 @@ public:
};
//! Read configuration file at path "path" in mode "mode"
//! Read configuration from file at path "path" in mode "mode"
bool open(const PIString & path, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
//! Read configuration string "string" in mode "mode"
//! Read configuration from string "string" in mode "mode"
bool open(PIString * string, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
//! Read configuration from custom device "device" in mode "mode"
bool open(PIIODevice * device, PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
bool isOpened() const;
//! Returns top-level entry with name "vname", if doesn`t exists return entry with value "def" and set *exist to false
@@ -474,6 +478,8 @@ public:
private:
PIConfig(const PIString & path, PIStringList dirs);
void _init();
void _destroy();
void _setupDev();
void _clearDev();
void _flushDev();
bool _isEndDev();
@@ -493,14 +499,15 @@ private:
PIString parseLine(PIString v);
void parse();
bool own_dev, internal;
bool own_dev = false, internal = false;
PIVector<PIConfig * > includes, inc_devs;
Branch all_includes;
PIIODevice * dev;
PIIODevice * dev = nullptr;
PIIOTextStream * stream = nullptr;
PIString delim;
PIStringList incdirs;
Entry root, empty;
uint lines;
uint lines = 0;
PIStringList other;
};