1
0
mirror of https://github.com/Halofreak1990/XFXFramework synced 2024-12-26 13:49:34 +01:00
Halofreak1990 e7a47c8ed9 Revamped the List class so that it can (properly) handle pointers as well
Added 'ValueTypes' Single and Double
Added some components in the new System::Net namespace
Added the Console class, which can be used to output text to the screen
Updated a bunch of structs to include the IComparable and IEquatable interfaces, and inheritance from Object to allow better interoperability between container classes and other types
Replaced all exception handling code with a report to stdout.txt - this will, I hope, eventually be reversed, but as of yet, there is no support for exceptions.

BEWARE! Even though all libraries correctly compile, you cannot use any class/structure that inherits from a template class, because stupid G++ wants to include exception handling for each template.
2011-11-07 01:29:50 +00:00

99 lines
3.3 KiB
C++

/********************************************************
* String.h *
* *
* XFX String definition file *
* Copyright © XFX Team. All Rights Reserved *
********************************************************/
#ifndef _SYSTEM_STRING_
#define _SYSTEM_STRING_
#include "Enums.h"
#include "Interfaces.h"
#include "Object.h"
namespace System
{
// Represents text as a series of Unicode characters.
class String : public IComparable<String>, public IEquatable<String>, virtual Object
{
private:
int m_arrayLength;
char m_firstChar;
int m_stringLength;
static const int TrimBoth = 2;
static const int TrimHead = 0;
static const int TrimTail = 1;
char* internalString;
public:
const int Length;
static const String Empty;
String();
String(char c, int count);
String(char value[], int startIndex, int length); //Note: can also be used as String(char *value, int startIndex, int length);
String(char* value);
String(const String &obj); // Copy constructor
String(const char* obj);
virtual ~String();
String Clone();
int CompareTo(String other);
int Compare(String strA, String strB);
static String Concat(String values[]);
static char* Concat(char* values[]);
static char* Concat(char* str1, char* str2, char* str3, char* str4);
static String Concat(String str1, String str2, String str3, String str4);
bool Contains(char* value);
bool EndsWith(char* value);
bool Equals(const String obj);
bool Equals(const String str1, const String str2);
static char* Format(char* format, ...);
int IndexOf(char value);
int IndexOf(char value, int startIndex);
int IndexOf(char value, int startIndex, int count);
static bool IsNullOrEmpty(String value);
static bool IsNullOrEmpty(char* value);
static String Join(String separator, String value[]);
static String Join(String separator, String value[], int startIndex, int count);
String PadLeft(int totalWidth);
String PadLeft(int totalWidth, char paddingChar);
String PadRight(int totalWidth);
String PadRight(int totalWidth, char paddingChar);
String Replace(char oldChar, char newChar);
String Replace(char* oldValue, char* newValue);
char** Split(String separator, int count, StringSplitOptions_t options);
char** Split(String separator, StringSplitOptions_t options);
char** Split(char separator[], int count, StringSplitOptions_t options);
char** Split(char separator[], StringSplitOptions_t options);
char** Split(char separator[], int count);
char** Split(char separator[]);
bool StartsWith(char* value);
char* SubString(int startIndex);
String SubString(int startIndex, int length);
char* ToCharArray(int startIndex, int length);
char* ToCharArray();
String ToLower();
static char* ToLower(char* str);
char* ToString();
String ToUpper();
static char* ToUpper(char* str);
bool operator!=(const String right);
bool operator!=(char* right);
bool operator==(const String right);
bool operator==(char* right);
String operator=(char* right);
String operator=(const String right);
String operator+(char* right);
String operator+=(String right);
String operator+=(char* right);
String operator+(const String right);
char operator [](int index);
};
typedef String string;
}
#endif //_SYSTEM_STRING_