00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef fal_traits_h
00018 #define fal_traits_h
00019
00020 #include <falcon/setup.h>
00021 #include <falcon/types.h>
00022
00023 namespace Falcon {
00024
00025 class FALCON_DYN_CLASS ElementTraits
00026 {
00027 public:
00028 virtual ~ElementTraits();
00029 virtual uint32 memSize() const = 0;
00030 virtual void init( void *itemZone ) const = 0;
00031 virtual void copy( void *targetZone, const void *sourceZone ) const = 0;
00032 virtual int compare( const void *first, const void *second ) const = 0;
00033 virtual void destroy( void *item ) const = 0;
00034 virtual bool owning() const = 0;
00035 };
00036
00037 class FALCON_DYN_CLASS VoidpTraits: public ElementTraits
00038 {
00039 public:
00040 virtual uint32 memSize() const;
00041 virtual void init( void *itemZone ) const;
00042 virtual void copy( void *targetZone, const void *sourceZone ) const;
00043 virtual int compare( const void *first, const void *second ) const;
00044 virtual void destroy( void *item ) const;
00045 virtual bool owning() const;
00046 };
00047
00048 class FALCON_DYN_CLASS IntTraits: public ElementTraits
00049 {
00050 public:
00051 virtual uint32 memSize() const;
00052 virtual void init( void *itemZone ) const;
00053 virtual void copy( void *targetZone, const void *sourceZone ) const;
00054 virtual int compare( const void *first, const void *second ) const;
00055 virtual void destroy( void *item ) const;
00056 virtual bool owning() const;
00057 };
00058
00059 class FALCON_DYN_CLASS StringPtrTraits: public ElementTraits
00060 {
00061 public:
00062 virtual uint32 memSize() const;
00063 virtual void init( void *itemZone ) const;
00064 virtual void copy( void *targetZone, const void *sourceZone ) const;
00065 virtual int compare( const void *first, const void *second ) const;
00066 virtual void destroy( void *item ) const;
00067 virtual bool owning() const;
00068 };
00069
00070 class FALCON_DYN_CLASS StringPtrOwnTraits: public StringPtrTraits
00071 {
00072 public:
00073 virtual ~StringPtrOwnTraits() {}
00074 virtual bool owning() const;
00075 virtual void destroy( void *item ) const;
00076 };
00077
00078 class FALCON_DYN_CLASS StringTraits: public ElementTraits
00079 {
00080 public:
00081 virtual uint32 memSize() const;
00082 virtual void init( void *itemZone ) const;
00083 virtual void copy( void *targetZone, const void *sourceZone ) const;
00084 virtual int compare( const void *first, const void *second ) const;
00085 virtual void destroy( void *item ) const;
00086 virtual bool owning() const;
00087 };
00088
00089
00090 namespace traits {
00091 extern FALCON_DYN_SYM StringTraits &t_string();
00092 extern FALCON_DYN_SYM VoidpTraits &t_voidp();
00093 extern FALCON_DYN_SYM IntTraits &t_int();
00094 extern FALCON_DYN_SYM StringPtrTraits &t_stringptr();
00095 extern FALCON_DYN_SYM StringPtrOwnTraits &t_stringptr_own();
00096 void FALCON_DYN_SYM releaseTraits();
00097 }
00098
00099 }
00100
00101 #endif
00102
00103