Source: classlib/include/classlib/voidp.h


Annotated List
Files
Globals
Hierarchy
Index
/***************************************************************************
    voidp.h  -  pointer generico a void
                             -------------------
    begin                : ven dic  7 17:40:01 CET 2001
    copyright            : (C) 2001 by Nicola De Nisco
    email                : nicola@winada.it
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#if !defined( __CLASSLIB_VOIDP_H )
#define __CLASSLIB_VOIDP_H

#if !defined( __CLASSLIB_DEFS_H )
#include "classlib/defs.h"
#endif  // __CLASSLIB_DEFS_H

/**
  [INTERNAL USE ONLY]

  class TVoidPointer

  Implement an holder for a generic pointer to object.
  Used in most of the implementation of the indirect containers
  to hold values of pointer to generic object.
*/

class TVoidPointer
{

public:

    TVoidPointer( const void *p = 0 ) : Ptr(p) {}
    TVoidPointer( const TVoidPointer& rp ) : Ptr(rp.Ptr) {}

    const TVoidPointer& operator = ( const TVoidPointer& vp )
        { Ptr = vp.Ptr; return *this; }
    const TVoidPointer& operator = ( const void *p )
        { Ptr = p; return *this; }
    operator void *() const { return CONST_CAST(void *,Ptr); }

	int operator == ( const TVoidPointer& p ) const {
		return Ptr == p.Ptr;
		}
	int operator != ( const TVoidPointer& p ) const {
		return Ptr != p.Ptr;
		}
	int operator < ( const TVoidPointer& p ) const {
		return Ptr < p.Ptr;
		}
	int operator > ( const TVoidPointer& p ) const {
		return Ptr > p.Ptr;
		}

private:

    const void *Ptr;

};

#endif  // __CLASSLIB_VOIDP_H


Generated by: nicola on gulliver.wadahome.it on Sun May 25 13:54:34 2003, using kdoc 2.0a53.