samples/golf/src/golf/Utility.hpp
/*
first byte is string length in bytes, followed by string utf32 data
string is limited to MaxStringChars
*/
first byte is string length in bytes, followed by string utf32 data
string is limited to MaxStringChars
first byte is string length in bytes followed by string utf32 data string is limited to MaxStringChars
static inline std::vector<std::uint8_t> serialiseString(const cro::String& str)
{
    auto len = std::min(ConstVal::MaxStringChars, str.size());
    auto workingString = str.substr(0, len);
    std::uint8_t size = static_cast<std::uint8_t>(len * sizeof(std::uint32_t));
    std::vector<std::uint8_t> buffer(size + 1);
    buffer[0] = size;
    std::memcpy(&buffer[1], workingString.data(), size);
    return buffer;
}
static inline std :: vector < std :: uint8_t > serialiseString ( const cro :: String & str ) { auto len = std :: min ( ConstVal :: MaxStringChars , str . size ( ) ) ; auto workingString = str . substr ( 0 , len ) ; std :: uint8_t size = static_cast < std :: uint8_t > ( len * sizeof ( std :: uint32_t ) ) ; std :: vector < std :: uint8_t > buffer ( size + 1 ) ; buffer [ 0 ] = size ; std :: memcpy ( & buffer [ 1 ] , workingString . data ( ) , size ) ; return buffer ; }
first byte is string length in bytes, followed by string utf32 data
string is limited to MaxStringChars
first byte is string length in bytes followed by string utf32 data string is limited to MaxStringChars