Remote Call Framework 3.3
QHostAddress.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2022, Delta V Software. All rights reserved.
6 // https://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 under GPL terms.
12 //
13 // Version: 3.3
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
18 #ifndef INCLUDE_SF_QHOSTADDRESS_HPP
19 #define INCLUDE_SF_QHOSTADDRESS_HPP
20 
21 #include <QHostAddress>
22 
23 #include <boost/config.hpp>
24 
25 #include <SF/Archive.hpp>
26 #include <SF/QByteArray.hpp>
27 
28 namespace SF {
29 
30  // QHostAddress
31  inline void serialize(SF::Archive & ar, QHostAddress & qha)
32  {
33  if (ar.isRead())
34  {
35  QByteArray data;
36  serializeQByteArray(ar, data);
37  QDataStream qdsi(data); // QIODevice::ReadOnly
38  qdsi >> qha;
39  }
40  else if (ar.isWrite())
41  {
42  QByteArray data;
43  QDataStream qdso(&data, QIODevice::ReadWrite);
44  qdso << qha;
45  serializeQByteArray(ar, data);
46  }
47  }
48 
49  //inline void serialize(SF::Archive & ar, QHostAddress & qha)
50  //{
51  // if (ar.isRead())
52  // {
53  // QByteArray data;
54  // QDataStream qdsi(&data, QIODevice::ReadWrite);
55  // serializeQDataStream(ar, qdsi);
56  // qdsi >> qha;
57  // }
58  // else if (ar.isWrite())
59  // {
60  // QByteArray data;
61  // QDataStream qdso(&data, QIODevice::ReadWrite);
62  // qdso << qha;
63  // serializeQDataStream(ar, qdso);
64  // }
65  //}
66 
67 } // namespace SF
68 
69 #endif // ! INCLUDE_SF_QHOSTADDRESS_HPP
Represents an archive, in which serialized objects are stored.
Definition: Archive.hpp:31
Definition: ByteBuffer.hpp:188
bool isWrite() const
Returns true if this archive is being written to.
bool isRead() const
Returns true if this archive is being read from.