MessageAdapter: cleanup, no functional change.

This commit is contained in:
Axel Dörfler
2015-05-13 23:06:49 +02:00
parent 0efd0f54d3
commit 4d50aa327c
2 changed files with 56 additions and 41 deletions
+27 -18
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2007, Haiku Inc. All rights reserved.
* Copyright 2007-2015, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,9 +8,11 @@
#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'
@@ -19,36 +21,43 @@
#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 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 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);
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 status_t _ConvertFromKMessage(const KMessage* from,
BMessage* to);
static ssize_t _R5FlattenedSize(const BMessage *from);
static ssize_t _R5FlattenedSize(const BMessage* from);
static status_t _FlattenR5Message(uint32 format, const BMessage *from,
char *buffer, ssize_t *size);
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);
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_