2011-06-22 02:59:54 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2011, Rene Gollent, rene@gollent.com.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef BMESSAGE_VALUE_NODE_H
|
|
|
|
#define BMESSAGE_VALUE_NODE_H
|
|
|
|
|
2011-06-26 22:35:56 +04:00
|
|
|
#include <Message.h>
|
|
|
|
#include <ObjectList.h>
|
2011-06-22 02:59:54 +04:00
|
|
|
|
|
|
|
#include "ValueNode.h"
|
|
|
|
|
|
|
|
|
|
|
|
class BMessageValueNode : public ValueNode {
|
|
|
|
public:
|
2011-06-26 22:35:56 +04:00
|
|
|
BMessageValueNode(ValueNodeChild* nodeChild,
|
|
|
|
Type* type);
|
|
|
|
virtual ~BMessageValueNode();
|
2011-06-22 02:59:54 +04:00
|
|
|
|
2011-06-26 22:35:56 +04:00
|
|
|
virtual Type* GetType() const;
|
2011-06-22 02:59:54 +04:00
|
|
|
|
2011-06-26 22:35:56 +04:00
|
|
|
virtual status_t ResolvedLocationAndValue(
|
|
|
|
ValueLoader* valueLoader,
|
|
|
|
ValueLocation*& _location,
|
|
|
|
Value*& _value);
|
2011-06-22 02:59:54 +04:00
|
|
|
|
2011-06-26 22:35:56 +04:00
|
|
|
virtual status_t CreateChildren();
|
|
|
|
virtual int32 CountChildren() const;
|
|
|
|
virtual ValueNodeChild* ChildAt(int32 index) const;
|
2011-06-22 02:59:54 +04:00
|
|
|
|
|
|
|
private:
|
2011-06-26 22:35:56 +04:00
|
|
|
class BMessageFieldHeaderNode;
|
|
|
|
class BMessageFieldHeaderNodeChild;
|
|
|
|
|
|
|
|
// for GCC2
|
|
|
|
friend class BMessageFieldHeaderNode;
|
|
|
|
friend class BMessageFieldHeaderNodeChild;
|
2011-06-28 04:08:15 +04:00
|
|
|
|
|
|
|
typedef BObjectList<ValueNodeChild> ChildNodeList;
|
|
|
|
|
2011-06-26 22:35:56 +04:00
|
|
|
private:
|
|
|
|
Type* fType;
|
2011-06-28 04:08:15 +04:00
|
|
|
bool fValid;
|
2011-06-26 22:35:56 +04:00
|
|
|
BMessage fMessage;
|
2011-06-28 04:08:15 +04:00
|
|
|
ChildNodeList fChildren;
|
2011-06-26 22:35:56 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BMessageValueNode::BMessageFieldHeaderNode : public ValueNode {
|
|
|
|
public:
|
|
|
|
BMessageFieldHeaderNode(
|
|
|
|
BMessageFieldHeaderNodeChild *child,
|
|
|
|
BMessageValueNode* parent,
|
|
|
|
const BString& name,
|
|
|
|
type_code type, int32 count);
|
|
|
|
|
|
|
|
virtual ~BMessageFieldHeaderNode();
|
|
|
|
|
|
|
|
virtual Type* GetType() const;
|
|
|
|
|
|
|
|
virtual status_t CreateChildren();
|
|
|
|
virtual int32 CountChildren() const;
|
|
|
|
virtual ValueNodeChild* ChildAt(int32 index) const;
|
|
|
|
|
|
|
|
virtual status_t ResolvedLocationAndValue(
|
|
|
|
ValueLoader* loader,
|
|
|
|
ValueLocation *& _location,
|
|
|
|
Value*& _value);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BString fName;
|
|
|
|
Type* fType;
|
|
|
|
BMessageValueNode* fParent;
|
|
|
|
type_code fFieldType;
|
|
|
|
int32 fFieldCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class BMessageValueNode::BMessageFieldHeaderNodeChild : public ValueNodeChild {
|
|
|
|
public:
|
|
|
|
BMessageFieldHeaderNodeChild(
|
2011-06-28 04:08:15 +04:00
|
|
|
BMessageValueNode* parent,
|
2011-06-26 22:35:56 +04:00
|
|
|
const BString &name,
|
|
|
|
type_code type, int32 count);
|
|
|
|
|
|
|
|
virtual ~BMessageFieldHeaderNodeChild();
|
|
|
|
|
|
|
|
virtual const BString& Name() const;
|
|
|
|
virtual Type* GetType() const;
|
|
|
|
virtual ValueNode* Parent() const;
|
|
|
|
|
|
|
|
virtual bool IsInternal() const;
|
|
|
|
virtual status_t CreateInternalNode(
|
|
|
|
ValueNode*& _node);
|
|
|
|
|
|
|
|
virtual status_t ResolveLocation(ValueLoader* valueLoader,
|
|
|
|
ValueLocation*& _location);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BString fName;
|
|
|
|
Type* fType;
|
2011-06-28 04:08:15 +04:00
|
|
|
BMessageValueNode* fParent;
|
2011-06-26 22:35:56 +04:00
|
|
|
type_code fFieldType;
|
|
|
|
int32 fFieldCount;
|
|
|
|
};
|
|
|
|
|
2011-06-22 02:59:54 +04:00
|
|
|
#endif // BMESSAGE_VALUE_NODE_H
|