StrBuffer.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/core/base/StrBuffer.hpp"

StrBuffer

String buffer class.

namespace oatpp { namespace base { 
  class StrBuffer : public oatpp::base::Countable {}
}}

Methods

Return Type Name Summary
[none] StrBuffer Multiple implementations:
  1. Constructor. Default.
  2. Constructor.
[none] ~StrBuffer virtual Destructor.
std::shared_ptr<StrBuffer> createShared Multiple implementations:
  1. Create shared StrBuffer of specified size.
  2. Create shared StrBuffer with data, size, and copyAsOwnData parameters.
  3. Create shared StrBuffer with data, and copyAsOwnData parameters.
  4. Create shared StrBuffer from other StrBuffer.
std::shared_ptr<StrBuffer> createSharedConcatenated Create shared StrBuffer of size=size1 + size2 and data=data1 + data2.
std::shared_ptr<StrBuffer> createFromCString Create shared StrBuffer from c-string.
std::shared_ptr<StrBuffer> loadFromFile Load data from file and store in StrBuffer.
void saveToFile Save content of the buffer to file.
p_char8 getData Get pointer to data of the buffer.
v_int32 getSize Get buffer size.
const char* c_str Get pointer to data of the buffer as const* char.
std::string std_str Get copy of the buffer data as std::string.
bool hasOwnData Is this object is responsible for freeing buffer data.
std::shared_ptr<StrBuffer> toLowerCase Create lowercase copy of the buffer.
std::shared_ptr<StrBuffer> toUpperCase Create uppercase copy of the buffer.
bool equals Multiple implementations:
  1. Check string equality of the buffer to data of specified size.
  2. Check string equality of the buffer to data of specified size.
  3. Check string equality to other buffer.
  4. Check string equality of data1 to data2.
  5. Check string equality of data1 to data2.
  6. Check string equality of str1 to str2.
bool startsWith Multiple implementations:
  1. Check if buffer starts with specified data, size.
  2. Check if buffer starts with specified data.
  3. Check if buffer starts with specified data.
v_int32 compare Multiple implementations:
  1. Compare data1, data2 using std::memcmp.
  2. Compare data1, data2 using std::memcmp.
bool equalsCI Multiple implementations:
  1. Check Case Insensitive string equality of data1 to data2.
  2. Check Case Insensitive string equality of data1 to data2.
  3. Check Case Insensitive string equality of str1 to str2.
bool equalsCI_FAST Multiple implementations:
  1. Check Case Insensitive string equality of data1 to data2. (ASCII only, correct compare if one of strings contains letters only)
  2. Check Case Insensitive string equality of data1 to data2. (ASCII only, correct compare if one of strings contains letters only)
  3. Check Case Insensitive string equality of str1 to str2. (ASCII only, correct compare if one of strings contains letters only)
  4. Check Case Insensitive string equality of str1 to str2. (ASCII only, correct compare if one of strings contains letters only)
void lowerCase Change characters in data to lowercase.
void upperCase Change characters in data to uppercase.

StrBuffer::StrBuffer

  1. Constructor. Default.
    StrBuffer()
    
  2. Constructor.
    • @param data - pointer to data.
    • @param size - size of the data.
    • @param copyAsOwnData - if true then allocate own buffer and copy data to that buffer.
    StrBuffer(const void* data, v_int32 size, bool copyAsOwnData)
    

StrBuffer::~StrBuffer

virtual Destructor.

virtual ~StrBuffer()

StrBuffer::createShared

  1. Create shared StrBuffer of specified size.
    • @param size - size of the buffer.
    • @return - shared_ptr to StrBuffer.
    static std::shared_ptr<StrBuffer> createShared(v_int32 size)
    
  2. Create shared StrBuffer with data, size, and copyAsOwnData parameters.
    • @param data - buffer data.
    • @param size - size of the data.
    • @param copyAsOwnData - if true then allocate own buffer and copy data to that buffer.
    • @return - shared_ptr to StrBuffer.
    static std::shared_ptr<StrBuffer> createShared(const void* data, v_int32 size, bool copyAsOwnData = true)
    
  3. Create shared StrBuffer with data, and copyAsOwnData parameters.
    • @param data - buffer data.
    • @param copyAsOwnData - if true then allocate own buffer and copy data to that buffer.
    • @return - shared_ptr to StrBuffer.
    static std::shared_ptr<StrBuffer> createShared(const char* data, bool copyAsOwnData = true)
    
  4. Create shared StrBuffer from other StrBuffer.
    • @param other - other StrBuffer.
    • @param copyAsOwnData - if true then allocate own buffer and copy data to that buffer.
    • @return - shared_ptr to StrBuffer.
    static std::shared_ptr<StrBuffer> createShared(StrBuffer* other, bool copyAsOwnData = true)
    

