Drop StringBuilder

This commit is contained in:
Alexander A. Klimov 2021-03-22 17:37:04 +01:00
parent f89f35c798
commit 070b4f9d06
3 changed files with 0 additions and 73 deletions

View File

@ -70,7 +70,6 @@ set(base_SOURCES
stream.cpp stream.hpp
streamlogger.cpp streamlogger.hpp streamlogger-ti.hpp
string.cpp string.hpp string-script.cpp
stringbuilder.cpp stringbuilder.hpp
sysloglogger.cpp sysloglogger.hpp sysloglogger-ti.hpp
tcpsocket.cpp tcpsocket.hpp
threadpool.cpp threadpool.hpp

View File

@ -1,36 +0,0 @@
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
#include "base/stringbuilder.hpp"
#include <cstring>
using namespace icinga;
void StringBuilder::Append(const String& str)
{
m_Buffer.insert(m_Buffer.end(), str.Begin(), str.End());
}
void StringBuilder::Append(const std::string& str)
{
m_Buffer.insert(m_Buffer.end(), str.begin(), str.end());
}
void StringBuilder::Append(const char *begin, const char *end)
{
m_Buffer.insert(m_Buffer.end(), begin, end);
}
void StringBuilder::Append(const char *cstr)
{
m_Buffer.insert(m_Buffer.end(), cstr, cstr + std::strlen(cstr));
}
void StringBuilder::Append(char chr)
{
m_Buffer.emplace_back(chr);
}
String StringBuilder::ToString() const
{
return String(m_Buffer.data(), m_Buffer.data() + m_Buffer.size());
}

View File

@ -1,36 +0,0 @@
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
#ifndef STRINGBUILDER_H
#define STRINGBUILDER_H
#include "base/i2-base.hpp"
#include "base/string.hpp"
#include <string>
#include <vector>
namespace icinga
{
/**
* A string builder.
*
* @ingroup base
*/
class StringBuilder final
{
public:
void Append(const String&);
void Append(const std::string&);
void Append(const char *, const char *);
void Append(const char *);
void Append(char);
String ToString() const;
private:
std::vector<char> m_Buffer;
};
}
#endif /* STRINGBUILDER_H */