Add CString::fromPointer()
This commit is contained in:
parent
e58c29e15d
commit
a3901330cd
2 changed files with 17 additions and 0 deletions
|
@ -159,6 +159,17 @@ fromUnsignedInteger(u64 value,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
usize
|
||||||
|
fromPointer(void* value,
|
||||||
|
char* buffer,
|
||||||
|
usize length,
|
||||||
|
u8 base,
|
||||||
|
bool capitalized)
|
||||||
|
{
|
||||||
|
return fromUnsignedInteger(uptr(value), buffer, length, base, capitalized);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
fromBool(bool value,
|
fromBool(bool value,
|
||||||
char* str,
|
char* str,
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
* Utilities for dealing with C strings.
|
* Utilities for dealing with C strings.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __KSTD_CSTRING_HH__
|
||||||
|
#define __KSTD_CSTRING_HH__
|
||||||
|
|
||||||
#include "Types.hh"
|
#include "Types.hh"
|
||||||
|
|
||||||
namespace kstd {
|
namespace kstd {
|
||||||
|
@ -46,6 +49,7 @@ void uppercase(char *str);
|
||||||
*/
|
*/
|
||||||
usize fromInteger(i64 value, char* buffer, usize length, u8 base = 10, bool capitalized = false);
|
usize fromInteger(i64 value, char* buffer, usize length, u8 base = 10, bool capitalized = false);
|
||||||
usize fromUnsignedInteger(u64 value, char* buffer, usize length, u8 base = 10, bool capitalized = false);
|
usize fromUnsignedInteger(u64 value, char* buffer, usize length, u8 base = 10, bool capitalized = false);
|
||||||
|
usize fromPointer(void* value, char* buffer, usize length, u8 base = 10, bool capitalized = false);
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** Convert a bool to a string. */
|
/** Convert a bool to a string. */
|
||||||
|
@ -55,3 +59,5 @@ char* fromBool(bool value, char* str, usize length);
|
||||||
|
|
||||||
} /* namespace CString */
|
} /* namespace CString */
|
||||||
} /* namespace kstd */
|
} /* namespace kstd */
|
||||||
|
|
||||||
|
#endif /* __KSTD_CSTRING_HH__ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue