本文整理汇总了C++中IApplication::Start方法的典型用法代码示例。如果您正苦于以下问题:C++ IApplication::Start方法的具体用法?C++ IApplication::Start怎么用?C++ IApplication::Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IApplication
的用法示例。
在下文中一共展示了IApplication::Start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
int Starter::Run(int& argc, char** argv,
Poco::Util::AbstractConfiguration* config)
{
// The CTK PluginFramework needs a QCoreApplication
if (!qApp)
{
BERRY_FATAL << "No QCoreApplication instance found. You need to create one prior to calling Starter::Run()";
}
InternalPlatform* platform = InternalPlatform::GetInstance();
int returnCode = 0;
// startup the internal platform
platform->Initialize(argc, argv, config);
platform->Launch();
bool consoleLog = platform->ConsoleLog();
// run the application
IExtensionPointService::Pointer service =
platform->GetExtensionPointService();
if (service == 0)
{
platform->GetLogger()->log(
Poco::Message(
"Starter",
"The extension point service could not be retrieved. This usually indicates that the BlueBerry OSGi plug-in could not be loaded.",
Poco::Message::PRIO_FATAL));
std::unexpected();
returnCode = 1;
}
else
{
IConfigurationElement::vector extensions(
service->GetConfigurationElementsFor(Starter::XP_APPLICATIONS));
IConfigurationElement::vector::iterator iter;
for (iter = extensions.begin(); iter != extensions.end();)
{
if ((*iter)->GetName() != "application")
iter = extensions.erase(iter);
else
++iter;
}
std::string argApplication = Platform::GetConfiguration().getString(
Platform::ARG_APPLICATION, "");
IApplication* app = 0;
if (extensions.size() == 0)
{
BERRY_FATAL
<< "No extensions configured into extension-point '" << Starter::XP_APPLICATIONS << "' found. Aborting.\n";
returnCode = 0;
}
else if (extensions.size() == 1)
{
if (!argApplication.empty())
BERRY_INFO(consoleLog)
<< "One '" << Starter::XP_APPLICATIONS << "' extension found, ignoring "
<< Platform::ARG_APPLICATION << " argument.\n";
std::vector<IConfigurationElement::Pointer> runs(
extensions[0]->GetChildren("run"));
app = runs.front()->CreateExecutableExtension<IApplication> ("class");
if (app == 0)
{
// support legacy BlueBerry extensions
app = runs.front()->CreateExecutableExtension<IApplication> ("class", IApplication::GetManifestName());
}
}
else
{
if (argApplication.empty())
{
BERRY_WARN << "You must provide an application id via \""
<< Platform::ARG_APPLICATION << "=<id>\"";
BERRY_INFO << "Possible application ids are:";
for (iter = extensions.begin(); iter != extensions.end(); ++iter)
{
std::string appid;
if ((*iter)->GetAttribute("id", appid) && !appid.empty())
{
BERRY_INFO << appid;
}
}
returnCode = 0;
}
else
{
for (iter = extensions.begin(); iter != extensions.end(); ++iter)
{
BERRY_INFO(consoleLog) << "Checking applications extension from: "
<< (*iter)->GetContributor() << std::endl;
std::string appid;
if ((*iter)->GetAttribute("id", appid))
{
BERRY_INFO(consoleLog) << "Found id: " << appid << std::endl;
//.........这里部分代码省略.........