Samchon Framework for CPP  1.0.0
ByteArray.cpp
1 #include <samchon/ByteArray.hpp>
2 
3 using namespace std;
4 using namespace samchon;
5 
6 /* --------------------------------------------------------------
7  CONSTRUCTORS
8 -------------------------------------------------------------- */
9 ByteArray::ByteArray()
10  : super()
11 {
12  this->position = 0;
13 }
15  : super(byteArray)
16 {
17  this->position = position;
18 }
20  : super(move(byteArray))
21 {
22  this->position = byteArray.position;
23  byteArray.position = 0;
24 }
25 
26 // SEMI-CONSTRUCTORS
27 auto ByteArray::operator=(const ByteArray &byteArray) -> ByteArray&
28 {
29  assign(byteArray.begin(), byteArray.end());
30  position = byteArray.position;
31 
32  return *this;
33 }
34 
35 auto ByteArray::operator=(ByteArray &&byteArray) -> ByteArray&
36 {
37  super::operator=(move(byteArray));
38  position = byteArray.position;
39 
40  return *this;
41 }
42 
43 /* --------------------------------------------------------------
44  POSITION
45 -------------------------------------------------------------- */
46 auto ByteArray::getPosition() const -> size_t
47 {
48  return position;
49 }
50 void ByteArray::setPosition(size_t val)
51 {
52  this->position = val;
53 }
54 
55 auto ByteArray::leftSize() const -> size_t
56 {
57  return size() - position;
58 }
59 
60 /* --------------------------------------------------------------
61  COMPRESS & DECOMPRESS
62 -------------------------------------------------------------- */
64 {
65  return {};
66 }
68 {
69  return {};
70 }
size_t position
Current position of the ByteArray. .
Definition: ByteArray.hpp:43
auto getPosition() const -> size_t
Get position.
Definition: ByteArray.cpp:46
Definition: RWMutex.hpp:4
auto compress() const -> ByteArray
Compress the binary data .
Definition: ByteArray.cpp:63
ByteArray()
Default Constructor.
Definition: ByteArray.cpp:9
Binary data class.
Definition: ByteArray.hpp:30
void setPosition(size_t)
Set poisition.
Definition: ByteArray.cpp:50
auto decompress() const -> ByteArray
Decompress the binary data.
Definition: ByteArray.cpp:67
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7