2013-01-21 20:55:42 +01:00
|
|
|
/**
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* Xenia : Xbox 360 Emulator Research Project *
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* Copyright 2013 Ben Vanik. All rights reserved. *
|
|
|
|
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
|
|
|
|
******************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
2013-12-07 07:57:16 +01:00
|
|
|
#ifndef ALLOY_STRING_BUFFER_H_
|
|
|
|
|
#define ALLOY_STRING_BUFFER_H_
|
2013-01-21 20:55:42 +01:00
|
|
|
|
2013-12-07 07:57:16 +01:00
|
|
|
#include <alloy/core.h>
|
2013-04-21 21:34:20 +02:00
|
|
|
|
2013-01-21 20:55:42 +01:00
|
|
|
|
2013-12-07 07:57:16 +01:00
|
|
|
namespace alloy {
|
2013-01-21 20:55:42 +01:00
|
|
|
|
|
|
|
|
|
2013-12-07 07:57:16 +01:00
|
|
|
class StringBuffer {
|
|
|
|
|
public:
|
|
|
|
|
StringBuffer(size_t initial_capacity = 0);
|
|
|
|
|
~StringBuffer();
|
2013-01-21 20:55:42 +01:00
|
|
|
|
2013-12-17 19:20:07 +01:00
|
|
|
size_t length() const { return offset_; }
|
|
|
|
|
|
2013-12-07 07:57:16 +01:00
|
|
|
void Reset();
|
2013-01-21 20:55:42 +01:00
|
|
|
|
2013-12-07 07:57:16 +01:00
|
|
|
void Append(const char* format, ...);
|
2013-12-17 19:20:07 +01:00
|
|
|
void AppendVarargs(const char* format, va_list args);
|
|
|
|
|
void AppendBytes(const uint8_t* buffer, size_t length);
|
2013-01-21 20:55:42 +01:00
|
|
|
|
2013-12-17 19:20:07 +01:00
|
|
|
const char* GetString() const;
|
2013-12-07 07:57:16 +01:00
|
|
|
char* ToString();
|
2013-01-21 20:55:42 +01:00
|
|
|
|
2013-12-07 07:57:16 +01:00
|
|
|
private:
|
|
|
|
|
char* buffer_;
|
|
|
|
|
size_t capacity_;
|
|
|
|
|
size_t offset_;
|
2013-04-21 21:34:20 +02:00
|
|
|
};
|
2013-01-21 20:55:42 +01:00
|
|
|
|
|
|
|
|
|
2013-12-07 07:57:16 +01:00
|
|
|
} // namespace alloy
|
2013-01-21 20:55:42 +01:00
|
|
|
|
|
|
|
|
|
2013-12-07 07:57:16 +01:00
|
|
|
#endif // ALLOY_STRING_BUFFER_H_
|