1 //------------------------------------------------------------------------------
2 // MessageCStringItemTest.h
4 //------------------------------------------------------------------------------
6 #ifndef MESSAGECSTRINGITEMTEST_H
7 #define MESSAGECSTRINGITEMTEST_H
9 // Standard Includes -----------------------------------------------------------
11 // System Includes -------------------------------------------------------------
14 // Project Includes ------------------------------------------------------------
16 // Local Includes --------------------------------------------------------------
17 #include "MessageItemTest.h"
19 // Local Defines ---------------------------------------------------------------
21 // Globals ---------------------------------------------------------------------
23 typedef TMessageItemFuncPolicy
27 &BMessage::FindString
,
28 &BMessage::FindString
,
29 &BMessage::FindString
,
31 &BMessage::ReplaceString
35 struct TCStringInitPolicy
: public ArrayTypeBase
<const char*>
37 typedef const char* TypePtr
;
39 inline static const char* Zero() { return sStr1
; }
40 inline static const char* Test1() { return sStr2
; }
41 inline static const char* Test2() { return sStr3
; }
42 inline static size_t SizeOf(const char*& data
) { return strlen(data
) + 1; }
43 inline static ArrayType
Array()
46 array
.push_back(Zero());
47 array
.push_back(Test1());
48 array
.push_back(Test2());
53 static const char* sStr1
;
54 static const char* sStr2
;
55 static const char* sStr3
;
57 const char* TCStringInitPolicy::sStr1
= "";
58 const char* TCStringInitPolicy::sStr2
= "cstring one";
59 const char* TCStringInitPolicy::sStr3
= "Bibbity-bobbity-boo!";
60 //------------------------------------------------------------------------------
61 struct TCStringAssertPolicy
63 inline static const char* Zero() { return ""; }
64 inline static const char* Invalid() { return ""; }
65 static bool Size(size_t size
, const char* data
)
66 ;//{ return size == msg.FlattenedSize(); }
68 bool TCStringAssertPolicy::Size(size_t size
, const char* data
)
70 return size
== strlen(data
) + 1;
72 //------------------------------------------------------------------------------
73 struct TCStringComparePolicy
75 static bool Compare(const char* lhs
, const char* rhs
);
77 bool TCStringCtypedef
const char* TypePtr
;
78 omparePolicy::Compare(const char* lhs
, const char* rhs
)
84 return strcmp(lhs
, rhs
) == 0;
86 //------------------------------------------------------------------------------
88 struct TypePolicy
<const char*>
90 typedef const char* TypePtr
;
91 enum { FixedSize
= false };
92 inline const char* Dereference(TypePtr p
) { return p
; }
93 inline const char* AddressOf(const char*& t
) { return t
; }
95 //------------------------------------------------------------------------------
96 typedef TMessageItemTest
102 TCStringAssertPolicy
,
103 TCStringComparePolicy
105 TMessageCStringItemTest
;
108 #endif // MESSAGECSTRINGITEMTEST_H