Difference between revisions of "Uno/Cpp/Snippet/FreeReference"

From Apache OpenOffice Wiki
< Uno‎ | Cpp
Jump to: navigation, search
m (Splitted categories.)
m
 
Line 1: Line 1:
<code>[cpp]
+
<source lang="cpp">
 
#include <cppu/EnvGuards.hxx>
 
#include <cppu/EnvGuards.hxx>
 
...
 
...
Line 11: Line 11:
 
   ...
 
   ...
 
}
 
}
</code><noinclude>[[Snippet]][[Category:Cpp]][[Category:Uno]]</noinclude>
+
</source><noinclude>[[Snippet]][[Category:Cpp]][[Category:Uno]]</noinclude>

Latest revision as of 17:37, 23 February 2008

#include <cppu/EnvGuards.hxx>
...
{ 
  com::sun::star::uno::Reference<XFoo> ref(...)
  ...
  cppu::FreeReference<XFoo> free_xFoo(xFoo);
  cppu::EnvGuard otherEnv(cppu::Environment("just another env"));
 
  free_xFoo->doSomething(); // the free reference ensures that the correct environment etc. gets activated before invokation
  ...
}
Snippet
Personal tools