ParaScripting::ParaMisc Class Reference
[ParaMisc]

List of all members.

Detailed Description

Contains miscellaneous functions.


Static Public Member Functions

static bool IsNumber (const char *str)
static bool IsLetter (const char *str)
static int StrToInt (const char *str)
static double StrToFloat (const char *str)
static void DevideString (const string &input, string &str1, string &str2, char separator=';')
static bool RegularMatch (const char *input, const char *expression)
static string ToCString (const char *input)
static string StrReplace (const char *inputstring, char srcchar, char destchar)
static RECT * GetImageAndRect (const string &str, string &imagefile, RECT *pOut=NULL)
static int GetUnicodeCharNum (const char *str)
 get the number of characters in str.
static string UniSubString (const char *str, int nFrom, int nTo)
 same as LUA string.sub(), except that the index is character.
static const char * SimpleEncode (const char *source)
 encode a string using really simple algorithm.
static const char * SimpleDecode (const char *source)
 decode a string using really simple algorithm.
static const char * EncodingConvert (const char *srcEncoding, const char *dstEncoding, const char *bytes)
 Converts an entire byte array from one encoding to another.
static bool CopyTextToClipboard (const char *text)
 copy text to clipboard.
static const char * GetTextFromClipboard ()
 get text from clipboard.


Member Function Documentation

int ParaScripting::ParaMisc::GetUnicodeCharNum ( const char *  str  )  [static]

get the number of characters in str.

Str is assumed to be in ANSI code page. it is converted to Unicode and return the character count.

std::string ParaScripting::ParaMisc::UniSubString ( const char *  str,
int  nFrom,
int  nTo 
) [static]

same as LUA string.sub(), except that the index is character.

get a sub string of a ANSI Code page string. However, the index are unicode characters.

Parameters:
str,: the string to use
nFrom,: character index beginning from 1.

const char * ParaScripting::ParaMisc::SimpleEncode ( const char *  source  )  [static]

encode a string using really simple algorithm.

it just makes the source ineligible. It is still not immune to crackers. str = SimpleDecode(SimpleEncode(str))

Returns:
: it may return NULL if input invalid

const char * ParaScripting::ParaMisc::SimpleDecode ( const char *  source  )  [static]

decode a string using really simple algorithm.

str = SimpleDecode(SimpleEncode(str))

Returns:
: it may return NULL if input invalid

const char * ParaScripting::ParaMisc::EncodingConvert ( const char *  srcEncoding,
const char *  dstEncoding,
const char *  bytes 
) [static]

Converts an entire byte array from one encoding to another.

Parameters:
srcEncoding,: any encoding name. If nil or "", it is the default coding in NPL. see Encoding.GetEncoding(). Below are some commonly used field | *Code Page* | *Name* | | 950 | big5 | | 936 | gb2312 | | 65001 | utf-8 | | 65005 | utf-32 | There is one special code name called "HTML", which contains HTML special characters in ascii code page. This is usually true for most "iso8859-15" encoding in western worlds. It just writes the unicode number+XXXX in ascii character "&#XXXX;" where & is optional.
dstEncoding,: save as above. If nil or "", it will be converted to default coding in NPL. : the source bytes. e.g. The most common use of this function is to create HTML special character to NPL string, like below local text = ParaMisc.EncodingConvert("HTML", "", "Chinese characters: 开发") log(text);

bool ParaScripting::ParaMisc::CopyTextToClipboard ( const char *  text  )  [static]

copy text to clipboard.

Input is ANSI code page

const char * ParaScripting::ParaMisc::GetTextFromClipboard (  )  [static]

get text from clipboard.

text is converted to ANSI code page when returned.


Generated on Mon Dec 1 14:34:45 2008 for NPL Scripting Reference for ParaEngine by  doxygen 1.5.2