/* * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
#ifdef TSTRINGS_WITH_WCHAR #include <windows.h> #include <tchar.h> // Want compiler issue C4995 warnings for encounters of deprecated functions. #include <strsafe.h> #endif
// STL's string header depends on deprecated functions. // We don't care about warnings from STL header, so disable them locally. #ifdef _MSC_VER # pragma warning(push) # pragma warning(disable:4995) #endif
/** * Writes sequence of values from [b, e) range into string buffer inserting * 'delimiter' after each value except of the last one. * Returns contents of string buffer.
*/ template <class It>
tstring join(It b, It e, const tstring& delimiter=tstring()) {
tostringstream buf; if (b != e) { for (;;) {
buf << *b; if (++b == e) { break;
}
buf << delimiter;
}
} return buf.str();
}
namespace tstrings { /** * Buffer that accepts both std::wstring and std::string instances doing * encoding conversions behind the scenes. All std::string-s assumed to be * UTF8-encoded, all std::wstring-s assumed to be UTF16-encoded.
*/ class any { public:
any() {
}
any(std::string::const_pointer msg) {
data << fromUtf8(msg);
}
any(const std::string& msg) {
data << fromUtf8(msg);
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.18Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.