2009-08-27 01:56:28 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Haiku Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT license.
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _PROPERTY_INFO_H
|
|
|
|
#define _PROPERTY_INFO_H
|
|
|
|
|
2009-08-27 12:01:57 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <BeBuild.h>
|
|
|
|
#include <Flattenable.h>
|
2009-08-27 01:56:28 +04:00
|
|
|
#include <SupportDefs.h>
|
|
|
|
#include <TypeConstants.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
struct compound_type {
|
|
|
|
struct field_pair {
|
2009-08-27 01:56:28 +04:00
|
|
|
const char* name;
|
|
|
|
type_code type;
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
field_pair pairs[5];
|
|
|
|
};
|
|
|
|
|
2009-08-27 01:56:28 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
struct property_info {
|
2009-08-27 01:56:28 +04:00
|
|
|
const char* name;
|
2002-07-09 16:24:59 +04:00
|
|
|
uint32 commands[10];
|
|
|
|
uint32 specifiers[10];
|
2009-08-27 01:56:28 +04:00
|
|
|
const char* usage;
|
2002-07-09 16:24:59 +04:00
|
|
|
uint32 extra_data;
|
|
|
|
uint32 types[10];
|
2009-08-27 12:01:57 +04:00
|
|
|
compound_type ctypes[3];
|
2002-07-09 16:24:59 +04:00
|
|
|
uint32 _reserved[10];
|
|
|
|
};
|
|
|
|
|
2009-08-27 01:56:28 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
enum value_kind {
|
|
|
|
B_COMMAND_KIND = 0,
|
|
|
|
B_TYPE_CODE_KIND = 1
|
|
|
|
};
|
|
|
|
|
2009-08-27 01:56:28 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
struct value_info {
|
2009-08-27 01:56:28 +04:00
|
|
|
const char* name;
|
2002-07-09 16:24:59 +04:00
|
|
|
uint32 value;
|
|
|
|
value_kind kind;
|
2009-08-27 01:56:28 +04:00
|
|
|
const char* usage;
|
2002-07-09 16:24:59 +04:00
|
|
|
uint32 extra_data;
|
|
|
|
uint32 _reserved[10];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BPropertyInfo : public BFlattenable {
|
|
|
|
public:
|
2009-08-27 01:56:28 +04:00
|
|
|
BPropertyInfo(property_info* prop = NULL,
|
|
|
|
value_info* value = NULL,
|
|
|
|
bool freeOnDelete = false);
|
|
|
|
virtual ~BPropertyInfo();
|
|
|
|
|
2009-08-27 12:01:57 +04:00
|
|
|
virtual int32 FindMatch(BMessage* msg, int32 index,
|
|
|
|
BMessage* specifier, int32 form,
|
|
|
|
const char* prop, void* data = NULL) const;
|
2009-08-27 01:56:28 +04:00
|
|
|
|
2009-08-27 12:01:57 +04:00
|
|
|
virtual bool IsFixedSize() const;
|
|
|
|
virtual type_code TypeCode() const;
|
|
|
|
virtual ssize_t FlattenedSize() const;
|
|
|
|
virtual status_t Flatten(void* buffer, ssize_t size) const;
|
|
|
|
virtual bool AllowsTypeCode(type_code code) const;
|
|
|
|
virtual status_t Unflatten(type_code code, const void* buffer,
|
|
|
|
ssize_t size);
|
2009-08-27 01:56:28 +04:00
|
|
|
|
2009-08-27 12:01:57 +04:00
|
|
|
const property_info* Properties() const;
|
|
|
|
const value_info* Values() const;
|
2002-07-09 16:24:59 +04:00
|
|
|
int32 CountProperties() const;
|
|
|
|
int32 CountValues() const;
|
|
|
|
|
|
|
|
void PrintToStream() const;
|
|
|
|
|
|
|
|
protected:
|
2009-08-27 12:01:57 +04:00
|
|
|
static bool FindCommand(uint32 what, int32 index,
|
|
|
|
property_info* info);
|
|
|
|
static bool FindSpecifier(uint32 form, property_info* info);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
private:
|
2009-08-27 12:01:57 +04:00
|
|
|
virtual void _ReservedPropertyInfo1();
|
|
|
|
virtual void _ReservedPropertyInfo2();
|
|
|
|
virtual void _ReservedPropertyInfo3();
|
|
|
|
virtual void _ReservedPropertyInfo4();
|
|
|
|
|
|
|
|
BPropertyInfo(const BPropertyInfo& other);
|
|
|
|
BPropertyInfo& operator=(const BPropertyInfo& other);
|
|
|
|
void FreeMem();
|
|
|
|
|
|
|
|
property_info* fPropInfo;
|
|
|
|
value_info* fValueInfo;
|
|
|
|
int32 fPropCount;
|
|
|
|
bool fInHeap;
|
|
|
|
uint16 fValueCount;
|
|
|
|
uint32 _reserved[4];
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _PROPERTY_INFO_H */
|
2009-08-27 01:56:28 +04:00
|
|
|
|