diff options
author | Jose <jose@zeroc.com> | 2016-03-09 10:38:43 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-03-09 10:38:43 +0100 |
commit | d2f67de91d31704603122420cc68dadabf600be9 (patch) | |
tree | 4fc35ac1c7094596b98964a89bd4e51a607512d4 /cpp/src/slice2cpp | |
parent | Merge remote-tracking branch 'origin/3.6' (diff) | |
download | ice-d2f67de91d31704603122420cc68dadabf600be9.tar.bz2 ice-d2f67de91d31704603122420cc68dadabf600be9.tar.xz ice-d2f67de91d31704603122420cc68dadabf600be9.zip |
C++11 string literal fixes
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index c90dc87088b..f0c2a0a836f 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -126,6 +126,13 @@ writeConstantValue(IceUtilInternal::Output& out, const TypePtr& type, const Synt { out << 'L'; } + // + // In C++11 use utf-8 string literals for narrow strings + // + else if(cpp11) + { + out << "u8"; + } out << "\""; // Opening " for(size_t i = 0; i < value.size();) @@ -147,6 +154,15 @@ writeConstantValue(IceUtilInternal::Output& out, const TypePtr& type, const Synt { case '\\': { + // + // In C++98 UCN \unnnn and \Unnnnnnnn are converted to a sequence of OCT escaped + // bytes representing the UTF-8 encoding of the universal character, in C++11 UCN + // are not converted. + // + if(cpp11) + { + break; + } string s = "\\"; size_t j = i + 1; for(; j < value.size(); ++j) |