XWeak

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 07:28, 4 June 2008 by OOoWikiBot (talk | contribs) (Robot: Automated text replacement (-Category:Documentation/Developers Guide/Professional UNO +Category:Documentation/Developers Guide/Writing UNO))
Jump to: navigation, search
Writing UNO Components
< {{#switch:Previous Section Previous Section = Previous Section Next Section = Next Section Previous Page = Previous Page Next Page = Next Page }} {{#switch:Next Section Previous Section = Previous Section Next Section = Next Section Previous Page = Previous Page Next Page = Next Page }} >
< {{#switch:Previous Page Previous Section = Previous Section Next Section = Next Section Previous Page = Previous Page Next Page = Next Page }} {{#switch:Next Page Previous Section = Previous Section Next Section = Next Section Previous Page = Previous Page Next Page = Next Page }} >



A component supporting XWeak offers other objects to hold a reference on itself without preventing it from being destroyed when it is no longer needed. Thus, cyclic references can be avoided easily. The chapter Lifetime of UNO Objects discusses this in detail. In Java, derive from the Java helper class com.sun.star.lib.uno.helper.WeakBase to support XWeak. If a C++ component is derived from one of the ::cppu::Weak...ImplHelperNN template classes as proposed in the section C++ Component, a XWeak support is obtained, virtually for free. For the sake of completeness, this is the XWeak specification:

  // module com::sun::star::uno::XWeak
  
  interface XWeak: com::sun::star::uno::XInterface
  { 
      com::sun::star::uno::XAdapter queryAdapter(); 
  };
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools