55 lines
1.4 KiB
C
55 lines
1.4 KiB
C
|
/*
|
||
|
* Copyright (c) by BlackMark 2015
|
||
|
* Date 26/11/2015
|
||
|
* Version 1.4
|
||
|
*/
|
||
|
|
||
|
#ifndef STRING_H
|
||
|
#define STRING_H
|
||
|
|
||
|
#include <string.h>
|
||
|
|
||
|
class string
|
||
|
{
|
||
|
private:
|
||
|
size_t m_sizeLength;
|
||
|
size_t m_sizeCapacity;
|
||
|
char* m_szString;
|
||
|
|
||
|
public:
|
||
|
static const size_t npos = -1;
|
||
|
|
||
|
string();
|
||
|
string( const string &strString );
|
||
|
string( const char* szString );
|
||
|
string( char chCharacter );
|
||
|
string( size_t sizeLength, char chCharacter );
|
||
|
~string();
|
||
|
|
||
|
string& append( const string &strString );
|
||
|
char& at( size_t sizeIndex );
|
||
|
const char& at( size_t sizeIndex ) const;
|
||
|
size_t capacity() const;
|
||
|
void clear();
|
||
|
const char* c_str() const;
|
||
|
const char* data() const;
|
||
|
bool empty() const;
|
||
|
size_t find( const string &strString, size_t sizePos = 0 ) const;
|
||
|
size_t length() const;
|
||
|
void push_back( char chCharacter );
|
||
|
void reserve( size_t sizeCapacity = 0 );
|
||
|
void resize( size_t sizeLength, char chCharacter = '\0' );
|
||
|
size_t rfind( const string &strString, size_t sizePos = npos ) const;
|
||
|
size_t size() const;
|
||
|
string substr( size_t sizePos = 0, size_t sizeLength = npos ) const;
|
||
|
|
||
|
string& operator=( const string &strRHS );
|
||
|
char& operator[]( size_t sizeIndex );
|
||
|
const char& operator[]( size_t sizeIndex ) const;
|
||
|
string operator+( const string &strRHS ) const;
|
||
|
string& operator+=( const string &strRHS );
|
||
|
bool operator==( const string &strRHS ) const;
|
||
|
bool operator!=( const string &strRHS ) const;
|
||
|
};
|
||
|
|
||
|
#endif
|