1 //------------------------------------------------------------------------------
2 // MessageBoolItemTest.h
4 //------------------------------------------------------------------------------
6 #ifndef MESSAGEBOOLITEMTEST_H
7 #define MESSAGEBOOLITEMTEST_H
9 // Standard Includes -----------------------------------------------------------
11 // System Includes -------------------------------------------------------------
13 // Project Includes ------------------------------------------------------------
15 // Local Includes --------------------------------------------------------------
16 #include "MessageItemTest.h"
18 // Local Defines ---------------------------------------------------------------
20 // Globals ---------------------------------------------------------------------
22 typedef TMessageItemFuncPolicy
30 &BMessage::ReplaceBool
35 struct ArrayTypeBase
<bool>
40 ArrayType() : array(NULL
), size(0) {;}
41 ArrayType(const ArrayType
& rhs
) : array(NULL
), size(0)
43 ArrayType(bool* data
, uint32 len
) : array(NULL
), size(0)
44 { Assign(data
, len
); }
45 ~ArrayType() { if (array
) delete[] array
; }
47 ArrayType
& operator=(const ArrayType
& rhs
)
50 Assign(rhs
.array
, rhs
.size
);
54 uint32
Size() { return size
; }
55 bool& operator[](int index
)
57 // We're just gonna let a segfault happen
62 void Assign(bool* data
, uint32 len
)
68 array
= new bool[Size()];
69 memcpy(array
, data
, Size());
75 typedef uint32 SizeType
;
76 static SizeType
Size(ArrayType
& array
) { return array
.Size(); }
79 struct TBoolInitPolicy
: public ArrayTypeBase
<bool>
81 inline static bool Zero() { return false; }
82 inline static bool Test1() { return true; }
83 inline static bool Test2() { return false; }
84 inline static size_t SizeOf(const bool&) { return sizeof (bool); }
85 inline static ArrayType
Array()
87 static bool array
[] = { true, true, true };
88 return ArrayType(array
, 3);
92 //struct TBoolAssertPolicy
94 // inline static bool Zero() { return false; }
95 // inline static bool Invalid() { return false;}
97 typedef TMessageItemAssertPolicy
105 typedef TMessageItemTest
113 TMessageBoolItemTest
;
115 #endif // MESSAGEBOOLITEMTEST_H