SPackageSptr Class Reference
[Binder]

#include <support/Package.h>

List of all members.


Detailed Description

Keep your local executable image loaded.

Instantiating this class adds a reference to the package, so that its code will not be unloaded until the SPackageSptr is destroyed. This allows you to ensure that the code stays around as long as any of its components exist (by having those components inherit from SPackageSptr or included it as a member), or as long as any threads you manually spawn still exist (by putting the SPackageSptr on that thread's stack).

All of your exported classes should inherit from this, so that when all references to it are deleted, your add-on will be unloaded. The code for this class is linked in to each PRC. This means the implementation here can pretty much change at will, without any binary compatibility issues; references to SPackageSptr objects should never pass outside the confines of the PRC in which they are created.

Note:
The visibility control on this class is very important -- every shared library must get its own copy of the implementation of the class, so that it can correctly track references on that code and not get confused with other shared libraries.


Public Member Functions

SString LoadString (int32_t id, int32_t index=0) const ATTRIBUTE_VISIBILITY_HIDDEN
 Convenience to retrieve a string from your package.
SString LoadString (uint32_t index, const SString &locale=SString::EmptyString()) const ATTRIBUTE_VISIBILITY_HIDDEN
 Convenience to retrieve a string from your package via SPackage::LoadString().
SString LoadString (const SString &key, const SString &locale=SString::EmptyString()) const ATTRIBUTE_VISIBILITY_HIDDEN
 Convenience to retrieve a string from your package via SPackage::LoadString().
sptr< IByteInputOpenResource (uint32_t type, int32_t id) const ATTRIBUTE_VISIBILITY_HIDDEN
 Convenience to retrieve resource data from your package.
sptr< IByteInputOpenResource (const SString &fileName, const SString &locale=SString::EmptyString()) const ATTRIBUTE_VISIBILITY_HIDDEN
 Convenience to retrieve resource data from your package via SPackage::OpenResource().
SPackage Package () const ATTRIBUTE_VISIBILITY_HIDDEN
const sptr< BSharedObject > & SharedObject () const ATTRIBUTE_VISIBILITY_HIDDEN
 Retrieve your package object.
 SPackageSptr () ATTRIBUTE_VISIBILITY_HIDDEN
 Acquire a reference on your package.
 ~SPackageSptr () ATTRIBUTE_VISIBILITY_HIDDEN
 Note that the destructor is very intentionally NOT virtual.


Constructor & Destructor Documentation

SPackageSptr  ) 
 

Acquire a reference on your package.

This method is included as part of the glue code that your application links with, so that it can retrieve the BSharedObject associated with your executable.


The documentation for this class was generated from the following files: