Back to index

enigmail  1.4.3
Public Member Functions | Private Member Functions | Private Attributes
mozilla::RangedPtr< T > Class Template Reference

#include <RangedPtr.h>

List of all members.

Public Member Functions

 RangedPtr (T *p, T *start, T *end)
 RangedPtr (T *p, T *start, size_t length)
 RangedPtr (T *p, size_t length)
template<size_t N>
 RangedPtr (T arr[N])
T * get () const
RangedPtr< T > & operator= (const RangedPtr< T > &other)
RangedPtr< T > operator+ (size_t inc)
RangedPtr< T > operator- (size_t dec)
template<typename U >
RangedPtr< T > & operator= (U *p)
template<typename U >
RangedPtr< T > & operator= (const RangedPtr< U > &p)
RangedPtr< T > & operator++ ()
RangedPtr< T > operator++ (int)
RangedPtr< T > & operator-- ()
RangedPtr< T > operator-- (int)
RangedPtr< T > & operator+= (size_t inc)
RangedPtr< T > & operator-= (size_t dec)
T & operator[] (int index) const
T & operator* () const
template<typename U >
bool operator== (const RangedPtr< U > &other) const
template<typename U >
bool operator!= (const RangedPtr< U > &other) const
template<typename U >
bool operator== (const U *u) const
template<typename U >
bool operator!= (const U *u) const
template<typename U >
bool operator< (const RangedPtr< U > &other) const
template<typename U >
bool operator<= (const RangedPtr< U > &other) const
template<typename U >
bool operator> (const RangedPtr< U > &other) const
template<typename U >
bool operator>= (const RangedPtr< U > &other) const
size_t operator- (const RangedPtr< T > &other) const

Private Member Functions

void checkSanity ()
RangedPtr< T > create (T *ptr) const
 RangedPtr () MOZ_DELETE
T * operator& () MOZ_DELETE
 operator T * () const MOZ_DELETE

Private Attributes

T * ptr

Detailed Description

template<typename T>
class mozilla::RangedPtr< T >

Definition at line 75 of file RangedPtr.h.


Constructor & Destructor Documentation

template<typename T>
mozilla::RangedPtr< T >::RangedPtr ( T *  p,
T *  start,
T *  end 
) [inline]

Definition at line 99 of file RangedPtr.h.

      : ptr(p)
#ifdef DEBUG
      , rangeStart(start), rangeEnd(end)
#endif
    {
        MOZ_ASSERT(rangeStart <= rangeEnd);
        checkSanity();
    }

Here is the call graph for this function:

template<typename T>
mozilla::RangedPtr< T >::RangedPtr ( T *  p,
T *  start,
size_t  length 
) [inline]

Definition at line 108 of file RangedPtr.h.

      : ptr(p)
#ifdef DEBUG
      , rangeStart(start), rangeEnd(start + length)
#endif
    {
        MOZ_ASSERT(length <= size_t(-1) / sizeof(T));
        MOZ_ASSERT(uintptr_t(rangeStart) + length * sizeof(T) >= uintptr_t(rangeStart));
        checkSanity();
    }

Here is the call graph for this function:

template<typename T>
mozilla::RangedPtr< T >::RangedPtr ( T *  p,
size_t  length 
) [inline]

Definition at line 120 of file RangedPtr.h.

      : ptr(p)
#ifdef DEBUG
      , rangeStart(p), rangeEnd(p + length)
#endif
    {
        MOZ_ASSERT(length <= size_t(-1) / sizeof(T));
        MOZ_ASSERT(uintptr_t(rangeStart) + length * sizeof(T) >= uintptr_t(rangeStart));
        checkSanity();
    }

Here is the call graph for this function:

template<typename T>
template<size_t N>
mozilla::RangedPtr< T >::RangedPtr ( arr[N]) [inline]

Definition at line 133 of file RangedPtr.h.

      : ptr(arr)
#ifdef DEBUG
      , rangeStart(arr), rangeEnd(arr + N)
#endif
    {
      checkSanity();
    }

Here is the call graph for this function:

template<typename T>
mozilla::RangedPtr< T >::RangedPtr ( ) [private]

Member Function Documentation

template<typename T>
void mozilla::RangedPtr< T >::checkSanity ( ) [inline, private]

Definition at line 84 of file RangedPtr.h.

                       {
        MOZ_ASSERT(rangeStart <= ptr);
        MOZ_ASSERT(ptr <= rangeEnd);
    }

Here is the caller graph for this function:

template<typename T>
RangedPtr<T> mozilla::RangedPtr< T >::create ( T *  ptr) const [inline, private]

Definition at line 90 of file RangedPtr.h.

                                      {
#ifdef DEBUG
        return RangedPtr<T>(ptr, rangeStart, rangeEnd);
#else
        return RangedPtr<T>(ptr, NULL, size_t(0));
#endif
    }

Here is the caller graph for this function:

template<typename T>
T* mozilla::RangedPtr< T >::get ( ) const [inline]

Definition at line 142 of file RangedPtr.h.

                   {
        return ptr;
    }

Here is the caller graph for this function:

template<typename T>
mozilla::RangedPtr< T >::operator T * ( ) const [private]
template<typename T>
template<typename U >
bool mozilla::RangedPtr< T >::operator!= ( const RangedPtr< U > &  other) const [inline]

Definition at line 239 of file RangedPtr.h.

                                                     {
        return !(*this == other);
    }
template<typename T>
template<typename U >
bool mozilla::RangedPtr< T >::operator!= ( const U *  u) const [inline]

Definition at line 248 of file RangedPtr.h.

                                      {
        return !(*this == u);
    }
template<typename T>
T* mozilla::RangedPtr< T >::operator& ( ) [private]
template<typename T>
T& mozilla::RangedPtr< T >::operator* ( ) const [inline]

Definition at line 230 of file RangedPtr.h.

                         {
        return *ptr;
    }
template<typename T>
RangedPtr<T> mozilla::RangedPtr< T >::operator+ ( size_t  inc) [inline]

Definition at line 164 of file RangedPtr.h.

                                       {
        MOZ_ASSERT(inc <= size_t(-1) / sizeof(T));
        MOZ_ASSERT(ptr + inc > ptr);
        return create(ptr + inc);
    }

Here is the call graph for this function:

template<typename T>
RangedPtr<T>& mozilla::RangedPtr< T >::operator++ ( ) [inline]

Definition at line 195 of file RangedPtr.h.

                               {
        return (*this += 1);
    }
template<typename T>
RangedPtr<T> mozilla::RangedPtr< T >::operator++ ( int  ) [inline]

Definition at line 199 of file RangedPtr.h.

                                 {
        RangedPtr<T> rcp = *this;
        ++*this;
        return rcp;
    }
template<typename T>
RangedPtr<T>& mozilla::RangedPtr< T >::operator+= ( size_t  inc) [inline]

Definition at line 215 of file RangedPtr.h.

                                         {
        this->operator=<T>(*this + inc);
        return *this;
    }
template<typename T>
RangedPtr<T> mozilla::RangedPtr< T >::operator- ( size_t  dec) [inline]

Definition at line 170 of file RangedPtr.h.

                                       {
        MOZ_ASSERT(dec <= size_t(-1) / sizeof(T));
        MOZ_ASSERT(ptr - dec < ptr);
        return create(ptr - dec);
    }

Here is the call graph for this function:

template<typename T>
size_t mozilla::RangedPtr< T >::operator- ( const RangedPtr< T > &  other) const [inline]

Definition at line 270 of file RangedPtr.h.

                                                      {
        MOZ_ASSERT(ptr >= other.ptr);
        return PointerRangeSize(other.ptr, ptr);
    }
