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