Foxit PDF SDK

Classes | Public Types | Public Member Functions | List of all members
CFX_CountRef< ObjClass > Class Template Reference
FXCRT

Inherits CFX_Object.

## Classes
class | CountedObj
| Define a class here derived from user data class, with an additional reference count member. More...

## Public Types
typedef CFX_CountRef< ObjClass > | Ref
| Type definition: it is used short for CFX_CountRef<ObjClass>.

## Public Member Functions
| CFX_CountRef ()
| Construct a null reference.
| CFX_CountRef (const Ref &ref)
| Copy constructor from another reference. More...
| ~CFX_CountRef ()
| Destruct a reference and release the object it refers to.
void | Decref ()
| Decrease the reference. More...
ObjClass * | GetModify ()
| Get a modifiable copy of the object. More...
const ObjClass * | GetObjectF () const
| Get a pointer of constant object. This pointer can't be used to alter the object content. More...
void | Incref ()
| Increase the reference. More...
FX_BOOL | IsNull () const
| Check if the pointer of the object is NULL. More...
ObjClass * | New ()
| Create a new object and refer to it. The returned pointer to the object can be used to modify the content of objects. More...
FX_BOOL | NotNull () const
| Check if the pointer of the object is not NULL. More...
| operator const ObjClass * () const
| This casting operator get a pointer of the constant object. More...
void | operator= (const Ref &ref)
| Assignment(=) operator overload. Assign from another reference. More...
void | operator= (void *p)
| assignment(=) operator overload. Assign from a typeless pointer. More...
FX_BOOL | operator== (const Ref &ref) const
| Comparison(==) operator overload. Compare with another reference. More...
int | RefCount () const
| Get the reference count. More...
void | SetNull ()
| Set the pointer of the object to be null. More...

## Detailed Description

### template<class ObjClass>
class CFX_CountRef< ObjClass >

The class represents accessor of reference counted object. To use reference counted objects, application can use this template with particular object class.

## Constructor & Destructor Documentation

## ◆ CFX_CountRef()

template<class ObjClass >

CFX_CountRef< ObjClass >::CFX_CountRef | ( | const Ref & | ref | ) |
| inline

Copy constructor from another reference.

Parameters

  [in] | ref | The input reference.

## Member Function Documentation

## ◆ Decref()

template<class ObjClass >

void CFX_CountRef< ObjClass >::Decref | ( |  | ) |
| inline

Decrease the reference.

Returns
  None.

## ◆ GetModify()

template<class ObjClass >

ObjClass* CFX_CountRef< ObjClass >::GetModify | ( |  | ) |
| inline

Get a modifiable copy of the object.

If the reference was refer to null, then a new object will be created. The returned pointer can be used to alter the object content.

Returns
  A pointer to the object.

## ◆ GetObjectF()

template<class ObjClass >

const ObjClass* CFX_CountRef< ObjClass >::GetObjectF | ( |  | ) | const
| inline

Get a pointer of constant object. This pointer can't be used to alter the object content.

Returns
  A pointer to the constant object.

## ◆ Incref()

template<class ObjClass >

void CFX_CountRef< ObjClass >::Incref | ( |  | ) |
| inline

Increase the reference.

Returns
  None.

## ◆ IsNull()

template<class ObjClass >

FX_BOOL CFX_CountRef< ObjClass >::IsNull | ( |  | ) | const
| inline

Check if the pointer of the object is NULL.

Returns
  true means the pointer of object is NULL, while false means not.

## ◆ New()

template<class ObjClass >

ObjClass* CFX_CountRef< ObjClass >::New | ( |  | ) |
| inline

Create a new object and refer to it. The returned pointer to the object can be used to modify the content of objects.

Returns
  A modifiable object pointer.

## ◆ NotNull()

template<class ObjClass >

FX_BOOL CFX_CountRef< ObjClass >::NotNull | ( |  | ) | const
| inline

Check if the pointer of the object is not NULL.

Returns
  true means the pointer of object is not NULL, while false means NULL.

## ◆ operator const ObjClass *()

template<class ObjClass >

CFX_CountRef< ObjClass >::operator const ObjClass * | ( |  | ) | const
| inline

This casting operator get a pointer of the constant object.

Returns
  A pointer to the constant object.

## ◆ operator=() [1/2]

template<class ObjClass >

void CFX_CountRef< ObjClass >::operator= | ( | const Ref & | ref | ) |
| inline

Assignment(=) operator overload. Assign from another reference.

Parameters

  [in] | ref | The input reference.

Returns
  None.

## ◆ operator=() [2/2]

template<class ObjClass >

void CFX_CountRef< ObjClass >::operator= | ( | void * | p | ) |
| inline

assignment(=) operator overload. Assign from a typeless pointer.

Parameters

  [in] | p | It must be zero. Other value is not valid.

Returns
  None.

## ◆ operator==()

template<class ObjClass >

FX_BOOL CFX_CountRef< ObjClass >::operator== | ( | const Ref & | ref | ) | const
| inline

Comparison(==) operator overload. Compare with another reference.

Parameters

  [in] | ref | Another Ref object.

Returns
  true means equal, while false means not equal.

## ◆ RefCount()

template<class ObjClass >

int CFX_CountRef< ObjClass >::RefCount | ( |  | ) | const
| inline

Get the reference count.

Returns
  The count of reference.

## ◆ SetNull()

template<class ObjClass >

void CFX_CountRef< ObjClass >::SetNull | ( |  | ) |
| inline

Set the pointer of the object to be null.

Returns
  None.