SysInfo: Functions4U changes

git-svn-id: svn://ultimatepp.org/upp/trunk@1743 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2009-12-08 13:54:17 +00:00
commit eae48311aa
7 changed files with 108 additions and 1914 deletions

View file

@ -14,15 +14,6 @@ topic "SysInfo function reference";
[s0; &]
[s0; &]
[ {{10000@1 [s0; [* Running files and commands]]}}&]
[s3; &]
[s5;:GetExtExecutable`(const String`):%- [_^String^ String]_[* GetExtExecutable]([@(0.0.255) c
onst]_[_^String^ String]_[*@3 ext])&]
[s2; Gets the program that will open by default the files with extension
[%-*@3 ext].&]
[s0; &]
[s0; -|[/ Example:]&]
[s0; [/ -|GetExtExecutable(`"html`") `-> `"Firefox.exe`"]&]
[s3; &]
[s4;%- &]
[s5;:LaunchFile`(const String`):%- [@(0.0.255) bool]_[* LaunchFile]([@(0.0.255) const]_[_^String^ S
tring]_[*@3 file])&]
@ -34,62 +25,8 @@ in the OS by default.&]
program (probably Notepad) with document `"My spreadsheet.txt`".]&]
[s3; &]
[s0; &]
[ {{10000@1 [s0; [* Obtaining special folders]]}}&]
[s0;%- &]
[s5;:GetDesktopFolder`(`):%- [_^String^ String]_[* GetDesktopFolder]()&]
[s2; Gets the default Desktop folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetProgramsFolder`(`):%- [_^String^ String]_[* GetProgramsFolder]()&]
[s2; Gets the default programs folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetAppDataFolder`(`):%- [_^String^ String]_[* GetAppDataFolder]()&]
[s2; Gets the default application data folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetMusicFolder`(`):%- [_^String^ String]_[* GetMusicFolder]()&]
[s2; Gets the default music files folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetPicturesFolder`(`):%- [_^String^ String]_[* GetPicturesFolder]()&]
[s2; Gets the default picture files folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetVideoFolder`(`):%- [_^String^ String]_[* GetVideoFolder]()&]
[s2; Gets the default video files folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetPersonalFolder`(`):%- [_^String^ String]_[* GetPersonalFolder]()&]
[s2; Gets the default personal files folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetTemplatesFolder`(`):%- [_^String^ String]_[* GetTemplatesFolder]()&]
[s2; Gets the default templates files folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetDownloadFolder`(`):%- [_^String^ String]_[* GetDownloadFolder]()&]
[s2; Gets the default file download folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetRootFolder`(`):%- [_^String^ String]_[* GetRootFolder]()&]
[s2; Gets the default root folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetTempFolder`(`):%- [_^String^ String]_[* GetTempFolder]()&]
[s2; Gets the default temp files folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetOsFolder`(`):%- [_^String^ String]_[* GetOsFolder]()&]
[s2; Gets the default operating system files folder path.&]
[s3;%- &]
[s4;%- &]
[s5;:GetSystemFolder`(`):%- [_^String^ String]_[* GetSystemFolder]()&]
[s2; Gets the default system files folder path.&]
[s3;%- &]
[s0; &]
[ {{10000@1 [s0; [* Hardware, BIOS, OS and Distro info]]}}&]
[s0;%- &]
[s4;%- &]
[s5;:GetSystemInfo`(String`&`,String`&`,String`&`,int`&`):%- [@(0.0.255) void]_[* GetSyst
emInfo]([_^String^ String]_`&[*@3 manufacturer], [_^String^ String]_`&[*@3 productName],
[_^String^ String]_`&[*@3 version], [@(0.0.255) int]_`&[*@3 numberOfProcessors])&]
@ -519,22 +456,7 @@ mouse movement if [%-*@3 viewMouse].is true.&]
[s2; -|-|`- Windows: Uncompressed .avi&]
[s3; &]
[ {{10000@1 [s0; [* Miscellaneous functions]]}}&]
[s0; &]
[s5;:LoadFile`_Safe`(String`):%- [_^String^ String]_[* LoadFile`_Safe]([_^String^ String]_[*@3 f
ileName])&]
[s2; Same as LoadFile([%-*@3 fileName]) but it works in Posix for files
automatically generated by the OS.&]
[s0; &]
[s0; U`+`+ LoadFile() functions prior to loading the file into a
String, get the length of the file to dimension the String that
will get the file. This is not valid for OS generated virtual
files where the file length returned by the OS is 0 (for example
files under folder /proc)&]
[s0; &]
[s0; LoadFile`_Safe() just get the file bytes returned by the OS
until the file end.&]
[s3; &]
[s4;%- &]
[s4; &]
[s5;:FileToTrashBin`(const char`*`):%- [@(0.0.255) void]_[* FileToTrashBin]([@(0.0.255) con
st]_[@(0.0.255) char]_`*[*@3 path])&]
[s2; Deletes file [%-*@3 path].by sending it to the Trash Bin.&]
@ -554,102 +476,11 @@ Trash Bin.&]
onst]_[@(0.0.255) char]_`*[*@3 path])&]
[s2; Sets [%-*@3 path].file as desktop wallpaper. Supports Gnome, Kde
v3 and Windows desktops.&]
[s0; &]
[s0;i150;O0; In Gnome, [%-*@3 path] has to be .png&]
[s0;i150;O0; In Kde, [%-*@3 path] has to be .png, .gif or .jpg&]
[s0;i150;O0; In Windows, [%-*@3 path] has to be .bmp&]
[s0; &]
[s0; If [%-*@3 path].is empty, the desktop wallpaper is removed. &]
[s0; &]
[s4;%- &]
[s5;:FileCat`(const char`*`,const char`*`):%- [@(0.0.255) bool]_[* FileCat]([@(0.0.255) con
st]_[@(0.0.255) char]_`*[*@3 file], [@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 appendFile])
[s0;l288; &]
[s0;l288;i150;O0; In Gnome, [%-*@3 path] has to be .png&]
[s0;l288;i150;O0; In Kde, [%-*@3 path] has to be .png, .gif or .jpg&]
[s0;l288;i150;O0; In Windows, [%-*@3 path] has to be .bmp&]
[s0;l288; &]
[s0;l288; If [%-*@3 path].is empty, the desktop wallpaper is removed.
&]
[s2; Appends at the end of [%-*@3 file] the contents of file [%-*@3 appendFile].
[%-*@3 file] will be modified and [%-*@3 appendFile ]remains unchanged.&]
[s0; -|Returns true if the operations has been done succesfully.&]
[s3;%- &]
[s4;%- &]
[s5;:Replace`(String`,String`,String`):%- [_^String^ String]_[* Replace]([_^String^ String]_
[*@3 str], [_^String^ String]_[*@3 find], [_^String^ String]_[*@3 replace])&]
[s2; Returns the resulting String obtained by replacing in [%-*@3 str]
String [%-*@3 find] with [%-*@3 replace ]all the times that [%-*@3 find
]appears in [%-*@3 str].&]
[s0; &]
[s4;%- &]
[s5;:ReverseFind`(const String`&`,const String`&`,int`):%- [@(0.0.255) int]_[* ReverseFin
d]([@(0.0.255) const]_[_^String^ String][@(0.0.255) `&]_[*@3 s], [@(0.0.255) const]_[_^String^ S
tring][@(0.0.255) `&]_[*@3 toFind], [@(0.0.255) int]_[*@3 from]_`=_[@3 0])&]
[s2; Find in [%-*@3 s] the string [%-*@3 toFind] beginning in [%-*@3 from
]in reverse order.&]
[s2; Similar to Find() but searching to the beginning of the String.&]
[s3; &]
[s4;%- &]
[s5;:FormatLong`(long`):%- [_^String^ String]_[* FormatLong]([@(0.0.255) long]_[*@3 a])&]
[s2; Returns the long number [%-*@3 a ]converted into a String.&]
[s0; &]
[s4;%- &]
[s5;:Sign`(T`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[@(0.0.255) int]_[* Sign](
[*@4 T]_[*@3 a])&]
[s2; Returns&]
[s2;i150;O0; `+1 if [%-*@3 a]. is positive&]
[s2;i150;O0; 0 if [%-*@3 a] is 0 and &]
[s2;i150;O0; `-1 if [%-*@3 a] is negative.&]
[s3; &]
[s4;%- &]
[s5;:GetUpperFolder`(String`):%- [_^String^ String]_[* GetUpperFolder]([_^String^ String]_[*@3 f
olderName])&]
[s2; Returns the name of the upper folder over [%-*@3 folderName].&]
[s3; &]
[s4;%- &]
[s5;:CreateFolderDeep`(const char`*`):%- [@(0.0.255) bool]_[* CreateFolderDeep]([@(0.0.255) c
onst]_[@(0.0.255) char]_`*[*@3 dir])&]
[s2; Creates folder [%-*@3 dir], creating intermediate folders if necessary&]
[s3; &]
[s4;%- &]
[s5;:SecondsToString`(double`,bool`):%- [_^String^ String]_[* SecondsToString]([@(0.0.255) d
ouble]_[*@3 seconds], [@(0.0.255) bool]_[*@3 decimals]_`=_[@(0.0.255) false])&]
[s2; Converts an amount of [%-*@3 seconds] to a String formatted as
HH:MM:SS.&]
[s0; -|If [%-*@3 decimals ]it includes decimals in seconds&]
[s0; -|It is opposite to StringToSeconds()&]
[s3; &]
[s4;%- &]
[s5;:StrToTime`(struct Time`&`,const char`*`):%- [@(0.0.255) const]_[@(0.0.255) char]_`*[* S
trToTime]([@(0.0.255) struct]_[_^Time^ Upp`::Time][@(0.0.255) `&]_[*@3 d],
[@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 s])&]
[s2;%- Scans a string for a Time. Order of day, month and year is
specified using SetDateScan. In place of month both number and
text is accepted `- text must match abbreviated or full name
of month.&]
[s0;%- -|Similar to StrToDate() but including both date and time.&]
[s2;%- [*@3 d]-|Found time.&]
[s2;%- [*@3 s]-|String to scan.&]
[s2;%- Return value-|NULL if no time is found in [*@3 s] or pointer
to character right after the date.&]
[s3; &]
[s4;%- &]
[s5;:StringToSeconds`(String`):%- [@(0.0.255) double]_[* StringToSeconds]([_^String^ String
]_[*@3 str])&]
[s2; It converts a String [%-*@3 str ]formatted as HH:MM:SS to a returned
amount of seconds.&]
[s0; -|It is opposite to SecondsToString()&]
[s3; &]
[s4;%- &]
[s5;:BytesToString`(uint64`):%- [_^String^ String]_[* BytesToString]([_^uint64^ uint64]_[*@3 b
ytes])&]
[s2; Converts an amount of [%-*@3 bytes ]to a short String.&]
[s3; &]
[s4;%- &]
[s5;:DoEvents`(`):%- [@(0.0.255) void]_[* DoEvents]()&]
[s2; A ProcessEvents just for old Visual Basic programmers.&]
[s3; &]
[s4;%- &]
[s5;:SearchFile`(String`,String`,String`):%- [_^Array^ Array]<[_^String^ String]>_[* Search
File]([_^String^ String]_[*@3 dir], [_^String^ String]_[*@3 condFile],
[_^String^ String]_[*@3 text]_`=_`"`")&]
[s2; Returns an Array of Strings containing the file names with full
path of the files under folder [%-*@3 dir] that comply with condition
(with wildcards) [%-*@3 condFile] and that contain inside the text
[%-*@3 text].&]
[s0; ]