9 #ifndef TurtleBrains_FixedString_hpp
10 #define TurtleBrains_FixedString_hpp
12 #include <turtle_brains/core/tb_configuration.hpp>
13 #include <turtle_brains/core/tb_string.hpp>
14 #include <turtle_brains/core/tb_error.hpp>
36 strncpy(mData, value, Size - 1);
42 strncpy(mData, value.c_str(), Size - 1);
48 strncpy(mData, value.mData, Size - 1);
51 bool operator==(
const FixedString& other)
const {
return 0 == strcmp(mData, other.mData); }
52 bool operator==(
const char* other)
const {
return 0 == strcmp(mData, other); }
53 bool operator==(
const tbCore::tbString& other)
const {
return 0 == strcmp(mData, other.c_str()); }
54 bool operator!=(
const FixedString& other)
const {
return 0 != strcmp(mData, other.mData); }
55 bool operator!=(
const char* other)
const {
return 0 != strcmp(mData, other); }
56 bool operator!=(
const tbCore::tbString& other)
const {
return 0 != strcmp(mData, other.c_str()); }
63 bool empty(
void)
const {
return strlen(mData) == 0; }
64 size_t size(
void)
const {
return strlen(mData); }
65 size_t FixedSize(
void)
const {
return Size; }
67 const char* data(
void)
const {
return mData; }
68 char* data(
void) {
return mData; }
70 const char* c_str(
void)
const {
return mData; }
76 template <
size_t Size> std::ostream& operator<<(std::ostream& outputStream, const FixedString<Size>& fixed)
78 outputStream << fixed.data();
82 template <
size_t Size> std::istream& operator<<(std::istream& inputStream, FixedString<Size>& fixed)
85 inputStream >> buffer;
90 template <
size_t Size>
bool operator==(
const char* left,
const FixedString<Size>& right) {
return 0 == strcmp(right.c_str(), left); }
91 template <
size_t Size>
bool operator==(
const tbCore::tbString& left,
const FixedString<Size>& right) {
return 0 == strcmp(right.c_str(), left.c_str()); }
92 template <
size_t Size>
bool operator!=(
const char* left,
const FixedString<Size>& right) {
return 0 != strcmp(right.c_str(), left); }
93 template <
size_t Size>
bool operator!=(
const tbCore::tbString& left,
const FixedString<Size>& right) {
return 0 != strcmp(right.c_str(), left.c_str()); }
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:21
Definition: tb_fixed_string.hpp:25
Contains core functionality for each component of the API.
Definition: tb_debug_logger.hpp:88
std::string tbString
Definition: tb_string.hpp:335