EPAM B2BITS C++ Bovespa MarketData handler  1.28.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
B2bits::StringRef Class Reference

String reference type. More...

#include <b2bits/types/String.h>

Inheritance diagram for B2bits::StringRef:
Inheritance graph
[legend]
Collaboration diagram for B2bits::StringRef:
Collaboration graph
[legend]

Public Types

typedef char value_type
 Provides access to the template parameter. More...
 
typedef StringRef MyT
 
- Public Types inherited from B2bits::MemBlock
typedef char value_type
 Provides access to the template parameter. More...
 

Public Member Functions

 StringRef () noexcept
 Default constructor. More...
 
 StringRef (const value_type *aData, size_t aSize) noexcept
 
template<typename Iterator >
 StringRef (Iterator aBegin, Iterator aEnd) noexcept
 
 StringRef (std::string const &str) noexcept
 
 StringRef (value_type const *aData) noexcept
 
int compareTo (StringRef rv) const noexcept
 
bool equals (StringRef rv) const noexcept
 
std::basic_string< value_typetoStdString () const
 
bool isEmpty () const noexcept
 Returns true if given string is empty (e.g. size equal to 0) More...
 
bool isNull () const noexcept
 Returns true if given string is NULL. More...
 
StringRef substr (std::size_t offset, std::size_t size) const noexcept
 Returns part of the string by given offset and size. More...
 
StringRef substr (std::size_t offset) const noexcept
 Returns part of the string by given offset till end of string. More...
 
int toInt () const noexcept
 Converts string value to int. More...
 
i16 toInt16 () const noexcept
 Converts string value to int. More...
 
i32 toInt32 () const noexcept
 Converts string value to int. More...
 
i64 toInt64 () const noexcept
 Converts string value to int. More...
 
unsigned int toUInt () const noexcept
 Converts string value to int. More...
 
u16 toUInt16 () const noexcept
 Converts string value to int. More...
 
u32 toUInt32 () const noexcept
 Converts string value to int. More...
 
u64 toUInt64 () const noexcept
 Converts string value to int. More...
 
MyT normalize () const noexcept
 Calculates size of string and returns new object of StringRef. More...
 
- Public Member Functions inherited from B2bits::MemBlock
value_type const * data () const noexcept
 
std::size_t size () const noexcept
 Returns size of the block. More...
 
value_type const * end () const noexcept
 Returns pointer to the next after last character. More...
 
value_type const * begin () const noexcept
 Returns pointer to first character. More...
 
value_type const & operator[] (std::size_t index) const noexcept
 Indexer. More...
 
int compareTo (MemBlock rv) const noexcept
 
 MemBlock (const value_type *aData, size_t aSize) noexcept
 
template<typename Iterator >
 MemBlock (Iterator aBegin, Iterator aEnd) noexcept
 
 MemBlock () noexcept
 Default constructor. More...
 

Static Public Member Functions

template<int N>
static MyT fromStr (value_type const (&aData)[N]) noexcept
 
static int cmpAsFixedSizeStr (MyT v1, MyT v2) noexcept
 

Detailed Description

String reference type.

Member Typedef Documentation

Provides access to the template parameter.

Constructor & Destructor Documentation

B2bits::StringRef::StringRef ( )
inlinenoexcept

Default constructor.

B2bits::StringRef::StringRef ( const value_type aData,
size_t  aSize 
)
inlinenoexcept

Constructor Constructs instance from address to memory and size

Parameters
aDataaddress to the block
aSizesize of the block
template<typename Iterator >
B2bits::StringRef::StringRef ( Iterator  aBegin,
Iterator  aEnd 
)
inlinenoexcept

Constructor Constructs instance from address to memory and size

Parameters
aBeginaddress to the first byte of the block
aEndaddress of the byte after last byte of the block
B2bits::StringRef::StringRef ( std::string const &  str)
inlinenoexcept

Constructor Constructs instance from std::basic_string.

Parameters
strSource std::string
B2bits::StringRef::StringRef ( value_type const *  aData)
inlinenoexcept

Constructor Constructs instance from ANSI std::string

Parameters
aDataaddress to the ASCII std::string

Member Function Documentation

static int B2bits::StringRef::cmpAsFixedSizeStr ( MyT  v1,
MyT  v2 
)
staticnoexcept

Compares two strings with known memory size but unknown actual data size. Fox example "abc\0\0\0\0" and "abc\0" Usefull for fixed size strings.

int B2bits::StringRef::compareTo ( StringRef  rv) const
inlinenoexcept
bool B2bits::StringRef::equals ( StringRef  rv) const
inlinenoexcept
template<int N>
static MyT B2bits::StringRef::fromStr ( value_type const (&)  aData[N])
inlinestaticnoexcept

Creates instance from array of char

Parameters
aDataArray of chars
bool B2bits::StringRef::isEmpty ( ) const
inlinenoexcept

Returns true if given string is empty (e.g. size equal to 0)

bool B2bits::StringRef::isNull ( ) const
inlinenoexcept

Returns true if given string is NULL.

MyT B2bits::StringRef::normalize ( ) const
noexcept

Calculates size of string and returns new object of StringRef.

StringRef B2bits::StringRef::substr ( std::size_t  offset,
std::size_t  size 
) const
inlinenoexcept

Returns part of the string by given offset and size.

StringRef B2bits::StringRef::substr ( std::size_t  offset) const
inlinenoexcept

Returns part of the string by given offset till end of string.

int B2bits::StringRef::toInt ( ) const
noexcept

Converts string value to int.

i16 B2bits::StringRef::toInt16 ( ) const
noexcept

Converts string value to int.

i32 B2bits::StringRef::toInt32 ( ) const
noexcept

Converts string value to int.

i64 B2bits::StringRef::toInt64 ( ) const
noexcept

Converts string value to int.

std::basic_string<value_type> B2bits::StringRef::toStdString ( ) const
inline

Converts AsciiString to std::string. This method creates copy of the stored buffer and returns it as std::string.

unsigned int B2bits::StringRef::toUInt ( ) const
noexcept

Converts string value to int.

u16 B2bits::StringRef::toUInt16 ( ) const
noexcept

Converts string value to int.

u32 B2bits::StringRef::toUInt32 ( ) const
noexcept

Converts string value to int.

u64 B2bits::StringRef::toUInt64 ( ) const
noexcept

Converts string value to int.