/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #include #include namespace o3tl { #if defined _WIN32 // Helpers for safe conversion between wchar_t and char16_t in MSVC static_assert(sizeof(char16_t) == sizeof(wchar_t), "These helper functions are only applicable to implementations with 16-bit wchar_t"); // While other implementations define wchar_t as 32-bit integral value, and mostly use // char-based UTF-8 string APIs, in MSVC wchar_t is (non-conformant) 16-bit, and Unicode // support is implemented by Unicode-aware WinAPI functions taking UTF-16 LE strings, // and also stdlib functions taking those strings. // // In LibreOffice, internal string representation is also UTF-16 with system endianness // (sal_Unicode that is typedef for char16_t); so it is an important implementation concept // to treat internal strings as directly usable by WinAPI/stdlib functions and vice versa. // Also, it's important to use safe conversion between unrelated underlying C++ types // used for MSVC and LibreOffice string storage without plain reinterpret_cast that brings // risks of masking errors like casting char buffers to wchar_t/char16_t. // // Use these helpers for wchar_t (WSTR, WCHAR, OLESTR etc) to char16_t (sal_Unicode) string // conversions instead of reinterpret-cast in Windows-specific code. inline wchar_t* toW(char16_t* p) { return reinterpret_cast(p); } inline wchar_t const* toW(char16_t const* p) { return reinterpret_cast(p); } inline char16_t* toU(wchar_t* p) { return reinterpret_cast(p); } inline char16_t const* toU(wchar_t const* p) { return reinterpret_cast(p); } inline std::u16string_view toU(std::wstring_view v) { return { toU(v.data()), v.size() }; } inline std::wstring_view toW(std::u16string_view v) { return { toW(v.data()), v.size() }; } #endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ /cd-5.3-3.4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/oox/inc/pch
AgeCommit message (Expand)Author
2023-10-11Drop o3tl::span, can use C++20 std::span directly nowStephan Bergmann
2023-08-15ComplexColor various clean-up and (trivial) refactoringsTomaž Vajngerl
2023-07-23vcl: Drop now unneeded DevicePoint typedefKhaled Hosny
2023-01-12introduce docmodel comp., model::ThemeColor, use it in SvxColorItemTomaž Vajngerl
2022-08-18Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxxStephan Bergmann
2021-09-28vcl: rename OutDevState to StackChris Sherlock
2021-06-15vcl: outdevmap.hxx -> rendercontext/ImplMapRes.hxxChris Sherlock
2021-04-08update PCHsLuboš Luňák
2021-04-06update pchesCaolán McNamara
2021-03-09Make sal/config.h the first in pchMike Kaganski
2021-02-19update pchesCaolán McNamara
2021-02-08update pchesCaolán McNamara
2020-12-04update pchesCaolán McNamara
2020-08-12SvTreeListBox can move into toolkit headers nowCaolán McNamara
2020-07-12update pchesCaolán McNamara
2020-04-26update pchesCaolán McNamara
2020-04-22uiobject.hxx only needs forward declaresCaolán McNamara
2020-02-21Drop o3tl::optional wrapperStephan Bergmann
2020-02-01make update_pch also consider files in <module>/src/**/incLuboš Luňák
2019-12-01Introduce o3tl::optional as an alias for std::optionalStephan Bergmann
2019-10-18make bin/update_pch.s always include code in trivial #if'sLuboš Luňák
2019-05-09regenerate PCH headers for the 4 new levelsLuboš Luňák
2019-04-28rename animate.hxx to animate/Animation.hxx, more changes followTomaž Vajngerl
2018-09-28oox: create ShapeContextHandler instances with an uno constructorMiklos Vajna
2018-03-02delete colordata.hxxNoel Grandin
2017-09-22Fresh run of bin/update_pch.shMike Kaganski
2017-07-15emfplus: create a wmf/emf/emf+ primitive based importerArmin Le Grand
2017-04-25errinf.hxx moved out of tools and into vcl moduleChris Sherlock