* BNetworkAddress isn't really BArchivable material, switched to BFlattenable

instead.
* Also actually implemented the serializing functionality this time, as usual
  completely untested, though :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39677 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-11-29 20:29:37 +00:00
parent bf5d40704e
commit e6cec9839d
3 changed files with 64 additions and 31 deletions
+10 -5
View File
@@ -16,7 +16,7 @@
#include <String.h>
class BNetworkAddress : public BArchivable {
class BNetworkAddress : public BFlattenable {
public:
BNetworkAddress();
BNetworkAddress(const char* address,
@@ -38,7 +38,6 @@ public:
BNetworkAddress(const in6_addr& address,
uint16 port = 0);
BNetworkAddress(const BNetworkAddress& other);
BNetworkAddress(BMessage* archive);
virtual ~BNetworkAddress();
status_t InitCheck() const;
@@ -117,12 +116,18 @@ public:
BString HostName() const;
BString ServiceName() const;
virtual status_t Archive(BMessage* into, bool deep = true) const;
static BArchivable* Instantiate(BMessage* archive);
bool Equals(const BNetworkAddress& other,
bool includePort = true) const;
// BFlattenable implementation
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 status_t Unflatten(type_code code, const void* buffer,
ssize_t size);
BNetworkAddress& operator=(const BNetworkAddress& other);
bool operator==(const BNetworkAddress& other) const;
+2 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2005-2009, Haiku, Inc. All Rights Reserved.
* Copyright 2005-2010, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Author:
@@ -59,6 +59,7 @@ enum {
B_UINT8_TYPE = 'UBYT',
B_VECTOR_ICON_TYPE = 'VICN',
B_XATTR_TYPE = 'XATR',
B_NETWORK_ADDRESS_TYPE = 'NWAD',
// deprecated, do not use
B_ASCII_TYPE = 'TEXT' // use B_STRING_TYPE instead