minor style improvement: replaced (type) casts with dynamic_cast<type>

This commit is contained in:
fgerlits 2006-08-30 16:14:49 +00:00
parent 8645db7358
commit f7a529d444

View file

@ -211,7 +211,8 @@ GLiveSupport :: configure(const xmlpp::Element & element)
if (nodes.size() < 1) { if (nodes.size() < 1) {
throw std::invalid_argument("no supportedLanguages element"); throw std::invalid_argument("no supportedLanguages element");
} }
configSupportedLanguages(*((const xmlpp::Element*) nodes.front())); configSupportedLanguages(
*dynamic_cast<const xmlpp::Element*>(nodes.front()));
// configure the resource bundle // configure the resource bundle
nodes = element.get_children(LocalizedObject::getConfigElementName()); nodes = element.get_children(LocalizedObject::getConfigElementName());
@ -219,7 +220,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
throw std::invalid_argument("no resourceBundle element"); throw std::invalid_argument("no resourceBundle element");
} }
LocalizedConfigurable::configure( LocalizedConfigurable::configure(
*((const xmlpp::Element*) nodes.front())); *dynamic_cast<const xmlpp::Element*>(nodes.front()) );
// configure the AuthenticationClientFactory // configure the AuthenticationClientFactory
nodes = element.get_children( nodes = element.get_children(
@ -229,7 +230,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
} }
Ptr<AuthenticationClientFactory>::Ref acf Ptr<AuthenticationClientFactory>::Ref acf
= AuthenticationClientFactory::getInstance(); = AuthenticationClientFactory::getInstance();
acf->configure( *((const xmlpp::Element*) nodes.front()) ); acf->configure(*dynamic_cast<const xmlpp::Element*>(nodes.front()));
authentication = acf->getAuthenticationClient(); authentication = acf->getAuthenticationClient();
@ -239,7 +240,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
throw std::invalid_argument("no storageClientFactory element"); throw std::invalid_argument("no storageClientFactory element");
} }
Ptr<StorageClientFactory>::Ref stcf = StorageClientFactory::getInstance(); Ptr<StorageClientFactory>::Ref stcf = StorageClientFactory::getInstance();
stcf->configure( *((const xmlpp::Element*) nodes.front()) ); stcf->configure(*dynamic_cast<const xmlpp::Element*>(nodes.front()));
storage = stcf->getStorageClient(); storage = stcf->getStorageClient();
@ -249,7 +250,8 @@ GLiveSupport :: configure(const xmlpp::Element & element)
throw std::invalid_argument("no widgetFactory element"); throw std::invalid_argument("no widgetFactory element");
} }
widgetFactory = WidgetFactory::getInstance(); widgetFactory = WidgetFactory::getInstance();
widgetFactory->configure( *((const xmlpp::Element*) nodes.front()) ); widgetFactory->configure(
*dynamic_cast<const xmlpp::Element*>(nodes.front()) );
// configure the SchedulerClientFactory // configure the SchedulerClientFactory
nodes = element.get_children( nodes = element.get_children(
@ -259,7 +261,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
} }
Ptr<SchedulerClientFactory>::Ref schcf Ptr<SchedulerClientFactory>::Ref schcf
= SchedulerClientFactory::getInstance(); = SchedulerClientFactory::getInstance();
schcf->configure( *((const xmlpp::Element*) nodes.front()) ); schcf->configure(*dynamic_cast<const xmlpp::Element*>(nodes.front()));
scheduler = schcf->getSchedulerClient(); scheduler = schcf->getSchedulerClient();
@ -302,7 +304,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
throw std::invalid_argument("no audioPlayer element"); throw std::invalid_argument("no audioPlayer element");
} }
apf = AudioPlayerFactory::getInstance(); apf = AudioPlayerFactory::getInstance();
apf->configure( *((const xmlpp::Element*) nodes.front()) ); apf->configure(*dynamic_cast<const xmlpp::Element*>(nodes.front()));
outputPlayer = apf->getAudioPlayer(); outputPlayer = apf->getAudioPlayer();
outputPlayer->initialize(); outputPlayer->initialize();
@ -319,7 +321,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
throw std::invalid_argument("no audioPlayer element"); throw std::invalid_argument("no audioPlayer element");
} }
apf = AudioPlayerFactory::getInstance(); apf = AudioPlayerFactory::getInstance();
apf->configure( *((const xmlpp::Element*) nodes.front()) ); apf->configure(*dynamic_cast<const xmlpp::Element*>(nodes.front()));
cuePlayer = apf->getAudioPlayer(); cuePlayer = apf->getAudioPlayer();
cuePlayer->initialize(); cuePlayer->initialize();
@ -357,7 +359,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
Ptr<ResourceBundle>::Ref metadataBundle = getBundle("metadataTypes"); Ptr<ResourceBundle>::Ref metadataBundle = getBundle("metadataTypes");
metadataTypeContainer.reset(new MetadataTypeContainer(metadataBundle)); metadataTypeContainer.reset(new MetadataTypeContainer(metadataBundle));
metadataTypeContainer->configure( metadataTypeContainer->configure(
*((const xmlpp::Element*) nodes.front()) ); *dynamic_cast<const xmlpp::Element*>(nodes.front()) );
// configure the KeyboardShortcutList // configure the KeyboardShortcutList
nodes = element.get_children( nodes = element.get_children(
@ -367,7 +369,7 @@ GLiveSupport :: configure(const xmlpp::Element & element)
} }
keyboardShortcutList.reset(new KeyboardShortcutList); keyboardShortcutList.reset(new KeyboardShortcutList);
keyboardShortcutList->configure( keyboardShortcutList->configure(
*((const xmlpp::Element*) nodes.front()) ); *dynamic_cast<const xmlpp::Element*>(nodes.front()) );
// save the configuration so we can modify it later // save the configuration so we can modify it later
// TODO: move configuration code to the OptionsContainer class? // TODO: move configuration code to the OptionsContainer class?