From 8ef500bc0b259cf6a73772148153b759e954297e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 22 Apr 2022 23:52:29 -0700 Subject: C++11 introduced actual unicode string literals. I'm moving things to take advantage of that. It's pretty cool! --- src/unstable/text.cpp | 10 ++++++++++ src/unstable/text.h | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/unstable') diff --git a/src/unstable/text.cpp b/src/unstable/text.cpp index be4c10f..d8cf15c 100644 --- a/src/unstable/text.cpp +++ b/src/unstable/text.cpp @@ -19,6 +19,16 @@ Bu::Text::Text() : { } +Bu::Text::Text( const CodePoint *rSrc ) : + pData( NULL ), + bIsBmpOnly( true ), + iSize( 0 ) +{ + for(; rSrc[iSize]; iSize++ ) {} + pData = new CodePoint[iSize+1]; + memcpy( pData, rSrc, iSize+1 ); +} + Bu::Text::Text( const Text &rSrc ) : pData( NULL ), bIsBmpOnly( rSrc.bIsBmpOnly ), diff --git a/src/unstable/text.h b/src/unstable/text.h index c57dcfb..43e9e2c 100644 --- a/src/unstable/text.h +++ b/src/unstable/text.h @@ -35,10 +35,11 @@ namespace Bu public: class iterator; class const_iterator; - typedef uint32_t CodePoint; + typedef char32_t CodePoint; public: Text(); + Text( const CodePoint *rSrc ); Text( const Text &rSrc ); Text( const TextBuilder &rSrc ); virtual ~Text(); -- cgit v1.2.3