xti additions / changes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2003-08-23 00:37:55 +00:00
parent b192f49963
commit ae820c693a
3 changed files with 737 additions and 512 deletions

117
include/wx/flags.h Normal file
View File

@@ -0,0 +1,117 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/flags.h
// Purpose: a bitset suited for replacing the current style flags
// Author: Stefan Csomor
// Modified by:
// Created: 27/07/03
// RCS-ID: $Id$
// Copyright: (c) 2003 Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SETH__
#define _WX_SETH__
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "flags.h"
#endif
// wxFlags should be applied to an enum, then this can be used like
// bitwise operators but keeps the type safety and information, the
// enums must be in a sequence , their value determines the bit position
// that they represent
template <class T> class wxFlags
{
friend class wxEnumData ;
public:
wxFlags(long val) { m_data = val ; }
wxFlags() { m_data = 0; }
wxFlags(const wxFlags &src) { m_data = src.m_data; }
wxFlags(const T el) { m_data |= 1 << el; }
operator long() const { return m_data ; }
wxFlags &operator =(const wxFlags &rhs)
{
m_data = rhs.m_data;
return *this;
}
wxFlags &operator +=(const wxFlags &rhs) // union
{
m_data |= rhs.m_data;
return *this;
}
wxFlags &operator -=(const wxFlags &rhs) // difference
{
m_data ^= rhs.m_data;
return *this;
}
wxFlags &operator *=(const wxFlags &rhs) // intersection
{
m_data &= rhs.m_data;
return *this;
}
wxFlags operator +(const wxFlags &rhs) const // union
{
wxFlags<T> s;
s.m_data = m_data | rhs.m_data;
return s;
}
wxFlags operator -(const wxFlags &rhs) const // difference
{
wxFlags<T> s;
s.m_data = m_data ^ rhs.m_data;
return s;
}
wxFlags operator *(const wxFlags &rhs) const // intersection
{
wxFlags<T> s;
s.m_data = m_data & rhs.m_data;
return s;
}
wxFlags& Set(const T el) //Add element
{
m_data |= 1 << el;
return *this;
}
wxFlags& Clear(const T el) //remove element
{
m_data &= ~(1 << el);
return *this;
}
bool Contains(const T el) const
{
return (m_data & (1 << el)) ? true : false;
}
wxFlags &Clear()
{
m_data = 0;
return *this;
}
bool Empty() const
{
return m_data == 0;
}
bool operator ==(const wxFlags &rhs) const
{
return m_data == rhs.m_data;
}
bool operator !=(const wxFlags &rhs) const
{
return !operator==(rhs);
}
private :
int m_data;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -142,6 +142,7 @@ private :
struct wxWriterInternalPropertiesData ;
void WriteAllProperties( const wxObject * obj , const wxClassInfo* ci , wxPersister *persister, wxWriterInternalPropertiesData * data ) ;
void WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , const wxPropertyInfo* pi , wxPersister *persister , wxWriterInternalPropertiesData *data ) ;
void WriteObject(const wxObject *object, const wxClassInfo *classInfo , wxPersister *persister , bool isEmbedded, wxxVariantArray &metadata ) ;
void FindConnectEntry(const wxWindow * evSource,const wxDelegateTypeInfo* dti, const wxObject* &sink , const wxHandlerInfo *&handler) ;
} ;