Skip to content

chasebish/cwc_object_string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Standard Object and String implementations

This repository is for CS4500 Software Development and provides standard implementations for the class for both Object and String. It would be mutually beneficial if the entire class adopted the same base APIs.

If you would like to contribute/make changes, all is welcome

Design Decisions

  • Both classes have no local variables defined. This way the implementing group can call their variables whatever they want.
  • Object is relatively simple in comparison to given one on Piazza @166. The reason behind this stems from Piazza @330 stating that those older implementations were used more for learning. A simpler API will be easier for all groups to implement.

Object

Object() - Basic constructor for an Object

virtual ~Object() - Basic virtual destructor for an Object, to be overridden by subclasses

virtual bool equals(Object* const obj) - Equality checker between Objects

virtual size_t hash() - Generates a hash for an Object

String

String(const char* s) - Basic constructor for a String

String(String* const s) - Creates a new String copying the value from s

~String() - Destructor for a String

size_t hash() - Generates a hash for a String

bool equals(Object* const obj) - Equality checker between a String and an Object

int cmp(String* const s) - Compares two Strings in alphabetical order

  • < 0 if this String is less than String s
  • = 0 if this String is equal to String s
  • > 0 if this String is greater than String s

String* concat(String* const s) - Concatenates two Strings, creates a new String

size_t size() - Gets the size of the String value

About

Standard CwC object.h and string.h files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages