1 //------------------------------------------------------------------------------
2 // MessagePointerItemTest.h
4 //------------------------------------------------------------------------------
6 #ifndef MESSAGEPOINTERITEMTEST_H
7 #define MESSAGEPOINTERITEMTEST_H
9 // Standard Includes -----------------------------------------------------------
11 // System Includes -------------------------------------------------------------
13 // Project Includes ------------------------------------------------------------
15 // Local Includes --------------------------------------------------------------
16 #include "MessageItemTest.h"
18 // Local Defines ---------------------------------------------------------------
20 // Globals ---------------------------------------------------------------------
22 struct TPointerFuncPolicy
24 static status_t
Add(BMessage
& msg
, const char* name
, const void* val
)
25 { return msg
.AddPointer(name
, val
); }
26 static status_t
AddData(BMessage
& msg
, const char* name
, type_code type
,
27 const void* data
, ssize_t size
, bool)
28 { return msg
.AddData(name
, type
, data
, size
); }
29 static status_t
Find(BMessage
& msg
, const char* name
, int32 index
,
31 { return msg
.FindPointer(name
, index
, (void**)val
); }
32 static status_t
ShortFind(BMessage
& msg
, const char* name
, const void** val
)
33 { return msg
.FindPointer(name
, (void**)val
); }
34 static const void* QuickFind(BMessage
& msg
, const char* name
, int32 index
)
37 msg
.FindPointer(name
, index
, (void**)&ptr
);
40 static bool Has(BMessage
& msg
, const char* name
, int32 index
)
41 { return msg
.HasPointer(name
, index
); }
42 static status_t
Replace(BMessage
& msg
, const char* name
, int32 index
,
44 { return msg
.ReplacePointer(name
, index
, val
); }
45 static status_t
FindData(BMessage
& msg
, const char* name
, type_code type
,
46 int32 index
, const void** data
, ssize_t
* size
)
47 { return msg
.FindData(name
, type
, index
, data
, size
); }
50 struct TPointerInitPolicy
: public ArrayTypeBase
<const void*>
52 inline static const void* Zero() { return NULL
; }
53 inline static const void* Test1() { return (const void*)&Test1
; }
54 inline static const void* Test2() { return (const void*)&Test2
; }
55 inline static size_t SizeOf(const void*) { return sizeof (const void*); }
56 inline static ArrayType
Array()
59 array
.push_back(Zero());
60 array
.push_back(Test1());
61 array
.push_back(Test2());
66 struct TPointerAssertPolicy
68 inline static const void* Zero() { return NULL
; }
69 inline static const void* Invalid() { return NULL
; }
70 inline static bool Size(size_t size
, const void* t
)
71 { return size
== sizeof (t
); }
74 typedef TMessageItemTest
82 TMessagePointerItemTest
;
84 #endif // MESSAGEPOINTERITEMTEST_H