diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-12-04 16:24:45 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-12-04 16:24:45 +0200 |
commit | 1253523fb6f47f71a9c87b079cd983de40bdb5de (patch) | |
tree | 2508d3badd8b01281648e447d4eabde020c474df | |
parent | 713055a9abc9a076209deef9ceae050039d73849 (diff) |
Add overloaded transcode(str,len) function
-rw-r--r-- | xsd-frontend/xml.hxx | 15 |
1 files changed, 9 insertions, 6 deletions
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<const WideChar*> (s)); + return String (reinterpret_cast<const WideChar*> (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; } |