forked from csstransky/cs4500-assignment-1-part-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
string.h
49 lines (35 loc) · 1.07 KB
/
string.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//lang::CwC
#pragma once
#include "object.h"
#include <cstdlib>
#include <cstring>
#include <cstdio>
/**
* An immutable String class representing a char*
* author: chasebish */
class String : public Object {
public:
/** CONSTRUCTORS & DESTRUCTORS **/
/* Creates a String copying s */
String(const char* s);
/* Copies a String copying the value from s */
String(String* const s);
/* Clears String from memory */
~String();
/** INHERITED METHODS **/
/* Inherited from Object, generates a hash for a String */
size_t hash();
/* Inherited from Object, checks equality between an String and an Object */
bool equals(Object* const obj);
/** STRING METHODS **/
/** Compares strings based on alphabetical order
* < 0 -> this String is less than String s
* = 0 -> this String is equal to String s
* > 0 -> this String is greater than String s
*/
int cmp(String* const s);
/* Creates a new String by combining two existing Strings */
String* concat(String* const s);
/* Returns the current length of the String */
size_t size();
};