acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
buffer.h
1
3//#pragma once
4//
5//
6//namespace file
7//{
8//
9//
10// template <class T>
11// class buffer :
12// virtual public raw_array < T >
13// {
14// public:
15//
16//
17// buffer()
18// {
19//
20// }
21//
22// buffer(const buffer & buffer) :
23// raw_array < T > (buffer)
24// {
25//
26// }
27//
28// buffer(memsize size)
29// {
30//
31// SetCapacity(size);
32//
33// }
34//
35// virtual ~buffer()
36// {
37//
38// }
39//
40// operator T *()
41// {
42//
43// return this->get_data();
44//
45// }
46//
47// operator const T *() const
48// {
49//
50// return this->get_data();
51//
52// }
53//
54//
55// memsize GetCapacity() const
56// {
57//
58// return this->get_size();
59//
60// }
61//
62// void SetCapacity(memsize newCapacity)
63// {
64//
65// this->allocate(newCapacity);
66//
67// }
68//
69// buffer & operator = (const buffer &buffer)
70// {
71//
72// SetCapacity(buffer.GetCapacity());
73//
74// if (buffer.GetCapacity() > 0)
75// {
76// ::memory_copy(this->get_data(), buffer.get_data(), buffer.GetCapacity() * sizeof(T));
77// }
78//
79// return *this;
80//
81// }
82//
83//
84// bool operator == (const buffer < T > & b) const
85// {
86//
87// if(this->GetCapacity() != b.GetCapacity())
88// return false;
89//
90// for (memsize i = 0; i < this->GetCapacity(); i++)
91// if (this->operator[](i) != b[i])
92// return false;
93//
94// return true;
95//
96// }
97//
98//
99// bool operator != (const buffer < T > & b) const
100// {
101// return !(*this == b);
102// }
103//
104// };
105//
106//
107//
108// typedef CLASS_DECL_ACME buffer < ::i8 > char_buffer;
109// typedef CLASS_DECL_ACME buffer < unichar > wchar_buffer;
110// typedef CLASS_DECL_ACME buffer < ::u8 > byte_buffer;
111//
112//
113//} // namespace file