Remote Call Framework 3.0
QHostAddress.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2018, Delta V Software. All rights reserved.
6 // http://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF
12 // under GPL terms.
13 //
14 // Version: 3.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_SF_QHOSTADDRESS_HPP
20 #define INCLUDE_SF_QHOSTADDRESS_HPP
21 
22 #include <QHostAddress>
23 
24 #include <boost/config.hpp>
25 
26 #include <SF/Archive.hpp>
27 #include <SF/QByteArray.hpp>
28 
29 namespace SF {
30 
31  // QHostAddress
32  inline void serialize(SF::Archive & ar, QHostAddress & qha)
33  {
34  if (ar.isRead())
35  {
36  QByteArray data;
37  serializeQByteArray(ar, data);
38  QDataStream qdsi(data); // QIODevice::ReadOnly
39  qdsi >> qha;
40  }
41  else if (ar.isWrite())
42  {
43  QByteArray data;
44  QDataStream qdso(&data, QIODevice::ReadWrite);
45  qdso << qha;
46  serializeQByteArray(ar, data);
47  }
48  }
49 
50  //inline void serialize(SF::Archive & ar, QHostAddress & qha)
51  //{
52  // if (ar.isRead())
53  // {
54  // QByteArray data;
55  // QDataStream qdsi(&data, QIODevice::ReadWrite);
56  // serializeQDataStream(ar, qdsi);
57  // qdsi >> qha;
58  // }
59  // else if (ar.isWrite())
60  // {
61  // QByteArray data;
62  // QDataStream qdso(&data, QIODevice::ReadWrite);
63  // qdso << qha;
64  // serializeQDataStream(ar, qdso);
65  // }
66  //}
67 
68 } // namespace SF
69 
70 #endif // ! INCLUDE_SF_QHOSTADDRESS_HPP
Represents an archive, in which serialized objects are stored.
Definition: Archive.hpp:32
Definition: ByteBuffer.hpp:189
bool isWrite() const
Returns true if this archive is being written to.
bool isRead() const
Returns true if this archive is being read from.