TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fmt::Buffer< T > Class Template Referenceabstract

#include <format.h>

Public Member Functions

virtual ~Buffer ()
 
std::size_t size () const
 
std::size_t capacity () const
 
void resize (std::size_t new_size)
 
void reserve (std::size_t capacity)
 
void clear () FMT_NOEXCEPT
 
void push_back (const T &value)
 
template<typename U >
void append (const U *begin, const U *end)
 
T & operator[] (std::size_t index)
 
const T & operator[] (std::size_t index) const
 

Protected Member Functions

 Buffer (T *ptr=0, std::size_t capacity=0)
 
virtual void grow (std::size_t size)=0
 

Protected Attributes

T * ptr_
 
std::size_t size_
 
std::size_t capacity_
 

Private Member Functions

 FMT_DISALLOW_COPY_AND_ASSIGN (Buffer)
 

Detailed Description

template<typename T>
class fmt::Buffer< T >

A buffer supporting a subset of std::vector's operations.

Constructor & Destructor Documentation

template<typename T>
fmt::Buffer< T >::Buffer ( T *  ptr = 0,
std::size_t  capacity = 0 
)
inlineprotected
591  : ptr_(ptr), size_(0), capacity_(capacity) {}
std::size_t size_
Definition: format.h:587
std::size_t capacity() const
Definition: format.h:608
T * ptr_
Definition: format.h:586
std::size_t capacity_
Definition: format.h:588
template<typename T>
virtual fmt::Buffer< T >::~Buffer ( )
inlinevirtual
602 {}

Member Function Documentation

template<typename T >
template<typename U >
void fmt::Buffer< T >::append ( const U *  begin,
const U *  end 
)

Appends data to the end of the buffer.

647  {
648  std::size_t new_size = size_ + internal::to_unsigned(end - begin);
649  if (new_size > capacity_)
650  grow(new_size);
651  std::uninitialized_copy(begin, end,
653  size_ = new_size;
654 }
std::size_t size_
Definition: format.h:587
T * make_ptr(T *ptr, std::size_t)
Definition: format.h:571
virtual void grow(std::size_t size)=0
MakeUnsigned< Int >::Type to_unsigned(Int value)
Definition: format.h:554
T * ptr_
Definition: format.h:586
std::size_t capacity_
Definition: format.h:588

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename T>
std::size_t fmt::Buffer< T >::capacity ( ) const
inline

Returns the capacity of this buffer.

608 { return capacity_; }
std::size_t capacity_
Definition: format.h:588

+ Here is the caller graph for this function:

template<typename T>
void fmt::Buffer< T >::clear ( )
inline
629 { size_ = 0; }
std::size_t size_
Definition: format.h:587

+ Here is the caller graph for this function:

template<typename T>
fmt::Buffer< T >::FMT_DISALLOW_COPY_AND_ASSIGN ( Buffer< T >  )
private
template<typename T>
virtual void fmt::Buffer< T >::grow ( std::size_t  size)
protectedpure virtual

Increases the buffer capacity to hold at least size elements updating ptr_ and capacity_.

Implemented in fmt::internal::FixedBuffer< Char >, fmt::internal::MemoryBuffer< T, SIZE, Allocator >, and fmt::internal::MemoryBuffer< Char, internal::INLINE_BUFFER_SIZE, Allocator >.

template<typename T>
T& fmt::Buffer< T >::operator[] ( std::size_t  index)
inline
641 { return ptr_[index]; }
T * ptr_
Definition: format.h:586
template<typename T>
const T& fmt::Buffer< T >::operator[] ( std::size_t  index) const
inline
642 { return ptr_[index]; }
T * ptr_
Definition: format.h:586
template<typename T>
void fmt::Buffer< T >::push_back ( const T &  value)
inline
631  {
632  if (size_ == capacity_)
633  grow(size_ + 1);
634  ptr_[size_++] = value;
635  }
std::size_t size_
Definition: format.h:587
virtual void grow(std::size_t size)=0
T * ptr_
Definition: format.h:586
std::size_t capacity_
Definition: format.h:588
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the caller graph for this function:

template<typename T>
void fmt::Buffer< T >::reserve ( std::size_t  capacity)
inline

Reserves space to store at least capacity elements.

624  {
625  if (capacity > capacity_)
626  grow(capacity);
627  }
std::size_t capacity() const
Definition: format.h:608
virtual void grow(std::size_t size)=0
std::size_t capacity_
Definition: format.h:588

+ Here is the caller graph for this function:

template<typename T>
void fmt::Buffer< T >::resize ( std::size_t  new_size)
inline

Resizes the buffer. If T is a POD type new elements may not be initialized.

613  {
614  if (new_size > capacity_)
615  grow(new_size);
616  size_ = new_size;
617  }
std::size_t size_
Definition: format.h:587
virtual void grow(std::size_t size)=0
std::size_t capacity_
Definition: format.h:588

+ Here is the caller graph for this function:

template<typename T>
std::size_t fmt::Buffer< T >::size ( ) const
inline

Returns the size of this buffer.

605 { return size_; }
std::size_t size_
Definition: format.h:587

+ Here is the caller graph for this function:

Member Data Documentation

template<typename T>
std::size_t fmt::Buffer< T >::capacity_
protected
template<typename T>
T* fmt::Buffer< T >::ptr_
protected
template<typename T>
std::size_t fmt::Buffer< T >::size_
protected

The documentation for this class was generated from the following file: