]> jfr.im git - irc/gameservirc.git/blame - gameserv/myString.cpp
Removed extra output when the refresh period is met (%ld, refreshperiod)
[irc/gameservirc.git] / gameserv / myString.cpp
CommitLineData
138b009f 1#include "myString.h"
c260a8d7 2#include <iostream>
3using std::cout;
4using std::endl;
138b009f 5
6myString::myString(char *s)
7{
8 setString(s);
9}
10
c260a8d7 11myString::myString(const myString &right)
12{
13 setString(&right);
14}
15
138b009f 16myString::~myString()
17{
18 if (string)
19 delete [] string;
20
21 string = NULL;
22}
23
24void myString::setString(char *s)
25{
26 if (!s)
27 {
87137def 28 if (string)
29 delete [] string;
30
31 string = NULL;
138b009f 32 }
33 else
34 {
35 string = new char[strlen(s) + 1];
36 memset(string, 0, (strlen(s) + 1));
37 strcpy(string, s);
38 }
39}
c260a8d7 40
41void myString::setString(const myString *right)
42{
43 setString(right->string);
44}