diff --git a/src/app/Dictionary.h b/src/app/Dictionary.h index 45436e5..c72cd0e 100644 --- a/src/app/Dictionary.h +++ b/src/app/Dictionary.h @@ -34,7 +34,22 @@ namespace DictionaryHelper strcpy(_string, Object._string); } ~StringEntity(){free(_string);} - char *getString(){return _string;} + const char *getString(){return _string;} + void setString(const char *string = NULL) + { + free(_string);_string = NULL; + + if(string == NULL) + { + _string = (char *) malloc((sizeof(char))); + _string[0] = '\0'; + } + else + { + _string = (char *) malloc((strlen(string) * sizeof(char)) + 1); //+1 for the string terminating character + strcpy(_string, string); + } + } Dictionary *split(char character); private: char *_string;