StrBuffer::createSharedConcatenated

Create shared StrBuffer of size=size1 + size2 and data=data1 + data2.

  • @param data1 - pointer to data1.
  • @param size1 - size of the data1.
  • @param data2 - pointer to data2.
  • @param size2 - size of the data2.
  • @return - shared_ptr to StrBuffer.

static std::shared_ptr<StrBuffer> createSharedConcatenated(const void* data1, v_int32 size1, const void* data2, v_int32 size2)

StrBuffer::createFromCString

Create shared StrBuffer from c-string.

  • @param data - data.
  • @param copyAsOwnData - if true then allocate own buffer and copy data to that buffer.
  • @return - shared_ptr to StrBuffer.

static std::shared_ptr<StrBuffer> createFromCString(const char* data, bool copyAsOwnData = true)

StrBuffer::loadFromFile

Load data from file and store in StrBuffer.

  • @param filename - name of the file.
  • @return - shared_ptr to StrBuffer.

static std::shared_ptr<StrBuffer> loadFromFile(const char* filename)

StrBuffer::saveToFile

Save content of the buffer to file.

  • @param filename - name of the file.

void saveToFile(const char* filename)

StrBuffer::getData

Get pointer to data of the buffer.

  • @return - pointer to data of the buffer.

p_char8 getData() const

StrBuffer::getSize

Get buffer size.

  • @return - buffer size.

v_int32 getSize() const

StrBuffer::c_str

Get pointer to data of the buffer as const* char.

  • @return - pointer to data of the buffer.

const char* c_str() const

StrBuffer::std_str

Get copy of the buffer data as std::string.

  • @return - copy of the buffer data as std::string.

std::string std_str() const

StrBuffer::hasOwnData

Is this object is responsible for freeing buffer data.

  • @return - true if this object is responsible for freeing buffer data.

bool hasOwnData() const

StrBuffer::toLowerCase

Create lowercase copy of the buffer.
(correct for ASCII only)

  • @return - copy of the buffer containing lowercase variants of ascii symbols.

std::shared_ptr<StrBuffer> toLowerCase() const

StrBuffer::toUpperCase

Create uppercase copy of the buffer.
(correct for ASCII only)

  • @return - copy of the buffer containing uppercase variants of ascii symbols.

std::shared_ptr<StrBuffer> toUpperCase() const

StrBuffer::equals

  1. Check string equality of the buffer to data of specified size.
    • @param data - pointer to data to be compared with the buffer data.
    • @param size - size of the data.
    • @return - true if all chars of buffer are same as in data, and size == this.getSize().
    bool equals(const void* data, v_int32 size) const
    
  2. Check string equality of the buffer to data of specified size.
    • @param data - pointer to data to be compared with the buffer data.
    • @return - true if all chars of buffer are same as in data, and std::strlen(data) == this.getSize().
    bool equals(const char* data) const
    
  3. Check string equality to other buffer.
    • @param other - pointer to other StrBuffer to be compared with the buffer data.
    • @return - true if all chars of one buffer are same as in other, and other.getSize() == this.getSize().
    bool equals(StrBuffer* other) const
    
  4. Check string equality of data1 to data2.
    • @param data1 - pointer to data1.
    • @param data2 - pointer to data2.
    • @param size - number of characters to compare.
    • @return - true if equals.
    static bool equals(const void* data1, const void* data2, v_int32 size)
    
  5. Check string equality of data1 to data2.
    • @param data1 - pointer to data1.
    • @param data2 - pointer to data2.
    • @return - true if equals.
    static bool equals(const char* data1, const char* data2)
    
  6. Check string equality of str1 to str2.
    • @param str1 - pointer to str1.
    • @param str2 - pointer to str2.
    • @return - true if equals.
    static bool equals(StrBuffer* str1, StrBuffer* str2)
    

StrBuffer::startsWith

  1. Check if buffer starts with specified data, size.
    • @param data - data as const void*.
    • @param size - size of the data.
    • @return - true if buffer starts with specified data.
    bool startsWith(const void* data, v_int32 size) const
    
  2. Check if buffer starts with specified data.
    • @param data - data as const char*.
    • @return - true if buffer starts with specified data.
    bool startsWith(const char* data) const
    
  3. Check if buffer starts with specified data.
    • @param data - data as StrBuffer.
    • @return - true if buffer starts with specified data.
    bool startsWith(StrBuffer* data) const
    

StrBuffer::compare

  1. Compare data1, data2 using std::memcmp.
    • @param data1 - pointer to data1.
    • @param data2 - pointer to data2.
    • @param size - number of characters to compare.
    • @return - Negative value if the first differing byte (reinterpreted as unsigned char) in data1 is less than the corresponding byte in data2.
      ​0​ if all count bytes of data1 and data2 are equal.
      Positive value if the first differing byte in data1 is greater than the corresponding byte in data2.
    static v_int32 compare(const void* data1, const void* data2, v_int32 size)
    
  2. Compare data1, data2 using std::memcmp.
    • @param data1 - data1 as StrBuffer.
    • @param data2 - data2 as StrBuffer.
    • @return - Negative value if the first differing byte (reinterpreted as unsigned char) in data1 is less than the corresponding byte in data2.
      ​0​ if all count bytes of data1 and data2 are equal.
      Positive value if the first differing byte in data1 is greater than the corresponding byte in data2.
    static v_int32 compare(StrBuffer* data1, StrBuffer* data2)
    

StrBuffer::equalsCI

  1. Check Case Insensitive string equality of data1 to data2.
    • @param data1 - pointer to data1.
    • @param data2 - pointer to data2.
    • @param size - number of characters to compare.
    • @return - true if equals.
    static bool equalsCI(const void* data1, const void* data2, v_int32 size)
    
  2. Check Case Insensitive string equality of data1 to data2.
    • @param data1 - pointer to data1.
    • @param data2 - pointer to data2.
    • @return - true if equals.
    static bool equalsCI(const char* data1, const char* data2)
    
  3. Check Case Insensitive string equality of str1 to str2.
    • @param str1 - pointer to str1.
    • @param str2 - pointer to str2.
    • @return - true if equals.
    static bool equalsCI(StrBuffer* str1, StrBuffer* str2)
    

StrBuffer::equalsCI_FAST

  1. Check Case Insensitive string equality of data1 to data2. (ASCII only, correct compare if one of strings contains letters only)
    • @param data1 - pointer to data1.
    • @param data2 - pointer to data2.
    • @param size - number of characters to compare.
    • @return - true if equals.
    static bool equalsCI_FAST(const void* data1, const void* data2, v_int32 size)
    
  2. Check Case Insensitive string equality of data1 to data2. (ASCII only, correct compare if one of strings contains letters only)
    • @param data1 - pointer to data1.
    • @param data2 - pointer to data2.
    • @return - true if equals.
    static bool equalsCI_FAST(const char* data1, const char* data2)
    
  3. Check Case Insensitive string equality of str1 to str2. (ASCII only, correct compare if one of strings contains letters only)
    • @param str1 - pointer to str1.
    • @param str2 - pointer to str2.
    • @return - true if equals.
    static bool equalsCI_FAST(StrBuffer* str1, StrBuffer* str2)
    
  4. Check Case Insensitive string equality of str1 to str2. (ASCII only, correct compare if one of strings contains letters only)
    • @param str1 - pointer to str1 as StrBuffer.
    • @param str2 - pointer to str2 as const char*
    • @return - true if equals.
    static bool equalsCI_FAST(StrBuffer* str1, const char* str2)
    

StrBuffer::lowerCase

Change characters in data to lowercase.

  • @param data - pointer to data.
  • @param size - size of the data.

static void lowerCase(const void* data, v_int32 size)

StrBuffer::upperCase

Change characters in data to uppercase.

  • @param data - pointer to data.
  • @param size - size of the data.

static void upperCase(const void* data, v_int32 size)