* Unified handling of different BMessage formats into MessageAdapter.cpp
* Removed r5_message.cpp and dano_message.cpp accordingly * Also moved out KMessage handling from Message.cpp to MessageAdapter.cpp * Fixed some minor style issues in Message.cpp git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21514 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Michael Lotz <[email protected]>
|
||||
*/
|
||||
#ifndef _MESSAGE_ADAPTER_H_
|
||||
#define _MESSAGE_ADAPTER_H_
|
||||
|
||||
#include <Message.h>
|
||||
#include <util/KMessage.h>
|
||||
|
||||
// message formats
|
||||
#define MESSAGE_FORMAT_R5 'FOB1'
|
||||
#define MESSAGE_FORMAT_R5_SWAPPED '1BOF'
|
||||
#define MESSAGE_FORMAT_DANO 'FOB2'
|
||||
#define MESSAGE_FORMAT_DANO_SWAPPED '2BOF'
|
||||
#define MESSAGE_FORMAT_HAIKU '1FMH'
|
||||
#define MESSAGE_FORMAT_HAIKU_SWAPPED 'HMF1'
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class MessageAdapter {
|
||||
public:
|
||||
static ssize_t FlattenedSize(uint32 format, const BMessage *from);
|
||||
|
||||
static status_t Flatten(uint32 format, const BMessage *from,
|
||||
char *buffer, ssize_t *size);
|
||||
static status_t Flatten(uint32 format, const BMessage *from,
|
||||
BDataIO *stream, ssize_t *size);
|
||||
|
||||
static status_t Unflatten(uint32 format, BMessage *into,
|
||||
const char *buffer);
|
||||
static status_t Unflatten(uint32 format, BMessage *into,
|
||||
BDataIO *stream);
|
||||
|
||||
private:
|
||||
static status_t _ConvertKMessage(const KMessage *from, BMessage *to);
|
||||
|
||||
static ssize_t _R5FlattenedSize(const BMessage *from);
|
||||
|
||||
static status_t _FlattenR5Message(uint32 format, const BMessage *from,
|
||||
char *buffer, ssize_t *size);
|
||||
|
||||
static status_t _UnflattenR5Message(uint32 format, BMessage *into,
|
||||
BDataIO *stream);
|
||||
static status_t _UnflattenDanoMessage(uint32 format, BMessage *into,
|
||||
BDataIO *stream);
|
||||
};
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif // _MESSAGE_ADAPTER_H_
|
||||
@@ -16,6 +16,7 @@ class BMessage;
|
||||
namespace BPrivate {
|
||||
|
||||
class KMessageField;
|
||||
class MessageAdapter;
|
||||
|
||||
// KMessage
|
||||
class KMessage {
|
||||
@@ -102,6 +103,7 @@ public:
|
||||
|
||||
private:
|
||||
friend class KMessageField;
|
||||
friend class MessageAdapter;
|
||||
friend class ::BMessage; // not so nice, but makes things easier
|
||||
|
||||
struct Header {
|
||||
|
||||
Reference in New Issue
Block a user