summaryrefslogtreecommitdiff
path: root/node/Buffer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/Buffer.hpp')
-rw-r--r--node/Buffer.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/node/Buffer.hpp b/node/Buffer.hpp
index c5d625de..0b171592 100644
--- a/node/Buffer.hpp
+++ b/node/Buffer.hpp
@@ -301,6 +301,23 @@ public:
}
/**
+ * Append a C string including null termination byte
+ *
+ * @param s C string
+ * @throws std::out_of_range Attempt to append beyond capacity
+ */
+ inline void appendCString(const char *s)
+ throw(std::out_of_range)
+ {
+ for(;;) {
+ if (_l >= C)
+ throw std::out_of_range("Buffer: append beyond capacity");
+ if (!(_b[_l++] = *(s++)))
+ break;
+ }
+ }
+
+ /**
* Append a buffer
*
* @param b Buffer to append