Browse Source

Allow pre-allocated buffer in String class

pull/6/head
falkTX 9 years ago
parent
commit
8c4e45d4a7
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      distrho/extra/String.hpp

+ 11
- 2
distrho/extra/String.hpp View File

@@ -54,11 +54,20 @@ public:
/*
* Simple char string.
*/
explicit String(char* const strBuf) noexcept
explicit String(char* const strBuf, const bool copyData = true) noexcept
: fBuffer(_null()),
fBufferLen(0)
{
_dup(strBuf);
if (copyData || strBuf == nullptr)
{
_dup(strBuf);
}
else
{
fBuffer = strBuf;
fBufferLen = std::strlen(strBuf);
}

}

/*


Loading…
Cancel
Save