1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SHELL_INC_INTERNAL_UTILITIES_HXX
21 #define INCLUDED_SHELL_INC_INTERNAL_UTILITIES_HXX
25 #pragma warning(push, 1)
34 #include "internal/types.hxx"
37 #define STRSAFE_NO_DEPRECATE
40 // Work around lack of strsafe library in mingw-w64, do let their
41 // strsafe.h provide inlines of StringCchVPrintfA etc, avoid linking
42 // errors in a debug build.
43 #ifdef __CRT__NO_INLINE
44 #undef __CRT__NO_INLINE
45 #define DID_UNDEFINE__CRT__NO_INLINE
57 #ifdef DID_UNDEFINE__CRT__NO_INLINE
58 #define __CRT__NO_INLINE
64 /** Convert a string to a wstring
67 std::wstring
StringToWString(const std::string
& String
);
70 /** Convert a wstring to a string
73 std::string
WStringToString(const std::wstring
& String
);
76 /** Convert a string to a wstring
79 std::wstring
UTF8ToWString(const std::string
& String
);
82 /** Retrieve a string from the
83 resources of this module
85 std::wstring
GetResString(int ResId
);
88 /** Returns whether we are running
91 bool is_windows_xp_or_above();
94 /** helper function to judge if the string is only has spaces.
96 <TRUE>if the provided string contains only but at least one space
97 character else <FALSE/>.
99 bool HasOnlySpaces(const std::wstring
& String
);
101 /** convert LocaleSet pair into Windows LCID identifier.
103 Windows Locale Identifier corresponding to input LocaleSet.
107 /** Convert a long path name using Windows api call GetShortPathName
109 std::wstring
getShortPathName( const std::wstring
& aLongName
);
112 LCID
LocaleSetToLCID( const LocaleSet_t
& Locale
);
116 inline void OutputDebugStringFormat( LPCSTR pFormat
, ... )
121 va_start( args
, pFormat
);
122 StringCchVPrintfA( buffer
, sizeof(buffer
), pFormat
, args
);
124 OutputDebugStringA( buffer
);
127 static inline void OutputDebugStringFormat( LPCSTR
, ... )
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */