Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17397/src/gui
Modified Files:
wxSpamOptions.cpp
Log Message:
use scoped_array<> instead of BOUNDED_ARRAY hack
Index: wxSpamOptions.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxSpamOptions.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -b -u -2 -r1.16 -r1.17
--- wxSpamOptions.cpp 15 May 2004 23:16:59 -0000 1.16
+++ wxSpamOptions.cpp 11 Jul 2004 13:15:18 -0000 1.17
@@ -42,55 +42,5 @@
DECLARE_REF_COUNTER(Profile)
-/**
- A fixed-size array.
- */
-class BoundArrayCommon
-{
-public:
- BoundArrayCommon() : m_size(0) {}
-
- size_t Size() const { return m_size; }
-
-protected:
- size_t m_size;
-};
-
-#define BOUND_ARRAY(type,name) \
- class name : public BoundArrayCommon \
- { \
- public: \
- typedef type HostType; \
- \
- name() : m_array(NULL) {} \
- ~name() { Destroy(); } \
- \
- void Initialize(size_t count); \
- type *Get() { return m_array; } \
- type& At(size_t offset); \
- type& operator[](size_t offset) { return At(offset); } \
- \
- private: \
- void Destroy(); \
- \
- type *m_array; \
- }
-
-#define IMPLEMENT_BOUND_ARRAY(name) \
- void name::Destroy() { delete[] m_array; } \
- \
- void name::Initialize(size_t count) \
- { \
- ASSERT( !m_array ); \
- m_array = new name::HostType[m_size = count]; \
- } \
- \
- name::HostType& name::At(size_t offset) \
- { \
- ASSERT( offset < m_size ); \
- return m_array[offset]; \
- }
-
-BOUND_ARRAY(ConfigValueNone,ConfigValueArray);
-BOUND_ARRAY(wxOptionsPage::FieldInfo,FieldInfoArray);
+typedef scoped_array<wxOptionsPage::FieldInfo> FieldInfoArray;
@@ -327,5 +277,5 @@
size_t GetConfigEntryCount();
- ConfigValueArray m_configValues;
+ scoped_array<ConfigValueDefault> m_configValues;
FieldInfoArray m_fieldInfo;
@@ -421,7 +371,4 @@
-IMPLEMENT_BOUND_ARRAY(ConfigValueArray)
-IMPLEMENT_BOUND_ARRAY(FieldInfoArray)
-
SpamOptionManagerBody::SpamOptionManagerBody()
{
@@ -553,5 +500,7 @@
void SpamOptionManagerBody::BuildConfigValues()
{
- m_configValues.Initialize(GetConfigEntryCount());
+ // ConfigValueDefault doesn't have default ctor, so use this hack knowing
+ // that ConfigValueNone has exactly the same binary layout as ValueDefault
+ m_configValues.reset(new ConfigValueNone[GetConfigEntryCount()]);
size_t n = 1;
@@ -571,5 +520,5 @@
void SpamOptionManagerBody::BuildFieldInfo()
{
- m_fieldInfo.Initialize(GetConfigEntryCount());
+ m_fieldInfo.reset(new wxOptionsPage::FieldInfo[GetConfigEntryCount()]);
m_fieldInfo[0].label
@@ -608,6 +557,6 @@
// the fields description
- m_fieldInfo.Get(),
- m_configValues.Get(),
+ m_fieldInfo.get(),
+ m_configValues.get(),
GetConfigEntryCount()
);
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates