mirror of https://github.com/Icinga/icinga2.git
Drop StringBuilder
This commit is contained in:
parent
f89f35c798
commit
070b4f9d06
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
}
|
|
@ -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 */
|
Loading…
Reference in New Issue