Remote Call Framework 3.2
Encoding.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2020, 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.2
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18 
19 #ifndef INCLUDE_SF_ENCODING_HPP
20 #define INCLUDE_SF_ENCODING_HPP
21 
22 #include <RCF/ByteBuffer.hpp>
23 #include <RCF/ByteOrdering.hpp>
24 #include <RCF/Exception.hpp>
25 
26 #include <SF/DataPtr.hpp>
27 #include <RCF/Tools.hpp>
28 
29 namespace SF {
30 
31  // Binary encoding/decoding of bool, int and string. Mostly used by RCF, but
32  // also by SF to encode version numbers into archives.
33 
34  RCF_EXPORT
35  void encodeBool(
36  bool value,
37  std::vector<char> & vec,
38  std::size_t & pos);
39 
40  RCF_EXPORT
41  void encodeInt(
42  int value,
43  std::vector<char> & vec,
44  std::size_t & pos);
45 
46  RCF_EXPORT
47  void encodeString(
48  const std::string & value,
49  std::vector<char> & vec,
50  std::size_t & pos);
51 
52  RCF_EXPORT
53  void encodeByteBuffer(
54  RCF::ByteBuffer value,
55  std::vector<char> & vec,
56  std::size_t & pos);
57 
58  RCF_EXPORT
59  void encodeBool(
60  bool value,
61  const RCF::ByteBuffer & byteBuffer,
62  std::size_t & pos);
63 
64  RCF_EXPORT
65  void encodeInt(
66  int value,
67  const RCF::ByteBuffer & byteBuffer,
68  std::size_t & pos);
69 
70  RCF_EXPORT
71  void encodeString(
72  const std::string & value,
73  const RCF::ByteBuffer & byteBuffer,
74  std::size_t & pos);
75 
76  RCF_EXPORT
77  void decodeBool(
78  bool & value,
79  const RCF::ByteBuffer & byteBuffer,
80  std::size_t & pos);
81 
82  RCF_EXPORT
83  void decodeInt(
84  int & value,
85  const RCF::ByteBuffer & byteBuffer,
86  std::size_t & pos);
87 
88  RCF_EXPORT
89  void decodeInt(
90  std::uint32_t & value,
91  const RCF::ByteBuffer & byteBuffer,
92  std::size_t & pos);
93 
94  RCF_EXPORT
95  void decodeString(
96  std::string & value,
97  const RCF::ByteBuffer & byteBuffer,
98  std::size_t & pos);
99 
100  RCF_EXPORT
101  void decodeByteBuffer(
102  RCF::ByteBuffer & value,
103  const RCF::ByteBuffer & byteBuffer,
104  std::size_t & pos);
105 
106 } // namespace SF
107 
108 #endif // !INCLUDE_SF_ENCODING_HPP
Definition: ByteBuffer.hpp:189
Definition: ByteBuffer.hpp:40