Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Refactor|InfoBank: Renamed method to be more accurate
Also fixed InfoBank private implementation init.
  • Loading branch information
skyjake committed May 14, 2013
1 parent 0805d24 commit c9f29a3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doomsday/libdeng2/include/de/data/infobank.h
Expand Up @@ -52,7 +52,7 @@ class InfoBank : public Bank
Record const &names() const;
Variable const &operator [] (String const &name) const;

void addFromInfo(String const &blockType);
void addFromInfoBlocks(String const &blockType);

Time sourceModifiedAt() const;

Expand Down
17 changes: 12 additions & 5 deletions doomsday/libdeng2/src/data/infobank.cpp
Expand Up @@ -22,14 +22,14 @@

namespace de {

DENG2_PIMPL(InfoBank)
DENG2_PIMPL_NOREF(InfoBank)
{
ScriptedInfo info;
Time modTime;
};

InfoBank::InfoBank(Bank::Flags const &flags, String const &hotStorageLocation)
: Bank(flags, hotStorageLocation)
: Bank(flags, hotStorageLocation), d(new Instance)
{}

void InfoBank::parse(String const &source)
Expand All @@ -47,8 +47,15 @@ void InfoBank::parse(String const &source)

void InfoBank::parse(File const &file)
{
parse(String::fromUtf8(Block(file)));
d->modTime = file.status().modifiedAt;
try
{
d->modTime = file.status().modifiedAt;
d->info.parse(file);
}
catch(Error const &er)
{
LOG_WARNING("Failed to read Info file:\n") << er.asText();
}
}

ScriptedInfo &InfoBank::info()
Expand All @@ -71,7 +78,7 @@ Record const &InfoBank::names() const
return d->info.names();
}

void InfoBank::addFromInfo(String const &blockType)
void InfoBank::addFromInfoBlocks(String const &blockType)
{
foreach(String id, d->info.allBlocksOfType(blockType))
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libdeng2/src/widgets/rulebank.cpp
Expand Up @@ -58,7 +58,7 @@ void RuleBank::addFromInfo(File const &file)
{
LOG_AS("RuleBank");
parse(file);
InfoBank::addFromInfo("rule");
addFromInfoBlocks("rule");
}

Rule const &RuleBank::rule(Path const &path) const
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libgui/src/colorbank.cpp
Expand Up @@ -68,7 +68,7 @@ void ColorBank::addFromInfo(File const &file)
{
LOG_AS("ColorBank");
parse(file);
InfoBank::addFromInfo("color");
addFromInfoBlocks("color");
}

ColorBank::Color ColorBank::color(Path const &path) const
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libgui/src/fontbank.cpp
Expand Up @@ -87,7 +87,7 @@ void FontBank::addFromInfo(File const &file)
{
LOG_AS("FontBank");
parse(file);
InfoBank::addFromInfo("font");
addFromInfoBlocks("font");
}

Font const &FontBank::font(Path const &path) const
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libgui/src/imagebank.cpp
Expand Up @@ -78,7 +78,7 @@ void ImageBank::addFromInfo(File const &file)
LOG_AS("ImageBank");
d->relativeToPath = file.path().fileNamePath();
parse(file);
InfoBank::addFromInfo("image");
addFromInfoBlocks("image");
}

Image &ImageBank::image(Path const &path) const
Expand Down

0 comments on commit c9f29a3

Please sign in to comment.