2 * Copyright 2013, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
25 PathBuffer(char* buffer
, size_t size
, size_t length
= 0)
27 SetTo(buffer
, size
, length
);
30 void SetTo(char* buffer
, size_t size
, size_t length
= 0)
36 fBuffer
[fLength
] = '\0';
39 bool Append(const char* toAppend
, size_t length
)
41 if (length
> 0 && fLength
+ 1 < fSize
) {
42 size_t toCopy
= std::min(length
, fSize
- fLength
- 1);
43 memcpy(fBuffer
+ fLength
, toAppend
, toCopy
);
44 fBuffer
[fLength
+ toCopy
] = '\0';
48 return fLength
< fSize
;
51 bool Append(const char* toAppend
)
53 return Append(toAppend
, strlen(toAppend
));
75 #endif // PATH_BUFFER_H