diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/poco/XML/src/XMLString.cpp | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/poco/XML/src/XMLString.cpp')
-rw-r--r-- | contrib/libs/poco/XML/src/XMLString.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/contrib/libs/poco/XML/src/XMLString.cpp b/contrib/libs/poco/XML/src/XMLString.cpp index 96de90352c..732d61f1a5 100644 --- a/contrib/libs/poco/XML/src/XMLString.cpp +++ b/contrib/libs/poco/XML/src/XMLString.cpp @@ -1,64 +1,64 @@ -// -// XMLString.cpp -// -// Library: XML -// Package: XML -// Module: XMLString -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/XML/XMLString.h" - - -#if defined(XML_UNICODE_WCHAR_T) -#include <stdlib.h> -#endif - - -namespace Poco { -namespace XML { - - -#if defined(XML_UNICODE_WCHAR_T) - - -std::string fromXMLString(const XMLString& str) -{ - std::string result; - result.reserve(str.size()); - - for (XMLString::const_iterator it = str.begin(); it != str.end(); ++it) - { - char c; - wctomb(&c, *it); - result += c; - } - return result; -} - - -XMLString toXMLString(const std::string& str) -{ - XMLString result; - result.reserve(str.size()); - - for (std::string::const_iterator it = str.begin(); it != str.end();) - { - wchar_t c; - int n = mbtowc(&c, &*it, MB_CUR_MAX); - result += c; - it += (n > 0 ? n : 1); - } - return result; -} - - -#endif // XML_UNICODE_WCHAR_T - - -} } // namespace Poco::XML +// +// XMLString.cpp +// +// Library: XML +// Package: XML +// Module: XMLString +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/XML/XMLString.h" + + +#if defined(XML_UNICODE_WCHAR_T) +#include <stdlib.h> +#endif + + +namespace Poco { +namespace XML { + + +#if defined(XML_UNICODE_WCHAR_T) + + +std::string fromXMLString(const XMLString& str) +{ + std::string result; + result.reserve(str.size()); + + for (XMLString::const_iterator it = str.begin(); it != str.end(); ++it) + { + char c; + wctomb(&c, *it); + result += c; + } + return result; +} + + +XMLString toXMLString(const std::string& str) +{ + XMLString result; + result.reserve(str.size()); + + for (std::string::const_iterator it = str.begin(); it != str.end();) + { + wchar_t c; + int n = mbtowc(&c, &*it, MB_CUR_MAX); + result += c; + it += (n > 0 ? n : 1); + } + return result; +} + + +#endif // XML_UNICODE_WCHAR_T + + +} } // namespace Poco::XML |