vfs: check userland buffers before reading them.
[haiku.git] / src / tests / kits / app / bmessage / MessageBPointItemTest.h
blobeebfa80cc5bf16158b11a0e345d036502a7a27c3
1 //------------------------------------------------------------------------------
2 // MessageBPointItemTest.h
3 //
4 //------------------------------------------------------------------------------
6 #ifndef MESSAGEBPOINTITEMTEST_H
7 #define MESSAGEBPOINTITEMTEST_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
24 BPoint,
25 &BMessage::AddPoint,
26 &BMessage::FindPoint,
27 &BMessage::FindPoint,
28 &BMessage::FindPoint,
29 &BMessage::HasPoint,
30 &BMessage::ReplacePoint
32 TPointFuncPolicy;
34 struct TPointInitPolicy : public ArrayTypeBase<BPoint>
36 inline static BPoint Zero() { return BPoint(0.0, 0.0); }
37 inline static BPoint Test1() { return BPoint(10.0, 10.0); }
38 inline static BPoint Test2() { return BPoint(20.0, 20.0); }
39 inline static size_t SizeOf(const BPoint&) { return sizeof (BPoint); }
40 inline static ArrayType Array()
42 ArrayType array;
43 array.push_back(BPoint(30.0, 30.0));
44 array.push_back(BPoint(40.0, 40.0));
45 array.push_back(BPoint(50.0, 50.0));
46 return array;
50 struct TPointAssertPolicy
52 inline static BPoint Zero() { return BPoint(0.0, 0.0); }
53 inline static BPoint Invalid() { return BPoint(0.0, 0.0); }
54 inline static bool Size(size_t size, BPoint& p)
55 { return size == sizeof (p); }
58 typedef TMessageItemTest
60 BPoint,
61 B_POINT_TYPE,
62 TPointFuncPolicy,
63 TPointInitPolicy,
64 TPointAssertPolicy
66 TMessageBPointItemTest;
68 std::ostream& operator<<(std::ostream& os, const BPoint& point)
70 int precision = os.precision();
71 os << "point(x:" << point.x << ", y:" << point.y;
72 os.precision(precision);
73 return os;
76 #endif // MESSAGEBPOINTITEMTEST_H
79 * $Log $
81 * $Id $