LibreOffice Module shell (master) 1
Macros | Functions
utilities.hxx File Reference
#include <malloc.h>
#include <windows.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include "types.hxx"
#include <string>
#include <strsafe.h>
Include dependency graph for utilities.hxx:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 
#define STRSAFE_NO_DEPRECATE
 

Functions

std::wstring StringToWString (const std::string &String)
 Convert a string to a wstring using CP_ACP. More...
 
std::string WStringToString (const std::wstring &String)
 Convert a wstring to a string using CP_ACP. More...
 
std::wstring UTF8ToWString (const std::string &String)
 Convert a string to a wstring using CP_UTF8. More...
 
std::wstring GetResString (int ResId)
 Retrieve a string from the resources of this module. More...
 
bool HasOnlySpaces (const std::wstring &String)
 helper function to judge if the string is only has spaces. More...
 
std::wstring getShortPathName (const std::wstring &aLongName)
 convert LocaleSet pair into Windows LCID identifier. More...
 
LCID LocaleSetToLCID (const LocaleSet_t &Locale)
 convert LocaleSet pair into Microsoft List of Locale ID (LCID) according to ISO-639 and ISO-3166. More...
 
void OutputDebugStringFormatW (LPCWSTR pFormat,...)
 

Macro Definition Documentation

◆ STRSAFE_NO_DEPRECATE

#define STRSAFE_NO_DEPRECATE

Definition at line 36 of file utilities.hxx.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 26 of file utilities.hxx.

Function Documentation

◆ GetResString()

std::wstring GetResString ( int  ResId)

◆ getShortPathName()

std::wstring getShortPathName ( const std::wstring &  aLongName)

convert LocaleSet pair into Windows LCID identifier.

Returns
Windows Locale Identifier corresponding to input LocaleSet. Convert a long path name using Windows api call GetShortPathName

convert LocaleSet pair into Windows LCID identifier.

Returns
shortened path.

Definition at line 122 of file utilities.cxx.

References length.

Referenced by CThumbviewer::Extract(), CColumnInfo::GetItemData(), CPropertySheet::Initialize(), CInfoTip::Load(), and COooFilter::Load().

◆ HasOnlySpaces()

bool HasOnlySpaces ( const std::wstring &  String)

helper function to judge if the string is only has spaces.

Returns
<TRUE>if the provided string contains only but at least one space character else <FALSE>.

Definition at line 100 of file utilities.cxx.

References p, SPACE_CHAR, and String.

Referenced by CContentReader::characters(), and CMetaInfoReader::characters().

◆ LocaleSetToLCID()

LCID LocaleSetToLCID ( const LocaleSet_t Locale)

convert LocaleSet pair into Microsoft List of Locale ID (LCID) according to ISO-639 and ISO-3166.

http://etext.lib.virginia.edu/tei/iso639.html http://nl.ijs.si/gnusl/cee/std/ISO_3166.html

Parameters
Locale,LocaleSet
Returns
Windows Locale Identifier corresponding to input LocaleSet. @Usage Sample LocaleSet_t myDefaultLocale( ::std::wstring( L"zh" ),::std::wstring(L"HK") ); DWORD myLCID = LocaleSetToLCID( myDefaultLocale ); wchar_t buffer[20]; _ultow( myLCID, buffer, 16 ); MessageBox( NULL, buffer,L"the LCID is:",MB_OK );

Definition at line 154 of file utilities.cxx.

References EMPTY_LOCALE, LANG_SPANISH, and Locale.

Referenced by COooFilter::GetChunk().

◆ OutputDebugStringFormatW()

void OutputDebugStringFormatW ( LPCWSTR  pFormat,
  ... 
)
inline

◆ StringToWString()

std::wstring StringToWString ( const std::string &  String)

Convert a string to a wstring using CP_ACP.

Definition at line 63 of file utilities.cxx.

References String, and StringToWString().

◆ UTF8ToWString()

std::wstring UTF8ToWString ( const std::string &  String)

Convert a string to a wstring using CP_UTF8.

Definition at line 75 of file utilities.cxx.

References String, and StringToWString().

◆ WStringToString()

std::string WStringToString ( const std::wstring &  String)

Convert a wstring to a string using CP_ACP.

Definition at line 69 of file utilities.cxx.

References String, and WStringToString().