#ifndef __XSTRING_H__
#define __XSTRING_H__

class xstring {

private:
	int _length;
	char *_chars;

public:
	xstring();
	xstring(const int length, const char filler);
	xstring(const char *str);
	xstring(const xstring &other);
	~xstring();

	xstring& operator=(const xstring &other);

	void clear();
	int get_length() const;
	void print() const;

private:
	void init(const char *other);
};

// Utils

typedef unsigned char byte;

inline void memset(void *ptr, int val, int num) {
	if(!ptr || !num) return;
	while(num-- > 0)
		((byte*)ptr)[num] = (byte)val;
}

inline void memcpy(void *dst, const void *src, int num) {
	if(!dst || !src || !num) return;
	while(num-- > 0)
		((byte*)dst)[num] = ((byte*)src)[num];
}

#endif // __XSTRING_H__
