LibreOffice Module shell (master) 1
Functions | Variables
utilities.cxx File Reference
#include <sal/config.h>
#include <memory>
#include <config.hxx>
#include <global.hxx>
#include <utilities.hxx>
Include dependency graph for utilities.cxx:

Go to the source code of this file.

Functions

static std::wstring StringToWString (const std::string &String, int codepage)
 
static std::string WStringToString (const std::wstring &String, int codepage)
 
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)
 helper function to convert windows paths to short form. 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...
 
HMODULE GetCurrentModuleHandle ()
 

Variables

const size_t MAX_RES_STRING = 1024
 
const wchar_t SPACE_CHAR = L' '
 

Function Documentation

◆ GetCurrentModuleHandle()

HMODULE GetCurrentModuleHandle ( )

◆ GetResString()

std::wstring GetResString ( int  ResId)

◆ getShortPathName()

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

helper function to convert windows paths to short form.

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().

◆ StringToWString() [1/2]

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().

◆ StringToWString() [2/2]

static std::wstring StringToWString ( const std::string &  String,
int  codepage 
)
static

Definition at line 34 of file utilities.cxx.

References String.

Referenced by formatSizeOfFile(), iso8601_date_to_local_date(), StringToWString(), and UTF8ToWString().

◆ 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() [1/2]

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().

◆ WStringToString() [2/2]

static std::string WStringToString ( const std::wstring &  String,
int  codepage 
)
static

Definition at line 48 of file utilities.cxx.

References String.

Referenced by iso8601_date_to_local_date(), and WStringToString().

Variable Documentation

◆ MAX_RES_STRING

const size_t MAX_RES_STRING = 1024

Definition at line 31 of file utilities.cxx.

Referenced by GetResString().

◆ SPACE_CHAR

const wchar_t SPACE_CHAR = L' '

Definition at line 32 of file utilities.cxx.

Referenced by HasOnlySpaces().