summaryrefslogtreecommitdiff
path: root/Plugins/utils/mir_buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/utils/mir_buffer.h')
-rw-r--r--Plugins/utils/mir_buffer.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/Plugins/utils/mir_buffer.h b/Plugins/utils/mir_buffer.h
index 51398bd..4daf01e 100644
--- a/Plugins/utils/mir_buffer.h
+++ b/Plugins/utils/mir_buffer.h
@@ -174,6 +174,17 @@ class Buffer
len++;
}
+ void appendn(size_t n, T app)
+ {
+ alloc(len + n);
+
+ for(; n > 0; n--)
+ {
+ str[len] = app;
+ len++;
+ }
+ }
+
void append(const char *app, size_t appLen = -1)
{
if (appLen == -1)
@@ -198,6 +209,28 @@ class Buffer
len += appLen;
}
+ void append(const Buffer<char> &app)
+ {
+ size_t appLen = app.len;
+
+ size_t total = len + appLen + 1;
+ alloc(total);
+
+ __bcopy(&str[len], app.str, appLen);
+ len += appLen;
+ }
+
+ void append(const Buffer<WCHAR> &app)
+ {
+ size_t appLen = app.len;
+
+ size_t total = len + appLen + 1;
+ alloc(total);
+
+ __bcopy(&str[len], app.str , appLen);
+ len += appLen;
+ }
+
void appendPrintf(const T *app, ...)
{
size_t total = len + 512;
@@ -256,6 +289,13 @@ class Buffer
len += appLen - oldLen;
}
+ void replaceAll(T find, T replace)
+ {
+ for(size_t i = 0; i < len; i++)
+ if (str[len] == find)
+ str[len] = replace;
+ }
+
void translate()
{
if (str == NULL || len == 0)