QPIConfig includes improvements
git-svn-id: svn://db.shs.com.ru/libs@77 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -688,7 +688,7 @@ void QPIConfig::updateIncludes() {
|
||||
}
|
||||
|
||||
|
||||
QString QPIConfig::entryValue(QString v) {
|
||||
QString QPIConfig::parseLine(QString v) {
|
||||
int i = -1, l = 0;
|
||||
while (1) {
|
||||
i = v.indexOf("${");
|
||||
@@ -696,11 +696,18 @@ QString QPIConfig::entryValue(QString v) {
|
||||
l = v.indexOf("}", i + 1);
|
||||
QString w = v.mid(i + 2, l - i - 2), r;
|
||||
l = w.length() + 3;
|
||||
w = parseLine(w);
|
||||
w = w.trimmed();
|
||||
foreach (QPIConfig::Entry * e, all_includes) {
|
||||
if (e->_full_name == w) {
|
||||
r = e->_value;
|
||||
break;
|
||||
bool ex = false;
|
||||
QPIConfig::Entry & me = getValue(w, "", &ex);
|
||||
if (ex) {
|
||||
r = me._value;
|
||||
} else {
|
||||
foreach (QPIConfig::Entry * e, all_includes) {
|
||||
if (e->_full_name == w) {
|
||||
r = e->_value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
v.replace(i, l, r);
|
||||
@@ -735,7 +742,7 @@ void QPIConfig::parse(QString content) {
|
||||
lines = centry = 0;
|
||||
while (!stream.atEnd()) {
|
||||
other.push_back(QString());
|
||||
src = str = stream.readLine();
|
||||
src = str = parseLine(stream.readLine());
|
||||
tprefix = getPrefixFromLine(src, &isPrefix);
|
||||
if (isPrefix) {
|
||||
prefix = tprefix;
|
||||
@@ -799,7 +806,7 @@ void QPIConfig::parse(QString content) {
|
||||
ce->delim = delim;
|
||||
ce->_tab = tab;
|
||||
ce->_name = name;
|
||||
ce->_value = entryValue(str.right(str.length() - ind - 1).trimmed());
|
||||
ce->_value = str.right(str.length() - ind - 1).trimmed();
|
||||
ce->_type = type;
|
||||
ce->_comment = comm;
|
||||
ce->_line = lines;
|
||||
|
||||
Reference in New Issue
Block a user