This commit is contained in:
2025-06-02 20:47:27 -04:00
parent eb9ae4316f
commit b791fdf841
15 changed files with 214 additions and 346 deletions

View File

@ -17,6 +17,9 @@
namespace ams
{
static const int amsstring_success = 1;
static const int amsstring_failure = -1;
//wraps the functions strcpy_s and strncpy in a portable manner
//between linux and microsoft standard C libraries.
int amsstrcpy_s(char *dest, int size, const char *src);
@ -39,9 +42,8 @@ static const ams_chartype ams_char_nt = (ams_chartype) '\0'; //null terminator
class amsstring
{
public:
ams_chartype blank; // null terminator returned for accessing index out of bounds
ams_chartype *cstring;
ams_chartype blank; // null terminator returned for accessing index out of bounds
int length;
//length will be set to the length of the cstring not including the null terminating char
@ -49,20 +51,13 @@ public:
amsstring();
~amsstring();
amsstring(amsstring &other);
amsstring& operator=(amsstring &other);
amsstring(const amsstring &other);
const amsstring& operator=(const amsstring &other);
amsstring(ams_chartype *other);
amsstring& operator=(const amsstring& other);
amsstring(amsstring &&other) noexcept;
amsstring& operator=(amsstring &&other) noexcept;
amsstring(const ams_chartype *other);
amsstring& operator=(ams_chartype *other);
const amsstring& operator=(const ams_chartype *other); //assign string constant to amsstring
//const amsstring& operator=(const ams_chartype *other) const; //assign string constant to amsstring
//const is a disease!
const amsstring& operator=(const ams_chartype *other);
//
//amsstring(int length);
//amsstring(int length, const ams_chartype initchar);

View File

@ -4,20 +4,20 @@
namespace ams
{
void amsstring3_basic_string_test1();
void amsstring3_sscanf_test1();
void amsstring3_basic_string_test2();
void amsstring3_memoryleakcheck1();
void amsstring3_memoryleakcheck2();
void amsstring3_stringtests2();
void amsstring3_test_find();
void amsstring4_basic_string_test1();
void amsstring4_sscanf_test1();
void amsstring4_basic_string_test2();
void amsstring4_memoryleakcheck1();
void amsstring4_memoryleakcheck2();
void amsstring4_stringtests2();
void amsstring4_test_find();
void amsstring3_test_splitlines();
void amsstring3_test_split();
void amsstring3_test_strip();
void amsstring3_test_freadwrite();
void amsstring4_test_splitlines();
void amsstring4_test_split();
void amsstring4_test_strip();
void amsstring4_test_freadwrite();
void amsstring3_test_concatenation_operators();
void amsstring4_test_concatenation_operators();