#include "GArray.h"
#include "LgiClass.h"
Go to the source code of this file.
Typedefs | |
typedef bool(* | RecursiveFileSearch_Callback )(void *UserData, char *Path, class GDirectory *Dir) |
Returns 0 to end search. | |
Functions | |
LgiFunc int | LgiBufConvertCp (void *Out, const char *OutCp, int OutLen, const void *&In, const char *InCp, int &InLen) |
Converts a buffer of text to a different charset. | |
LgiFunc void * | LgiNewConvertCp (const char *OutCp, const void *In, const char *InCp, int InLen=-1) |
Converts a string to a new charset. | |
LgiFunc char16 * | LgiNewUtf8To16 (const char *In, int InLen=-1) |
Converts a utf-8 string into a wide character string. | |
LgiFunc char * | LgiNewUtf16To8 (const char16 *In, int InLen=-1) |
Converts a wide character string into a utf-8 string. | |
LgiFunc bool | LgiIsCpImplemented (const char *Cp) |
Return true if Lgi support the charset. | |
LgiFunc const char * | LgiAnsiToLgiCp (int AnsiCodePage=-1) |
Converts the ANSI code page to a charset name. | |
LgiFunc int | LgiByteLen (const void *Str, const char *Cp) |
Calculate the byte length of a string. | |
LgiFunc int | LgiCharLen (const void *Str, const char *Cp, int Bytes=-1) |
Calculate the number of characters in a string. | |
LgiFunc char * | LgiSeekUtf8 (const char *Ptr, int D, char *Start=0) |
Move a pointer along a utf-8 string by characters. | |
LgiFunc bool | LgiIsUtf8 (const char *s, int len=-1) |
Return true if the string is valid utf-8. | |
LgiFunc char * | LgiToNativeCp (const char *In, int InLen=-1) |
Converts a string to the native 8bit charset of the OS from utf-8. | |
LgiFunc char * | LgiFromNativeCp (const char *In, int InLen=-1) |
Converts a string from the native 8bit charset of the OS to utf-8. | |
LgiFunc char * | LgiTokStr (const char *&s) |
Returns the next token in a string, leaving the argument pointing to the end of the token. | |
LgiFunc void | LgiFormatSize (char *Str, uint64 Size) |
Formats a data size into appropriate units. | |
LgiFunc char * | LgiDecodeUri (const char *uri, int len=-1) |
LgiFunc char * | LgiEncodeUri (const char *uri, int len=-1) |
LgiFunc bool | LgiGetExeFile (char *Dst, int DstSize) |
Gets the path and file name of the currently running executable. | |
LgiFunc bool | LgiGetExePath (char *Dst, int DstSize) |
Gets the path of the currently running executable. | |
LgiFunc bool | LgiGetTempPath (char *Dst, int DstSize) |
Gets the path of the temporary file directory. | |
LgiFunc bool | LgiGetSystemPath (LgiSystemPath Which, char *Dst, int DstSize) |
Returns the system path specified. | |
LgiFunc char * | LgiFindFile (const char *Name) |
Finds a file in the applications directory or nearby. | |
LgiFunc bool | LgiRecursiveFileSearch (const char *Root, GArray< const char * > *Ext=0, GArray< char * > *Files=0, uint64 *Size=0, uint64 *Count=0, RecursiveFileSearch_Callback Callback=0, void *UserData=0) |
Recursively search for files. | |
LgiFunc struct GLanguage * | LgiGetLanguageId () |
Gets the currently selected language. | |
LgiFunc const char * | LgiLoadString (int Res, const char *Default=0) |
Loads a string from the resource file. | |
LgiFunc int | LgiGetOs (GArray< int > *Ver=0) |
Returns the operating system that Lgi is running on. | |
LgiFunc const char * | LgiGetOsName () |
Gets the current operation systems name. | |
LgiFunc bool | LgiExecute (const char *File, const char *Arguments="", const char *Dir=0) |
Opens a file or directory. | |
LgiFunc void | LgiRandomize (uint Seed) |
Initializes the random number generator. | |
LgiFunc uint | LgiRand (uint Max=0) |
Returns a random number between 0 and Max-1. | |
LgiFunc bool | LgiPlaySound (const char *FileName, int Flags) |
Plays a sound. | |
LgiFunc bool | LgiGetMimeTypeExtensions (const char *Mime, GArray< char * > &Ext) |
Returns the file extensions associated with the mimetype. | |
LgiFunc bool | LgiGetFileMimeType (const char *File, char *MimeType, int BufLen) |
Returns the mime type of the file. | |
LgiFunc bool | LgiGetAppForMimeType (const char *Mime, char *AppPath, int BufSize) |
Returns the application associated with the mime type. | |
LgiFunc bool | LgiGetAppsForMimeType (const char *Mime, GArray< GAppInfo * > &Apps, int Limit=-1) |
Returns the all applications that can open a given mime type. | |
LgiFunc uint64 | LgiCurrentTime () |
Gets the current clock in milli-seconds. | |
LgiFunc int | LgiIsReleaseBuild () |
Returns true if the build is for release. |
LgiFunc char* LgiDecodeUri | ( | const char * | uri, | |
int | len = -1 | |||
) |
Converts a string from URI encoding (ala 20 -> ' ')
uri | The URI |
len | The length or -1 if NULL terminated |
References GStringPipe::NewStr(), and GStringPipe::Push().
LgiFunc char* LgiEncodeUri | ( | const char * | uri, | |
int | len = -1 | |||
) |
Converts a string to URI encoding (ala 20 -> ' ')
uri | The URI |
len | The length or -1 if NULL terminated |
References GStringPipe::NewStr(), and GStringPipe::Push().
LgiFunc bool LgiExecute | ( | const char * | File, | |
const char * | Arguments = "" , |
|||
const char * | Dir = 0 | |||
) |
Opens a file or directory.
If the input is an executable then it is run. If the input file is a document then an appropriate application is found to open the file and the file is passed to that application. If the input is a directory then the OS's file manager is openned to browse the directory.
File | The file to open |
Arguments | The arguments to pass to the program |
Dir | The directory to run in |
References GArray< Type >::Add().
LgiFunc void LgiFormatSize | ( | char * | Str, | |
uint64 | Size | |||
) |
Formats a data size into appropriate units.
Str | Output string |
Size | Input size in bytes |
LgiFunc bool LgiGetAppForMimeType | ( | const char * | Mime, | |
char * | AppPath, | |||
int | BufSize | |||
) |
Returns the application associated with the mime type.
Mime | Type of the file to find and app for |
AppPath | Path to the executable of the app that can handle the file type. |
BufSize | Size of the 'AppPath' buffer |
LgiFunc bool LgiGetAppsForMimeType | ( | const char * | Mime, | |
GArray< GAppInfo * > & | Apps, | |||
int | Limit = -1 | |||
) |
Returns the all applications that can open a given mime type.
Mime |
The type of files to match apps to. Two special cases exist:
|
Apps | The applications that can handle the |
Limit | Limit the length of the results, i.e. stop looking after 'Limit' matches. -1 means return all matches. |
LgiFunc bool LgiGetFileMimeType | ( | const char * | File, | |
char * | MimeType, | |||
int | BufLen | |||
) |
Returns the mime type of the file.
File | File to file type of |
MimeType | Pointer to buffer to receive mime-type |
BufLen | Buffer length |
References LgiApp.
LgiFunc bool LgiGetMimeTypeExtensions | ( | const char * | Mime, | |
GArray< char * > & | Ext | |||
) |
Returns the file extensions associated with the mimetype.
Mime | The returned mime type |
Ext | The extensions |
References GArray< Type >::Length().
LgiFunc int LgiGetOs | ( | GArray< int > * | Ver | ) |
Returns the operating system that Lgi is running on.
Gets the current operating system and optionally it's version.
Ver | Returns the version of the OS or NULL if you don't care |
References GArray< Type >::Add(), GArray< Type >::Length(), LGI_OS_BEOS, LGI_OS_LINUX, LGI_OS_MAC_OS_X, LGI_OS_UNKNOWN, LGI_OS_WIN9X, and LGI_OS_WINNT.
LgiFunc bool LgiGetSystemPath | ( | LgiSystemPath | Which, | |
char * | Dst, | |||
int | DstSize | |||
) |
Returns the system path specified.
Which | Which path to retreive |
Dst | The buffer to receive the path into |
DstSize | The size of the receive buffer in bytes |
References DIR_CHAR, LGI_OS_WIN9X, LgiApp, LSP_APP_INSTALL, LSP_APP_ROOT, LSP_COMMON_APP_DATA, LSP_DESKTOP, LSP_EXE, LSP_HOME, LSP_LOCAL_APP_DATA, LSP_OS, LSP_OS_LIB, LSP_TEMP, LSP_TRASH, LSP_USER_APP_DATA, LSP_USER_DOCUMENTS, LSP_USER_MUSIC, LSP_USER_VIDEO, GStringPipe::NewStr(), and GProcess::Run().
LgiFunc void* LgiNewConvertCp | ( | const char * | OutCp, | |
const void * | In, | |||
const char * | InCp, | |||
int | InLen = -1 | |||
) |
Converts a string to a new charset.
OutCp | Output charset |
In | Input buffer |
InCp | The input data's charset |
InLen | Bytes of valid data in the input |
References GCharset::Charset, GCharset::GetIconvName(), GBytePipe::GetSize(), GBytePipe::New(), GCharset::Type, and GBytePipe::Write().
LgiFunc char* LgiNewUtf16To8 | ( | const char16 * | In, | |
int | InLen = -1 | |||
) |
Converts a wide character string into a utf-8 string.
In | Input string |
InLen | Number of bytes in the input or -1 for NULL terminated |
LgiFunc bool LgiPlaySound | ( | const char * | FileName, | |
int | Flags | |||
) |
Plays a sound.
FileName | File name of the sound to play |
Flags | 0 or SND_ASYNC. If 0 the function blocks till the sound finishes. |
LgiFunc bool LgiRecursiveFileSearch | ( | const char * | Root, | |
GArray< const char * > * | Ext = 0 , |
|||
GArray< char * > * | Files = 0 , |
|||
uint64 * | Size = 0 , |
|||
uint64 * | Count = 0 , |
|||
RecursiveFileSearch_Callback | Callback = 0 , |
|||
void * | UserData = 0 | |||
) |
Recursively search for files.
Root | Start search in this dir |
Ext | Extensions to match |
Files | [optional] Output filenames |
Size | [optional] Output total size |
Count | [optional] File count |
Callback | [optional] Callback for match |
UserData | [options] Callback user data |
References GArray< Type >::Add(), DIR_CHAR, GDirectory::First(), GDirectory::GetSize(), GDirectory::IsDir(), GArray< Type >::Length(), GDirectory::Next(), and GDirectory::Path().
LgiFunc char* LgiSeekUtf8 | ( | const char * | Ptr, | |
int | D, | |||
char * | Start = 0 | |||
) |
Move a pointer along a utf-8 string by characters.
Ptr | Pointer to the current character |
D | The number of characters to move forward or back |
Start | The start of the memory buffer if you known |
References LgiNextUtf8().