Add project files.
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
#ifndef _CSTRING_HPP_
|
||||
#define _CSTRING_HPP_
|
||||
|
||||
/*** C++ STL Files ***/
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/*** SDL Header Files ***/
|
||||
#include <SDL.h>
|
||||
|
||||
/*** DLL Header File ***/
|
||||
#include "dllExport.h"
|
||||
|
||||
/*#pragma warning (disable : 4231)*/
|
||||
EXPIMP_TEMPLATE template class EXPORT_FROM_MYDLL std::allocator<char>;
|
||||
EXPIMP_TEMPLATE template class EXPORT_FROM_MYDLL std::basic_string<char>;
|
||||
/*#pragma warning (default : 4231)*/
|
||||
|
||||
#define __cString__MAX_LEN 65535
|
||||
|
||||
namespace UtilityEngine {
|
||||
class EXPORT_FROM_MYDLL cString
|
||||
{
|
||||
public:
|
||||
cString(); // default constructor
|
||||
cString(const char* s);
|
||||
cString(const cString& copy); // copy constructor
|
||||
~cString();
|
||||
|
||||
const char * alloc_str(size_t sz); // smart alloc string
|
||||
void clear(); // frees the string
|
||||
const char * c_str() const; // getter
|
||||
const char * copy_str(const char* copy); // alloc & copy
|
||||
|
||||
// utility methods
|
||||
bool have_value() const;
|
||||
size_t length() const;
|
||||
size_t size() const;
|
||||
cString & format(const char * format, ...);
|
||||
cString & trim();
|
||||
cString lower() const;
|
||||
cString upper() const;
|
||||
const char & last_char() const;
|
||||
const std::vector<cString> split(const char match) const;
|
||||
const std::vector<cString> split(const char * match) const;
|
||||
const std::vector<cString> split(const char * match, int max_split) const;
|
||||
long int char_find(const char& match) const;
|
||||
const cString & char_repl(const char & match, const char & repl);
|
||||
cString substr(size_t start, size_t length) const;
|
||||
long int find(const cString & match);
|
||||
const cString replace(const cString & match, const cString & repl);
|
||||
|
||||
// operators
|
||||
cString& operator = (const char* rhs); // assignment operator
|
||||
cString& operator = (const cString& rhs); // assignment operator
|
||||
cString& operator += (const char rhs);
|
||||
cString& operator += (const char* rhs); // concatenation operator
|
||||
cString& operator += (const cString& rhs); // concatenation operator
|
||||
|
||||
bool operator == (const char* rhs) const; // comparisons
|
||||
bool operator == (const cString& rhs) const;
|
||||
bool operator != (const char* rhs) const;
|
||||
bool operator != (const cString& rhs) const;
|
||||
bool operator > (const cString& rhs) const;
|
||||
bool operator < (const cString& rhs) const;
|
||||
bool operator >= (const cString& rhs) const;
|
||||
bool operator <= (const cString& rhs) const;
|
||||
|
||||
// conversion operators
|
||||
operator const char * () const; // c-string type
|
||||
operator std::string () const; // c++ string class
|
||||
|
||||
private:
|
||||
char * mp_str = nullptr;
|
||||
size_t m_len = 0;
|
||||
|
||||
};/// END CLASS DEFINITION cString
|
||||
// function overloads
|
||||
}/// END NAMESPACE DEFINITION UtilityEngine
|
||||
UtilityEngine::cString operator + (const UtilityEngine::cString& lhs, const UtilityEngine::cString& rhs);
|
||||
#endif/// END IFNDEF _CSTRING_HPP_
|
||||
Reference in New Issue
Block a user