UCommon

ucommon/object.h File Reference

A common object base class with auto-pointer support. More...

#include <ucommon/platform.h>
#include <stdlib.h>
Include dependency graph for object.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  auto_delete
 A helper class for the temporary object template. More...
class  auto_pointer
 A general purpose smart pointer helper class. More...
class  CountedObject
 A base class for reference counted objects. More...
class  Object
 A common base class for all managed objects. More...
class  object_value< T, O >
 Template for embedding a data structure into a reference counted object. More...
class  pointer< T, P >
 Typed smart pointer class. More...
class  sarray< T >
 Generate a typed sparse managed object array. More...
class  sparse_array
 A sparse array of managed objects. More...
class  temporary< T >
 Manage temporary object stored on the heap. More...
class  Temporary
 Used as base class for temporary objects. More...

Functions

Objectcopy (Object *object)
 Convenience function to access object copy.
template<class T >
bool is (T &object)
 Convenience function to validate object assuming it is castable to bool.
template<class T >
bool isnull (T &object)
 Convenience function to test pointer object.
template<class T >
bool isnullp (T *object)
 Convenience function to test pointer-pointer object.
template<typename T >
T &() max (T &o1, T &o2)
 Convenience function to return max of two objects.
template<typename T >
T &() min (T &o1, T &o2)
 Convenience function to return min of two objects.
void release (Object *object)
 Convenience function to access object release.
void retain (Object *object)
 Convenience function to access object retention.
template<typename T >
void swap (T &o1, T &o2)
 Convenience function to swap objects.

Detailed Description

A common object base class with auto-pointer support.

A common object class is used which may be referenced counted and associated with a smart auto-pointer class. A lot of the things found here were inspired by working with Objective-C. Many of the classes are designed to offer automatic heap management through smart pointers and temporary objects controlled through the scope of the stack frame of method calls.

Definition in file object.h.


Function Documentation

Object* copy ( Object object) [inline]

Convenience function to access object copy.

Parameters:
objectwe are copying.

Definition at line 560 of file object.h.

Here is the call graph for this function:

template<class T >
bool is ( T &  object) [inline]

Convenience function to validate object assuming it is castable to bool.

Parameters:
objectwe are testing.
Returns:
true if object valid.
Examples:
datetime.cpp, and shell.cpp.

Definition at line 569 of file object.h.

template<class T >
bool isnull ( T &  object) [inline]

Convenience function to test pointer object.

This solves issues where some compilers get confused between bool and pointer operators.

Parameters:
objectwe are testing.
Returns:
true if object points to NULL.

Definition at line 580 of file object.h.

template<class T >
bool isnullp ( T *  object) [inline]

Convenience function to test pointer-pointer object.

This solves issues where some compilers get confused between bool and pointer operators.

Parameters:
objectwe are testing.
Returns:
true if object points to NULL.

Definition at line 590 of file object.h.

template<typename T >
T&() max ( T &  o1,
T &  o2 
) [inline]

Convenience function to return max of two objects.

Parameters:
o1to check.
o2to check.
Returns:
max object.

Definition at line 609 of file object.h.

template<typename T >
T&() min ( T &  o1,
T &  o2 
) [inline]

Convenience function to return min of two objects.

Parameters:
o1to check.
o2to check.
Returns:
min object.

Definition at line 621 of file object.h.

void release ( Object object) [inline]

Convenience function to access object release.

Parameters:
objectwe are releasing.

Definition at line 553 of file object.h.

void retain ( Object object) [inline]

Convenience function to access object retention.

Parameters:
objectwe are retaining.

Definition at line 546 of file object.h.

template<typename T >
void swap ( T &  o1,
T &  o2 
) [inline]

Convenience function to swap objects.

Parameters:
o1to swap.
o2to swap.

Definition at line 599 of file object.h.

Here is the call graph for this function: