EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Buffer.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Bloody.Rabbit
24 */
25 
26 #ifndef __UTILS__BUFFER_H__INCL__
27 #define __UTILS__BUFFER_H__INCL__
28 
29 #include "utils/misc.h"
30 #include "memory/SafeMem.h"
31 
40 class Buffer
41 {
42 public:
44  typedef size_t size_type;
45 
51  template< typename T >
53  : public std::iterator< std::random_access_iterator_tag, T >
54  {
56  typedef std::iterator< std::random_access_iterator_tag, T > _Base;
57 
58  public:
60  typedef typename _Base::iterator_category iterator_category;
62  typedef typename _Base::value_type value_type;
64  typedef typename _Base::difference_type difference_type;
66  typedef typename _Base::pointer pointer;
68  typedef typename _Base::reference reference;
69 
71  typedef const T* const_pointer;
73  typedef const T& const_reference;
74 
81  const_iterator( const Buffer* buffer = NULL, size_type index = 0 )
82  : mIndex( index ),
83  mBuffer( buffer )
84  {
85  }
88  : mIndex( oth.mIndex ),
89  mBuffer( oth.mBuffer )
90  {
91  }
92 
95  {
96  mIndex = oth.mIndex;
97  mBuffer = oth.mBuffer;
98  return *this;
99  }
100 
107  template< typename T2 >
109 
111  const_reference operator*() const
112  {
113  // make sure we have valid buffer
114  assert( mBuffer );
115  // make sure we're not going off the bounds
116  assert( 1 <= mBuffer->end< value_type >() - *this );
117 
118  // obtain the value and return
119  return *(const_pointer)&( mBuffer->mBuffer )[ mIndex ];
120  }
122  const_pointer operator->() const { return &**this; }
124  const_reference operator[]( difference_type diff ) const { return *( *this + diff ); }
125 
127  const_iterator operator+( difference_type diff ) const
128  {
129  const_iterator res( *this );
130  return ( res += diff );
131  }
133  const_iterator& operator+=( difference_type diff )
134  {
135  // turn the diff into byte diff
136  const difference_type res = ( diff * sizeof( value_type ) );
137 
138  // make sure we have valid buffer
139  assert( mBuffer );
140  // make sure we won't go negative
141  assert( 0 <= mIndex + res );
142  // make sure we won't go past end
143  assert( mIndex + res <= mBuffer->size() );
144 
145  // set new index
146  mIndex += res;
147 
148  return *this;
149  }
151  const_iterator& operator++() { return ( *this += 1 ); }
154  {
155  const_iterator res( *this );
156  ++*this;
157  return res;
158  }
159 
161  const_iterator operator-( difference_type diff ) const
162  {
163  const_iterator res( *this );
164  return ( res -= diff );
165  }
167  const_iterator& operator-=( difference_type diff ) { return ( *this += ( -diff ) ); }
169  const_iterator& operator--() { return ( *this -= 1 ); }
172  {
173  const_iterator res( *this );
174  --*this;
175  return res;
176  }
177 
179  difference_type operator-( const const_iterator& oth ) const
180  {
181  // make sure we have same parent buffer
182  assert( oth.mBuffer == mBuffer );
183  // return difference in element offset
184  return ( ( mIndex - oth.mIndex ) / sizeof( value_type ) );
185  }
186 
188  bool operator==( const const_iterator& oth ) const
189  {
190  // make sure we have same parent buffer
191  assert( oth.mBuffer == mBuffer );
192  // return the result
193  return ( mIndex == oth.mIndex );
194  }
196  bool operator!=( const const_iterator& oth ) const { return !( *this == oth ); }
197 
199  bool operator<( const const_iterator& oth ) const
200  {
201  // make sure we have same parent buffer
202  assert( oth.mBuffer == mBuffer );
203  // return the result
204  return ( mIndex < oth.mIndex );
205  }
207  bool operator>( const const_iterator& oth ) const
208  {
209  // make sure we have same parent buffer
210  assert( oth.mBuffer == mBuffer );
211  // return the result
212  return ( mIndex > oth.mIndex );
213  }
215  bool operator<=( const const_iterator& oth ) const { return !( *this > oth ); }
217  bool operator>=( const const_iterator& oth ) const { return !( *this < oth ); }
218 
219  protected:
221  size_type mIndex;
223  const Buffer* mBuffer;
224  };
225 
231  template< typename T >
232  class iterator
233  : public const_iterator< T >
234  {
237 
238  public:
242  typedef typename _Base::value_type value_type;
246  typedef typename _Base::pointer pointer;
250  typedef typename _Base::reference reference;
253 
260  iterator( Buffer* buffer = NULL, size_type index = 0 ) : _Base( buffer, index ) {}
262  iterator( const iterator& oth ) : _Base( oth ) {}
263 
265  iterator& operator=( const iterator& oth ) { *(_Base*)this = oth; return *this; }
266 
273  template< typename T2 >
275 
277  reference operator*() const { return const_cast< reference >( **(_Base*)this ); }
279  pointer operator->() const { return &**this; }
281  reference operator[]( difference_type diff ) const { return *( *this + diff ); }
282 
284  iterator operator+( difference_type diff ) const
285  {
286  iterator res( *this );
287  return ( res += diff );
288  }
290  iterator operator+=( difference_type diff ) { *(_Base*)this += diff; return *this; }
292  iterator& operator++() { ++*(_Base*)this; return *this; }
295  {
296  iterator res( *this );
297  ++*this;
298  return res;
299  }
300 
302  iterator operator-( difference_type diff ) const
303  {
304  iterator res( *this );
305  return ( res -= diff );
306  }
308  iterator& operator-=( difference_type diff ) { *(_Base*)this -= diff; return *this; }
310  iterator& operator--() { --*(_Base*)this; return *this; }
313  {
314  iterator res( *this );
315  --*this;
316  return res;
317  }
318 
320  difference_type operator-( const _Base& oth ) const { return ( *(_Base*)this - oth ); }
321  };
322 
332  Buffer( size_type len = 0, const uint8& fill = 0 )
333  : mBuffer( NULL ),
334  mSize( 0 ),
335  mCapacity( 0 )
336  {
337  /* unfortunately, we cannot use template here
338  since it's not possible to explicitly instantiate
339  constructor .... assuming uint8 */
340  Resize< uint8 >( len, fill );
341  }
351  template< typename Iter >
352  Buffer( Iter first, Iter last )
353  : mBuffer( NULL ),
354  mSize( 0 ),
355  mCapacity( 0 )
356  {
357  // assign the content
358  AssignSeq( first, last );
359  }
361  Buffer( const Buffer& oth )
362  : mBuffer( NULL ),
363  mSize( 0 ),
364  mCapacity( 0 )
365  {
366  // Use assignment operator
367  *this = oth;
368  }
371  {
372  // Free buffer
373  SafeFree( mBuffer );
374  }
375 
376  /********************************************************************/
377  /* Read methods */
378  /********************************************************************/
380  template< typename T >
381  iterator< T > begin() { return iterator< T >( this, 0 ); }
383  template< typename T >
384  const_iterator< T > begin() const { return const_iterator< T >( this, 0 ); }
386  template< typename T >
387  iterator< T > end() { return iterator< T >( this, size() ); }
389  template< typename T >
390  const_iterator< T > end() const { return const_iterator< T >( this, size() ); }
391 
399  template< typename T >
400  T& Get( size_type index ) { return *( begin< T >() + index ); }
408  template< typename T >
409  const T& Get( size_type index ) const { return *( begin< T >() + index ); }
410 
418  uint8& operator[]( size_type index ) { return Get< uint8 >( index ); }
426  const uint8& operator[]( size_type index ) const { return Get< uint8 >( index ); }
427 
428  /********************************************************************/
429  /* Write methods */
430  /********************************************************************/
436  template< typename T >
437  void Append( const T& value )
438  {
439  // we wish to append to the end
440  const const_iterator< T > index = end< T >();
441 
442  // make enough room; we're going to fill the gap immediately
443  _ResizeAt< T >( index, 1 );
444 
445  // assign the value, filling the gap
446  AssignAt< T >( index, value );
447  }
454  template< typename Iter >
455  void AppendSeq( Iter first, Iter last )
456  {
457  // we wish to append to the end
459  index = end< typename std::iterator_traits< Iter >::value_type >();
460 
461  // make enough room; we're going to fill the gap immediately
462  _ResizeAt< typename std::iterator_traits< Iter >::value_type >( index, last - first );
463 
464  // assign the value, filling the gap
465  AssignSeqAt< Iter >( index, first, last );
466  }
467 
473  template< typename T >
474  void Assign( const T& value )
475  {
476  // we wish to assign to beginning
477  const const_iterator< T > index = begin< T >();
478 
479  // do we have enough space?
480  if( 1 <= end< T >() - index )
481  {
482  // yes, we do: assign the value
483  AssignAt< T >( index, value );
484 
485  // shrink the buffer; no gap will be created
486  _ResizeAt< T >( index, 1 );
487  }
488  else
489  {
490  // no, we don't: make enough room; we're going to fill the gap immediately
491  _ResizeAt< T >( index, 1 );
492 
493  // assign the value, filling the gap
494  AssignAt< T >( index, value );
495  }
496  }
503  template< typename Iter >
504  void AssignSeq( Iter first, Iter last )
505  {
506  // we wish to assign to beginning
508  index = begin< typename std::iterator_traits< Iter >::value_type >();
509 
510  // do we have enough space?
511  if( last - first <= end< typename std::iterator_traits< Iter >::value_type >() - index )
512  {
513  // yes, we do: assign the value
514  AssignSeqAt< Iter >( index, first, last );
515 
516  // shrink the buffer; no gap will be created
517  _ResizeAt< typename std::iterator_traits< Iter >::value_type >( index, last - first );
518  }
519  else
520  {
521  // no, we don't: make enough room; we're going to fill the gap immediately
522  _ResizeAt< typename std::iterator_traits< Iter >::value_type >( index, last - first );
523 
524  // assign the value, filling the gap
525  AssignSeqAt< Iter >( index, first, last );
526  }
527  }
528 
535  template< typename T >
536  void AssignAt( const_iterator< T > index, const T& value )
537  {
538  // make sure we're not going off the bounds
539  assert( 1 <= end< T >() - index );
540 
541  // turn iterator into byte offset
542  const size_type _index = ( index.template As< uint8 >() - begin< uint8 >() );
543  // assign the value
544  *(T*)&mBuffer[ _index ] = value;
545  }
553  template< typename Iter >
554  void AssignSeqAt( const_iterator< typename std::iterator_traits< Iter >::value_type > index, Iter first, Iter last )
555  {
556  // make sure we're not going off the bounds
557  assert( last - first <= end< typename std::iterator_traits< Iter >::value_type >() - index );
558 
559  // is there anything to assign?
560  if( first != last )
561  {
562  // turn the iterator into byte offset
563  const size_type _index = ( index.template As< uint8 >() - begin< uint8 >() );
564  // obtain byte length of input data
565  const size_type _len = sizeof( typename std::iterator_traits< Iter >::value_type ) * ( last - first );
566  // assign the content
567  memmove( &mBuffer[ _index ], &*first, _len );
568  }
569  }
570 
576  template< typename T >
577  Buffer& operator<<( const T& value )
578  {
579  // append the value
580  Append< T >( value );
581  // return ourselves
582  return *this;
583  }
589  template< typename T >
590  Buffer& operator=( const T& value )
591  {
592  // assign the value
593  Assign< T >( value );
594  // return ourselves
595  return *this;
596  }
598  Buffer& operator=( const Buffer& value )
599  {
600  // assign new content
601  AssignSeq( value.begin< uint8 >(), value.end< uint8 >() );
602  // return ourselves
603  return *this;
604  }
605 
606  /********************************************************************/
607  /* Size methods */
608  /********************************************************************/
610  size_type size() const { return mSize; }
612  size_type capacity() const { return mCapacity; }
613 
625  template< typename T >
626  void Reserve( size_type requiredCount )
627  {
628  // reserve at beginning
629  ReserveAt< T >( begin< T >(), requiredCount );
630  }
631 
644  template< typename T >
645  void ReserveAt( const_iterator< T > index, size_type requiredCount )
646  {
647  // make sure we're not going off the bounds
648  assert( index <= end< T >() );
649 
650  // turn iterator into byte offset
651  const size_type _index = ( index.template As< uint8 >() - begin< uint8 >() );
652  // obtain required size in bytes
653  const size_type _requiredSize = sizeof( T ) * requiredCount;
654 
655  // reallocate if necessary
656  if( _index + _requiredSize > capacity() )
657  _Reallocate( _index + _requiredSize );
658  }
659 
669  template< typename T >
670  void Resize( size_type requiredCount, const uint8& fill = 0 )
671  {
672  // Resize at beginning
673  ResizeAt< T >( begin< T >(), requiredCount, fill );
674  }
675 
687  template< typename T >
688  void ResizeAt( const_iterator< T > index, size_type requiredCount, const uint8& fill = 0 )
689  {
690  // make sure we're not going off the bounds
691  assert( index <= end< T >() );
692 
693  // keep old size
694  const size_type _oldSize = size();
695  // do actual resize
696  _ResizeAt< T >( index, requiredCount );
697 
698  // turn iterator into byte offset
699  const size_type _index = ( index.template As< uint8 >() - begin< uint8 >() );
700  // obtain required size in bytes
701  const size_type _requiredSize = sizeof( T ) * requiredCount;
702 
703  // has a gap been created?
704  if( _index + _requiredSize > _oldSize )
705  // fill it with value
706  memset( &mBuffer[ _oldSize ], fill, _index + _requiredSize - _oldSize );
707  }
708 
709 protected:
713  size_type mSize;
715  size_type mCapacity;
716 
724  template< typename T >
725  void _Resize( size_type requiredCount )
726  {
727  // resize at beginning
728  _ResizeAt< T >( begin< T >(), requiredCount );
729  }
730 
739  template< typename T >
740  void _ResizeAt( const_iterator< T > index, size_type requiredCount )
741  {
742  // make sure we're not going off the bounds
743  assert( index <= end< T >() );
744 
745  // turn index into byte offset
746  const size_type _index = ( index.template As< uint8 >() - begin< uint8 >() );
747  // obtain required size in bytes
748  const size_type _requiredSize = sizeof( T ) * requiredCount;
749 
750  // reallocate
751  _Reallocate( _index + _requiredSize );
752  // set new size
753  mSize = ( _index + _requiredSize );
754  }
755 
763  void _Reallocate( size_type requiredSize )
764  {
765  // calculate new capacity for required size
766  size_type newCapacity = _CalcBufferCapacity( capacity(), requiredSize );
767  // make sure new capacity is bigger than required size
768  assert( requiredSize <= newCapacity );
769 
770  // has the capacity changed?
771  if( newCapacity != capacity() )
772  {
773  // reallocate
774  mBuffer = (uint8*)realloc( mBuffer, newCapacity );
775  // set new capacity
776  mCapacity = newCapacity;
777  }
778  }
779 
791  static size_type _CalcBufferCapacity( size_type currentCapacity, size_type requiredSize )
792  {
793  size_type newCapacity = 0;
794 
795  // if more than 0x100 bytes required, return next power of 2
796  if( 0x100 < requiredSize )
797  newCapacity = (size_type)npowof2( requiredSize );
798  // else if non-zero, return 0x100 bytes
799  else if( 0 < requiredSize )
800  newCapacity = 0x100;
801  // else return 0 bytes
802 
803  /* if current capacity is sufficient and at the same time smaller
804  than the new capacity, return current one ... saves resources */
805  if( requiredSize <= currentCapacity && currentCapacity < newCapacity )
806  return currentCapacity;
807  else
808  return newCapacity;
809  }
810 };
811 
812 #endif /* !__UTILS__BUFFER_H__INCL__ */
void Append(const T &value)
Appends a single value to buffer.
Definition: Buffer.h:437
void ResizeAt(const_iterator< T > index, size_type requiredCount, const uint8 &fill=0)
Resizes buffer.
Definition: Buffer.h:688
unsigned __int8 uint8
Definition: eve-compat.h:46
const_reference operator[](difference_type diff) const
Subscript operator.
Definition: Buffer.h:124
_Base::const_reference const_reference
Typedef for const reference.
Definition: Buffer.h:252
iterator & operator++()
Preincrement operator.
Definition: Buffer.h:292
size_type mSize
Current size of buffer, in bytes.
Definition: Buffer.h:713
iterator & operator--()
Predecrement operator.
Definition: Buffer.h:310
const_iterator & operator=(const const_iterator &oth)
Copy operator.
Definition: Buffer.h:94
static size_type _CalcBufferCapacity(size_type currentCapacity, size_type requiredSize)
Calculates buffer capacity.
Definition: Buffer.h:791
const_iterator< T > begin() const
Definition: Buffer.h:384
Buffer & operator=(const Buffer &value)
Copy operator.
Definition: Buffer.h:598
const T * const_pointer
Typedef for const pointer.
Definition: Buffer.h:71
std::iterator< std::random_access_iterator_tag, T > _Base
Typedef for our base due to readibility.
Definition: Buffer.h:56
_Base::iterator_category iterator_category
Typedef for iterator category.
Definition: Buffer.h:240
const Buffer * mBuffer
The parent Buffer.
Definition: Buffer.h:223
const T & Get(size_type index) const
Gets const element from buffer.
Definition: Buffer.h:409
size_t size_type
Typedef for size type.
Definition: Buffer.h:44
~Buffer()
Destructor; deletes buffer.
Definition: Buffer.h:370
_Base::value_type value_type
Typedef for value type.
Definition: Buffer.h:242
void AssignAt(const_iterator< T > index, const T &value)
Assigns a single value to buffer at specific point.
Definition: Buffer.h:536
pointer operator->() const
Dereference operator.
Definition: Buffer.h:279
iterator & operator=(const iterator &oth)
Copy operator.
Definition: Buffer.h:265
iterator(Buffer *buffer=NULL, size_type index=0)
Default constructor.
Definition: Buffer.h:260
const_iterator(const Buffer *buffer=NULL, size_type index=0)
Default constructor.
Definition: Buffer.h:81
void ReserveAt(const_iterator< T > index, size_type requiredCount)
Reserves (pre-allocates) memory for buffer at specific point.
Definition: Buffer.h:645
reference operator[](difference_type diff) const
Subscript operator.
Definition: Buffer.h:281
uint8 * mBuffer
Pointer to start of buffer.
Definition: Buffer.h:711
Buffer(Iter first, Iter last)
Creates buffer with given content.
Definition: Buffer.h:352
const_iterator operator+(difference_type diff) const
Sum operator.
Definition: Buffer.h:127
_Base::const_pointer const_pointer
Typedef for const pointer.
Definition: Buffer.h:248
const_iterator< T2 > As() const
Converts const_iterator to another const_iterator with different type.
Definition: Buffer.h:108
const_iterator< T > end() const
Definition: Buffer.h:390
iterator operator+(difference_type diff) const
Sum operator.
Definition: Buffer.h:284
void SafeFree(T *&p)
Frees and nullifies an array pointer.
Definition: SafeMem.h:111
iterator< T > begin()
Definition: Buffer.h:381
_Base::difference_type difference_type
Typedef for difference type.
Definition: Buffer.h:244
void _Reallocate(size_type requiredSize)
Reallocates buffer.
Definition: Buffer.h:763
int64 npowof2(int64 num)
Calculates next (greater or equal) power-of-two number.
Definition: misc.cpp:95
_Base::pointer pointer
Typedef for pointer.
Definition: Buffer.h:66
Generic class for buffers.
Definition: Buffer.h:40
Buffer(size_type len=0, const uint8 &fill=0)
Creates buffer of given length.
Definition: Buffer.h:332
void AppendSeq(Iter first, Iter last)
Appends a sequence of elements to buffer.
Definition: Buffer.h:455
const_iterator & operator+=(difference_type diff)
Add operator.
Definition: Buffer.h:133
bool operator==(const const_iterator &oth) const
Equal operator.
Definition: Buffer.h:188
Buffer & operator<<(const T &value)
Appends a value to buffer.
Definition: Buffer.h:577
iterator & operator-=(difference_type diff)
Subtract operator.
Definition: Buffer.h:308
Buffer(const Buffer &oth)
Copy constructor.
Definition: Buffer.h:361
iterator operator--(int)
Postdecrement operator.
Definition: Buffer.h:312
iterator operator++(int)
Postincrement operator.
Definition: Buffer.h:294
_Base::difference_type difference_type
Typedef for difference type.
Definition: Buffer.h:64
const_iterator(const const_iterator &oth)
Copy constructor.
Definition: Buffer.h:87
bool operator>=(const const_iterator &oth) const
Greater-equal operator.
Definition: Buffer.h:217
void Resize(size_type requiredCount, const uint8 &fill=0)
Resizes buffer.
Definition: Buffer.h:670
const_pointer operator->() const
Dereference operator.
Definition: Buffer.h:122
const_reference operator*() const
Dereference operator.
Definition: Buffer.h:111
void _ResizeAt(const_iterator< T > index, size_type requiredCount)
Resizes buffer.
Definition: Buffer.h:740
bool operator!=(const const_iterator &oth) const
Non-equal operator.
Definition: Buffer.h:196
iterator< T2 > As() const
Converts iterator to another iterator with different type.
Definition: Buffer.h:274
size_type mCapacity
Current capacity of buffer, in bytes.
Definition: Buffer.h:715
void Reserve(size_type requiredCount)
Reserves (pre-allocates) memory for buffer.
Definition: Buffer.h:626
const uint8 & operator[](size_type index) const
Overload of const access operator[].
Definition: Buffer.h:426
bool operator<=(const const_iterator &oth) const
Less-equal operator.
Definition: Buffer.h:215
const_iterator< T > _Base
Typedef for our base due to readibility.
Definition: Buffer.h:236
_Base::value_type value_type
Typedef for value type.
Definition: Buffer.h:62
void _Resize(size_type requiredCount)
Resizes buffer.
Definition: Buffer.h:725
difference_type operator-(const _Base &oth) const
Diff operator.
Definition: Buffer.h:320
const_iterator & operator--()
Predecrement operator.
Definition: Buffer.h:169
const_iterator operator++(int)
Postincrement operator.
Definition: Buffer.h:153
void Assign(const T &value)
Assigns a single value to buffer.
Definition: Buffer.h:474
_Base::pointer pointer
Typedef for pointer.
Definition: Buffer.h:246
_Base::reference reference
Typedef for reference.
Definition: Buffer.h:68
Buffer & operator=(const T &value)
Assigns new value to buffer.
Definition: Buffer.h:590
bool operator<(const const_iterator &oth) const
Less-than operator.
Definition: Buffer.h:199
size_type size() const
Definition: Buffer.h:610
bool operator>(const const_iterator &oth) const
Greater-than operator.
Definition: Buffer.h:207
_Base::reference reference
Typedef for reference.
Definition: Buffer.h:250
const_iterator & operator++()
Preincrement operator.
Definition: Buffer.h:151
iterator operator-(difference_type diff) const
Diff operator.
Definition: Buffer.h:302
difference_type operator-(const const_iterator &oth) const
Diff operator.
Definition: Buffer.h:179
void AssignSeq(Iter first, Iter last)
Assigns a sequence of elements to buffer.
Definition: Buffer.h:504
T & Get(size_type index)
Gets element from buffer.
Definition: Buffer.h:400
const_iterator operator--(int)
Postdecrement operator.
Definition: Buffer.h:171
iterator(const iterator &oth)
Copy constructor.
Definition: Buffer.h:262
size_type capacity() const
Definition: Buffer.h:612
reference operator*() const
Dereference operator.
Definition: Buffer.h:277
_Base::iterator_category iterator_category
Typedef for iterator category.
Definition: Buffer.h:60
Buffer's const iterator.
Definition: Buffer.h:52
void AssignSeqAt(const_iterator< typename std::iterator_traits< Iter >::value_type > index, Iter first, Iter last)
Assigns a sequence of elements to buffer at specific point.
Definition: Buffer.h:554
Buffer's iterator.
Definition: Buffer.h:232
iterator operator+=(difference_type diff)
Add operator.
Definition: Buffer.h:290
size_type mIndex
Index in buffer, in bytes.
Definition: Buffer.h:221
iterator< T > end()
Definition: Buffer.h:387
uint8 & operator[](size_type index)
Overload of access operator[].
Definition: Buffer.h:418
const T & const_reference
Typedef for const reference.
Definition: Buffer.h:73
const_iterator & operator-=(difference_type diff)
Subtract operator.
Definition: Buffer.h:167
const_iterator operator-(difference_type diff) const
Diff operator.
Definition: Buffer.h:161