コード例 #1
0
ファイル: main.cpp プロジェクト: beneon/MITK
void extenderPattern()
{
  //! [2]
  // Get all loaded modules
  std::vector<Module*> modules;
  ModuleRegistry::GetLoadedModules(modules);

  // Check if a module defines a "service-component" property
  // and use its value to retrieve an embedded resource containing
  // a component description.
  for(std::size_t i = 0; i < modules.size(); ++i)
  {
    Module* const module = modules[i];
    std::string componentPath = module->GetProperty("service-component");
    if (!componentPath.empty())
    {
      ModuleResource componentResource = module->GetResource(componentPath);
      if (!componentResource.IsValid() || componentResource.IsDir()) continue;

      // Create a std::istream compatible object and parse the
      // component description.
      ModuleResourceStream resStream(componentResource);
      parseComponentDefinition(resStream);
    }
  }
  //! [2]
}
コード例 #2
0
ファイル: TPZBuilder.cpp プロジェクト: cortexsim/tpzsimul
TPZComponent* TPZBuilder :: createComponentWithId( const TPZString& id,
                                                   TPZComponent* owner )
{
   INDEX indice = getTagIndex(id);
   TPZTag* tag = getTagWithIndex(indice);
   if( ! tag )
   {
      TPZString err;
      tag = getTagWithIndex(1);
      err.sprintf(ERR_TPZBLDR_002, (char*)id );
      err=err+TPZString("(cont...)\n Help=     Avaliable ")+tag->tagName()+TPZString(" (")+showTagArray(tag->tagName())+TPZString(" )");
      EXIT_PROGRAM(err);
   }
   TPZComponent* rComponent = parseComponentDefinition(tag,owner,indice);
   if( ! rComponent )
   {
      tag = getTagWithIndex(1);
      TPZString err;
      err.sprintf(ERR_TPZBLDR_002, (char*)id );
      err=err+TPZString("(cont...)\n Help=     Avaliable ")+tag->tagName()+TPZString(" (")+showTagArray(tag->tagName())+TPZString(" )");
      EXIT_PROGRAM(err);
      
   }
   return rComponent;
}