Difference between revisions of "Zh/Documentation/DevGuide/WritingUNO/C++/Storing the Service Manager for Further Use"

From Apache OpenOffice Wiki
Jump to: navigation, search
(New page: {{Documentation/DevGuide/WritingUNOTOC/Zh |WritingUNO2d=block |ShowPrevNext=block |PrevPage=Zh/Documentation/DevGuide/WritingUNO/C++/Implementing without Helpers |NextPage=Zh/Documentation...)
 
(No difference)

Latest revision as of 08:58, 30 July 2008


单个工厂需要使用一个静态 create_<ImplementationClass>() 函数。例如,create_MyService1Impl() 接受对组件上下文的引用,并使用 new ImplementationClass() 实例化实现类。<ImplementationClass> 要求使用对 com.sun.star.uno.XComponentContext 的引用,并在实例中存储引用已备将来使用,可以为它编写构造函数。

  static Reference< XInterface > SAL_CALL create_MyService2Impl(
      Reference< XComponentContext > const & xContext )
      SAL_THROW( () )
  {
      // passing the component context to the constructor of MyService2Impl
      return static_cast< lang::XTypeProvider * >( new MyService2Impl( xContext ) );
  }
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages