mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-06 23:30:29 +00:00
Add c_str functions.
This commit is contained in:
parent
b9a06bafd8
commit
1d7bd5d073
2
format.h
2
format.h
@ -520,6 +520,7 @@ class UTF8ToUTF16 {
|
|||||||
explicit UTF8ToUTF16(StringRef s);
|
explicit UTF8ToUTF16(StringRef s);
|
||||||
operator WStringRef() const { return WStringRef(&buffer_[0], size()); }
|
operator WStringRef() const { return WStringRef(&buffer_[0], size()); }
|
||||||
size_t size() const { return buffer_.size() - 1; }
|
size_t size() const { return buffer_.size() - 1; }
|
||||||
|
const wchar_t *c_str() const { return &buffer_[0]; }
|
||||||
std::wstring str() const { return std::wstring(&buffer_[0], size()); }
|
std::wstring str() const { return std::wstring(&buffer_[0], size()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -534,6 +535,7 @@ class UTF16ToUTF8 {
|
|||||||
explicit UTF16ToUTF8(WStringRef s);
|
explicit UTF16ToUTF8(WStringRef s);
|
||||||
operator StringRef() const { return StringRef(&buffer_[0], size()); }
|
operator StringRef() const { return StringRef(&buffer_[0], size()); }
|
||||||
size_t size() const { return buffer_.size() - 1; }
|
size_t size() const { return buffer_.size() - 1; }
|
||||||
|
const char *c_str() const { return &buffer_[0]; }
|
||||||
std::string str() const { return std::string(&buffer_[0], size()); }
|
std::string str() const { return std::string(&buffer_[0], size()); }
|
||||||
|
|
||||||
// Performs conversion returning a system error code instead of
|
// Performs conversion returning a system error code instead of
|
||||||
|
Loading…
Reference in New Issue
Block a user