RetroFE constructor arguments set to pass by reference.

This commit is contained in:
emb
2015-01-01 14:54:01 -06:00
parent 9a56630d46
commit 511c774ffc
13 changed files with 54 additions and 61 deletions

View File

@@ -22,7 +22,7 @@
//todo: remove coupling from configuration data (if possible)
ScrollingList::ScrollingList(Configuration *c,
ScrollingList::ScrollingList(Configuration &c,
float scaleX,
float scaleY,
Font *font,
@@ -403,7 +403,7 @@ void ScrollingList::AllocateTexture(ComponentItemBinding *s)
t = new VideoComponent(videoPath, item->GetFullTitle(), ScaleX, ScaleY);
}
*/
if(!t && Config->GetPropertyAbsolutePath(collectionKey, imagePath))
if(!t && Config.GetPropertyAbsolutePath(collectionKey, imagePath))
{
ImageBuilder imageBuild;
t = imageBuild.CreateImage(imagePath, item->GetName(), ScaleX, ScaleY);

View File

@@ -31,7 +31,7 @@ public:
};
ScrollingList(Configuration *c, float scaleX, float scaleY, Font *font, SDL_Color fontColor, std::string layoutKey, std::string CollectionName, std::string imageType);
ScrollingList(Configuration &c, float scaleX, float scaleY, Font *font, SDL_Color fontColor, std::string layoutKey, std::string CollectionName, std::string imageType);
virtual ~ScrollingList();
void AllocateTexture(ComponentItemBinding *s);
void DeallocateTexture(ComponentItemBinding *s);
@@ -92,7 +92,7 @@ private:
void UpdateOffset(float dt);
std::string Collection;
Configuration *Config;
Configuration &Config;
float ScaleX;
float ScaleY;
Font *FontInst;

View File

@@ -25,7 +25,7 @@
using namespace rapidxml;
PageBuilder::PageBuilder(std::string layoutKey, std::string collection, Configuration *c, FontCache *fc)
PageBuilder::PageBuilder(std::string layoutKey, std::string collection, Configuration &c, FontCache *fc)
: LayoutKey(layoutKey)
, Collection(collection)
, Config(c)
@@ -100,10 +100,10 @@ Page *PageBuilder::BuildPage()
{
//todo: reuse from ComponentBuilder. Not sure how since it relies on knowing the collection
std::string fontPropertyKey = "layouts." + LayoutKey + ".font";
Config->SetProperty(fontPropertyKey, fontXml->value());
Config.SetProperty(fontPropertyKey, fontXml->value());
Font = Config->ConvertToAbsolutePath(
Config->GetAbsolutePath() + "/Layouts/" + LayoutKey + "/",
Font = Config.ConvertToAbsolutePath(
Config.GetAbsolutePath() + "/Layouts/" + LayoutKey + "/",
fontXml->value());
Logger::Write(Logger::ZONE_DEBUG, "Layout", "Layout font set to " + Font);
@@ -377,14 +377,14 @@ void PageBuilder::LoadReloadableImages(xml_node<> *layout, std::string tagName,
if(type && (tagName == "reloadableVideo" || tagName == "reloadableImage"))
{
std::string configImagePath = "collections." + Collection + ".media." + type->value();
if(!Config->GetPropertyAbsolutePath(configImagePath, reloadableImagePath))
if(!Config.GetPropertyAbsolutePath(configImagePath, reloadableImagePath))
{
Logger::Write(Logger::ZONE_ERROR, "Layout", "Cannot process reloadable images because property \"" + configImagePath + "\" does not exist");
}
std::string configVideoPath = "collections." + Collection + ".media.video";
if(!Config->GetPropertyAbsolutePath(configVideoPath, reloadableVideoPath))
if(!Config.GetPropertyAbsolutePath(configVideoPath, reloadableVideoPath))
{
Logger::Write(Logger::ZONE_WARNING, "Layout", "Could not find videos folder as \"" + configVideoPath + "\" does not exist");
}

View File

@@ -18,7 +18,7 @@ class Configuration;
class PageBuilder
{
public:
PageBuilder(std::string layoutKey, std::string collection, Configuration *c, FontCache *fc);
PageBuilder(std::string layoutKey, std::string collection, Configuration &c, FontCache *fc);
virtual ~PageBuilder();
Page *BuildPage();
@@ -26,7 +26,7 @@ private:
std::string LayoutKey;
std::string LayoutPath;
std::string Collection;
Configuration *Config;
Configuration &Config;
float ScaleX;
float ScaleY;
int ScreenHeight;