From 1253523fb6f47f71a9c87b079cd983de40bdb5de Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 Dec 2009 16:24:45 +0200 Subject: Add overloaded transcode(str,len) function --- xsd-frontend/xml.hxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'xsd-frontend') diff --git a/xsd-frontend/xml.hxx b/xsd-frontend/xml.hxx index 1324a7f..7424b3e 100644 --- a/xsd-frontend/xml.hxx +++ b/xsd-frontend/xml.hxx @@ -22,13 +22,12 @@ namespace XSDFrontend inline String - transcode (XMLCh const* s) + transcode (XMLCh const* s, Size length) { if (sizeof (WideChar) == 4) { // UTF-32 // - Size length (Xerces::XMLString::stringLen (s)); XMLCh const* end (s + length); // Find what the resulting buffer size will be. @@ -79,22 +78,26 @@ namespace XSDFrontend { // UTF-16 // - return String (reinterpret_cast (s)); + return String (reinterpret_cast (s), length); } else return String (); } inline + String + transcode (XMLCh const* s) + { + return transcode (s, Xerces::XMLString::stringLen (s)); + } + + inline NarrowString transcode_to_narrow (XMLCh const* xs) { Char* s (Xerces::XMLString::transcode (xs)); - NarrowString r (s); - Xerces::XMLString::release (&s); - return r; } -- cgit v1.1