template<typename T>
RangedPtr<T>& mozilla::RangedPtr< T >::operator-- ( ) [inline]

Definition at line 205 of file RangedPtr.h.

                               {
        return (*this -= 1);
    }
template<typename T>
RangedPtr<T> mozilla::RangedPtr< T >::operator-- ( int  ) [inline]

Definition at line 209 of file RangedPtr.h.

                                 {
        RangedPtr<T> rcp = *this;
        --*this;
        return rcp;
    }
template<typename T>
RangedPtr<T>& mozilla::RangedPtr< T >::operator-= ( size_t  dec) [inline]

Definition at line 220 of file RangedPtr.h.

                                         {
        this->operator=<T>(*this - dec);
        return *this;
    }
template<typename T>
template<typename U >
bool mozilla::RangedPtr< T >::operator< ( const RangedPtr< U > &  other) const [inline]

Definition at line 253 of file RangedPtr.h.

                                                    {
        return ptr < other.ptr;
    }
template<typename T>
template<typename U >
bool mozilla::RangedPtr< T >::operator<= ( const RangedPtr< U > &  other) const [inline]

Definition at line 257 of file RangedPtr.h.

                                                     {
        return ptr <= other.ptr;
    }
template<typename T>
RangedPtr<T>& mozilla::RangedPtr< T >::operator= ( const RangedPtr< T > &  other) [inline]

Definition at line 156 of file RangedPtr.h.

                                                       {
        MOZ_ASSERT(rangeStart == other.rangeStart);
        MOZ_ASSERT(rangeEnd == other.rangeEnd);
        ptr = other.ptr;
        checkSanity();
        return *this;
    }

Here is the call graph for this function:

template<typename T>
template<typename U >
RangedPtr<T>& mozilla::RangedPtr< T >::operator= ( U *  p) [inline]

Definition at line 181 of file RangedPtr.h.

                                  {
        *this = create(p);
        return *this;
    }

Here is the call graph for this function:

template<typename T>
template<typename U >
RangedPtr<T>& mozilla::RangedPtr< T >::operator= ( const RangedPtr< U > &  p) [inline]

Definition at line 187 of file RangedPtr.h.

                                                   {
        MOZ_ASSERT(rangeStart <= p.ptr);
        MOZ_ASSERT(p.ptr <= rangeEnd);
        ptr = p.ptr;
        checkSanity();
        return *this;
    }

Here is the call graph for this function:

template<typename T>
template<typename U >
bool mozilla::RangedPtr< T >::operator== ( const RangedPtr< U > &  other) const [inline]

Definition at line 235 of file RangedPtr.h.

                                                     {
        return ptr == other.ptr;
    }
template<typename T>
template<typename U >
bool mozilla::RangedPtr< T >::operator== ( const U *  u) const [inline]

Definition at line 244 of file RangedPtr.h.

                                      {
        return ptr == u;
    }
template<typename T>
template<typename U >
bool mozilla::RangedPtr< T >::operator> ( const RangedPtr< U > &  other) const [inline]

Definition at line 262 of file RangedPtr.h.

                                                    {
        return ptr > other.ptr;
    }
template<typename T>
template<typename U >
bool mozilla::RangedPtr< T >::operator>= ( const RangedPtr< U > &  other) const [inline]

Definition at line 266 of file RangedPtr.h.

                                                     {
        return ptr >= other.ptr;
    }
template<typename T>
T& mozilla::RangedPtr< T >::operator[] ( int  index) const [inline]

Definition at line 225 of file RangedPtr.h.

                                   {
        MOZ_ASSERT(size_t(index > 0 ? index : -index) <= size_t(-1) / sizeof(T));
        return *create(ptr + index);
    }

Here is the call graph for this function:


Member Data Documentation

template<typename T>
T* mozilla::RangedPtr< T >::ptr [private]

Definition at line 77 of file RangedPtr.h.


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