2 EIBD eib bus access and management daemon
3 Copyright (C) 2005-2010 Martin Koegler <mkoegler@auto.tuwien.ac.at>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 /** implements a string */
40 /** initialize with the empty string */
47 /** initialize with a string */
48 String (const String
& a
)
54 memcpy (data
, a
.data
, len
);
59 /** assign a String */
60 const String
& operator = (const String
& a
)
68 memcpy (data
, a
.data
, len
);
75 /** initialize with a character constant */
76 String (const char *msg
)
80 len
= strlen (msg
) + 1;
91 /** assign a character constant */
92 const String
& operator = (const char *msg
)
98 len
= strlen (msg
) + 1;
110 /** concats two strings*/
111 String
operator + (const String
& a
)
118 b
.len
= a
.len
+ len
- 1;
121 b
.data
= new char[b
.len
];
123 strcpy (b
.data
, data
);
127 strcat (b
.data
, a
.data
);
132 bool operator == (const String
& a
) const
138 return (!strcmp (data
, a
.data
));
141 bool operator!= (const String
& a
) const
143 return !(*this == a
);
146 /** returns the content as char* */
147 const char *operator () () const
154 /** adds a text to a string */
155 inline const String
&
156 operator += (String
& a
, const String b
)