forked from qt-creator/qt-creator
refactor relation between parsedProBlock() & parsedProFile()
this is clearer and not necessarily more code. Change-Id: Ic698a8076658ae986d0dbdeebb1f4760dd806e35 Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
@@ -131,7 +131,7 @@ QMakeParser::QMakeParser(ProFileCache *cache, QMakeParserHandler *handler)
|
||||
initialize();
|
||||
}
|
||||
|
||||
ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache, const QString *contents)
|
||||
ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache)
|
||||
{
|
||||
ProFile *pro;
|
||||
if (cache && m_cache) {
|
||||
@@ -163,7 +163,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache, const Q
|
||||
locker.unlock();
|
||||
#endif
|
||||
pro = new ProFile(fileName);
|
||||
if (!(!contents ? read(pro) : read(pro, *contents))) {
|
||||
if (!read(pro)) {
|
||||
delete pro;
|
||||
pro = 0;
|
||||
} else {
|
||||
@@ -183,7 +183,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache, const Q
|
||||
}
|
||||
} else {
|
||||
pro = new ProFile(fileName);
|
||||
if (!(!contents ? read(pro) : read(pro, *contents))) {
|
||||
if (!read(pro)) {
|
||||
delete pro;
|
||||
pro = 0;
|
||||
}
|
||||
@@ -191,6 +191,16 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, bool cache, const Q
|
||||
return pro;
|
||||
}
|
||||
|
||||
ProFile *QMakeParser::parsedProBlock(const QString &name, const QString &contents)
|
||||
{
|
||||
ProFile *pro = new ProFile(name);
|
||||
if (!read(pro, contents)) {
|
||||
delete pro;
|
||||
pro = 0;
|
||||
}
|
||||
return pro;
|
||||
}
|
||||
|
||||
bool QMakeParser::read(ProFile *pro)
|
||||
{
|
||||
QFile file(pro->fileName());
|
||||
|
||||
Reference in New Issue
Block a user