simple_string.h#
-
namespace ONNX_LIGHT_NAMESPACE
-
namespace utils
Functions
-
std::string join_string(const std::vector<std::string> &rows, const char *delimiter = "\n")#
Concatenates rows with a delimiter.
-
class RefString#
- #include <simple_string.h>
String view used by binary readers. It references existing memory and may keep short values in an internal buffer.
Public Functions
-
inline explicit RefString(const RefString ©)#
Initializes a view by copying pointer and size from another view.
-
inline explicit RefString(const char *ptr, size_t size)#
Initializes a view from a pointer and an explicit size.
-
inline RefString &operator=(const String &v)#
Assigns the pointer and size from an owning string.
Assigns a non-owning view from an owning string.
-
inline size_t size() const#
Returns the number of characters in the view.
-
inline const char *c_str() const#
Returns the underlying pointer.
-
inline const char *data() const#
Returns the underlying pointer without ownership.
-
inline bool empty() const#
Indicates whether the view is empty.
-
inline char operator[](size_t i) const#
Returns the character at the specified index.
-
bool operator==(const char *other) const#
Compares this view with a null-terminated string.
-
bool operator!=(const String &other) const#
Returns whether this view differs from an owning string.
-
bool operator!=(const std::string &other) const#
Returns whether this view differs from a standard string.
-
bool operator!=(const char *other) const#
Returns whether this view differs from a null-terminated string.
-
int64_t toint64() const#
Parses the content as a signed 64-bit integer.
Private Members
-
const char *ptr_#
-
size_t size_#
-
bool has_inline_#
-
char inline_data_[kInlineCapacity]#
Private Static Attributes
-
static constexpr size_t kInlineCapacity = 15#
-
inline explicit RefString(const RefString ©)#
-
class String#
- #include <simple_string.h>
Owning string type used by ONNX-light protobuf fields. It keeps short values in an internal buffer and uses heap storage for larger values.
Public Functions
-
inline ~String()#
Releases owned memory.
-
inline void clear()#
Resets the instance to an empty state and frees owned memory.
-
inline explicit String()#
Initializes an empty string.
-
inline explicit String(const RefString &s)#
Initializes by copying content from a non-owning string view.
-
inline explicit String(const char *ptr, size_t size)#
Initializes by copying a pointer and explicit size.
-
inline explicit String(String &&other) noexcept#
Initializes by taking ownership from another instance.
-
inline size_t size() const#
Returns the number of characters.
-
inline size_t length() const#
Returns the number of characters.
-
inline const char *data() const#
Returns the underlying pointer.
-
inline bool empty() const#
Indicates whether the string is empty.
-
inline bool null() const#
Indicates whether the string is empty and has no allocated buffer.
-
inline char operator[](size_t i) const#
Returns the character at the specified index.
-
bool operator==(const char *other) const#
Compares with a null-terminated string.
-
bool operator!=(const std::string &other) const#
Returns whether this string differs from a standard string.
-
bool operator!=(const String &other) const#
Returns whether this string differs from another owning string.
-
bool operator!=(const RefString &other) const#
Returns whether this string differs from a non-owning string view.
-
bool operator!=(const char *other) const#
Returns whether this string differs from a null-terminated string.
-
bool operator<(const std::string &other) const#
Returns whether this string is lexicographically less than a standard string.
-
bool operator<(const String &other) const#
Returns whether this string is lexicographically less than another owning string.
-
bool operator<(const RefString &other) const#
Returns whether this string is lexicographically less than a non-owning string view.
-
bool operator<(const char *other) const#
Returns whether this string is lexicographically less than a null-terminated string.
-
bool operator>(const std::string &other) const#
Returns whether this string is lexicographically greater than a standard string.
-
bool operator>(const String &other) const#
Returns whether this string is lexicographically greater than another owning string.
-
bool operator>(const RefString &other) const#
Returns whether this string is lexicographically greater than a non-owning string view.
-
bool operator>(const char *other) const#
Returns whether this string is lexicographically greater than a null-terminated string.
-
inline int64_t toint64() const#
Parses the content as a signed 64-bit integer.
Private Functions
-
void set(const char *ptr, size_t size)#
Replaces the content with a copy of the provided buffer.
Private Static Attributes
-
static constexpr size_t kInlineCapacity = 23#
-
inline ~String()#
-
std::string join_string(const std::vector<std::string> &rows, const char *delimiter = "\n")#
-
namespace utils