aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2022-04-22 23:52:29 -0700
committerMike Buland <eichlan@xagasoft.com>2022-04-22 23:52:29 -0700
commit8ef500bc0b259cf6a73772148153b759e954297e (patch)
treed0c30837f15656f0b3bade6ce608d396551b78a4
parent23d88aa2812c361d30abefeeb296548698409bf5 (diff)
downloadlibbu++-8ef500bc0b259cf6a73772148153b759e954297e.tar.gz
libbu++-8ef500bc0b259cf6a73772148153b759e954297e.tar.bz2
libbu++-8ef500bc0b259cf6a73772148153b759e954297e.tar.xz
libbu++-8ef500bc0b259cf6a73772148153b759e954297e.zip
C++11 introduced actual unicode string literals.bigchange
I'm moving things to take advantage of that. It's pretty cool!
-rw-r--r--src/tests/archivetags.cpp8
-rw-r--r--src/tests/text.cpp9
-rw-r--r--src/unstable/text.cpp10
-rw-r--r--src/unstable/text.h3
4 files changed, 28 insertions, 2 deletions
diff --git a/src/tests/archivetags.cpp b/src/tests/archivetags.cpp
index 5c8e0fa..b9b3603 100644
--- a/src/tests/archivetags.cpp
+++ b/src/tests/archivetags.cpp
@@ -1,4 +1,4 @@
1 1/*
2class SubThing 2class SubThing
3{ 3{
4public: 4public:
@@ -70,4 +70,10 @@ Bu::Archive &operator>>( Bu::Archive &ar, Something &st )
70 ar >> ar.tag("thing") >> st.xThing; 70 ar >> ar.tag("thing") >> st.xThing;
71 return ar; 71 return ar;
72} 72}
73*/
74
75int main( int argc, char *argv[] )
76{
77 return 0;
78}
73 79
diff --git a/src/tests/text.cpp b/src/tests/text.cpp
new file mode 100644
index 0000000..0b99e3b
--- /dev/null
+++ b/src/tests/text.cpp
@@ -0,0 +1,9 @@
1#include "bu/text.h"
2
3int main( int argc, char *argv[] )
4{
5 Bu::Text txt(UR"sql(Hello there!""''"")sql");
6
7 return 0;
8}
9
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() :
19{ 19{
20} 20}
21 21
22Bu::Text::Text( const CodePoint *rSrc ) :
23 pData( NULL ),
24 bIsBmpOnly( true ),
25 iSize( 0 )
26{
27 for(; rSrc[iSize]; iSize++ ) {}
28 pData = new CodePoint[iSize+1];
29 memcpy( pData, rSrc, iSize+1 );
30}
31
22Bu::Text::Text( const Text &rSrc ) : 32Bu::Text::Text( const Text &rSrc ) :
23 pData( NULL ), 33 pData( NULL ),
24 bIsBmpOnly( rSrc.bIsBmpOnly ), 34 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
35 public: 35 public:
36 class iterator; 36 class iterator;
37 class const_iterator; 37 class const_iterator;
38 typedef uint32_t CodePoint; 38 typedef char32_t CodePoint;
39 39
40 public: 40 public:
41 Text(); 41 Text();
42 Text( const CodePoint *rSrc );
42 Text( const Text &rSrc ); 43 Text( const Text &rSrc );
43 Text( const TextBuilder &rSrc ); 44 Text( const TextBuilder &rSrc );
44 virtual ~Text(); 45 virtual ~Text();