Fix FreeBSD build.
[haiku.git] / headers / os / app / PropertyInfo.h
blob534a7a5f978dfcb7a62e0e5fd2d099c437c08db7
1 /*
2 * Copyright 2009-2010 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT license.
4 */
5 #ifndef _PROPERTY_INFO_H
6 #define _PROPERTY_INFO_H
9 #include <BeBuild.h>
10 #include <Flattenable.h>
11 #include <SupportDefs.h>
12 #include <TypeConstants.h>
15 class BMessage;
18 struct compound_type {
19 struct field_pair {
20 const char* name;
21 type_code type;
23 field_pair pairs[5];
27 struct property_info {
28 const char* name;
29 uint32 commands[10];
30 uint32 specifiers[10];
31 const char* usage;
32 uint32 extra_data;
33 uint32 types[10];
34 compound_type ctypes[3];
35 uint32 _reserved[10];
39 enum value_kind {
40 B_COMMAND_KIND = 0,
41 B_TYPE_CODE_KIND = 1
45 struct value_info {
46 const char* name;
47 uint32 value;
48 value_kind kind;
49 const char* usage;
50 uint32 extra_data;
51 uint32 _reserved[10];
55 class BPropertyInfo : public BFlattenable {
56 public:
57 BPropertyInfo(property_info* prop = NULL,
58 value_info* value = NULL,
59 bool freeOnDelete = false);
60 virtual ~BPropertyInfo();
62 virtual int32 FindMatch(BMessage* msg, int32 index,
63 BMessage* specifier, int32 form,
64 const char* prop, void* data = NULL) const;
66 virtual bool IsFixedSize() const;
67 virtual type_code TypeCode() const;
68 virtual ssize_t FlattenedSize() const;
69 virtual status_t Flatten(void* buffer, ssize_t size) const;
70 virtual bool AllowsTypeCode(type_code code) const;
71 virtual status_t Unflatten(type_code code, const void* buffer,
72 ssize_t size);
74 const property_info* Properties() const;
75 const value_info* Values() const;
76 int32 CountProperties() const;
77 int32 CountValues() const;
79 void PrintToStream() const;
81 protected:
82 static bool FindCommand(uint32 what, int32 index,
83 property_info* info);
84 static bool FindSpecifier(uint32 form, property_info* info);
86 private:
87 virtual void _ReservedPropertyInfo1();
88 virtual void _ReservedPropertyInfo2();
89 virtual void _ReservedPropertyInfo3();
90 virtual void _ReservedPropertyInfo4();
92 BPropertyInfo(const BPropertyInfo& other);
93 BPropertyInfo& operator=(const BPropertyInfo& other);
94 void FreeMem();
96 property_info* fPropInfo;
97 value_info* fValueInfo;
98 int32 fPropCount;
99 bool fInHeap;
100 uint16 fValueCount;
101 uint32 _reserved[4];
105 #endif /* _PROPERTY_INFO_H */