Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Functions | |
std_itAdd (oIt, szToAdd) | |
Add the substring to a StdIteration object from the current cursor position. The cursor position keeps unchanged. | |
std_itGepIncluded (oIt) | |
Get if the current defined seperator is included (or not in the return. | |
std_itGet (oIt) | |
Return the initial object. | |
std_itGetLastLength (oIt) | |
Get the last given length for read. | |
std_itGetLength (oIt) | |
Get the length of a StdIteration object. | |
std_itGetPos (oIt) | |
Get the current cursor position of a StdIteration object. | |
std_itGetPosBegin (oIt) | |
Get the minimum cursor position. | |
std_itGetPosEnd (oIt) | |
Get the maximum cursor position. | |
std_itGetSep (oIt) | |
Get the current defined seperator. | |
std_itNewFile (chn, pFile) | |
Create a new StdIteration object from a File object. | |
std_itNewS (szValue) | |
Create a new StdIteration object from a string. | |
std_itNewTab (tab) | |
Create a new StdIteration object from a tab (array) object. | |
std_itRead (oIt, iLength) | |
Read the subcontent of a StdIteration object from the current cursor position and the given lenght (like the fread C-function). Next, the position will be updated (current position + lenght) | |
std_itReadNext (oIt) | |
Read the subcontent of a StdIteration object from the current cursor position to one unit (byte, char or other) (like the fread C-function). Next, the position will be updated (current position + 1) | |
std_itReadSep (oIt) | |
Read the subcontent of a StdIteration object from the current cursor position until the next separator found. | |
std_itSepIncluded (oIt, iFlag) | |
Set if the separator is included in the return or not. | |
std_itSetCb (oIt, cbfun) | |
Set the function called for each iteration. | |
std_itSetCbEnd (oIt, cbfun) | |
Set the function called when the ioterator comes to the end. | |
std_itSetPosBegin (oIt, iPosBegin) | |
Set the minimum cursor position. By default it is 0. | |
std_itSetPosEnd (oIt, iPosEnd) | |
Set themaximum cursor position. By default it is the lenght of the object. | |
std_itSetSep (oIt, iSep) | |
Define a separator for a StdIteration object. | |
std_itSetSepFromS (oIt, szSep) | |
Define a separator for a StdIteration object. | |
std_itUpdatePos (oIt, iPos, iFlag) | |
Read the subcontent of a StdIteration tab (array) object from the current cursor position and the given lenght (like the fread C-function). Next, the position will be updated (current position + lenght) |
Detailed Description
Package to load : lib/std/iteration.pkg
Dependancies :
- lib/std/stdlib.pkg
- lib/std/string.pkg (lib/std/stdlib.pkg is also required for this last package)
Function Documentation
std_itNewS | ( | szValue | ) |
Create a new StdIteration object from a string.
Prototype : fun [S] StdIteration
The current cursor position is put at 0.
- Parameters
-
S : an inital string to iterate
- Returns
- StdIteration : the new StdIteration object
- See Also
- std_itUpdatePos to change the position
std_itNewFile | ( | chn | , |
pFile | |||
) |
Create a new StdIteration object from a File object.
Prototype : fun [Chn P] StdIteration
The current cursor position is put at 0.
- Parameters
-
Chn : a channel, like the current channel (_channel) P : a read file reference to iterate
- Returns
- StdIteration : the new StdIteration object
- See Also
- std_itUpdatePos to change the position
std_itNewTab | ( | tab | ) |
Create a new StdIteration object from a tab (array) object.
Prototype : fun [tab u0] StdIteration
The current cursor position is put at 0.
- Parameters
-
tab u0 : a table (array) to iterate
- Returns
- StdIteration : the new StdIteration object
- See Also
- std_itUpdatePos to change the position
- Warning
- Removed !
std_itRead | ( | oIt | , |
iLength | |||
) |
Read the subcontent of a StdIteration object from the current cursor position and the given lenght (like the fread C-function). Next, the position will be updated (current position + lenght)
Prototype : fun [StdIteration I] S
- Parameters
-
StdIteration : a StdIteration object to iterate I : a lenght (can be a negative or positive integer)
- Returns
- S : the subcontent or nil if an error occurs
- See Also
- std_itSetCb
- std_itReadTab
std_itReadNext | ( | oIt | ) |
Read the subcontent of a StdIteration object from the current cursor position to one unit (byte, char or other) (like the fread C-function). Next, the position will be updated (current position + 1)
Prototype : fun [StdIteration] S
- Parameters
-
StdIteration : a StdIteration object to iterate
- Returns
- S : the subcontent or nil if an error occurs
- See Also
- std_itRead
std_itUpdatePos | ( | oIt | , |
iPos | , | ||
iFlag | |||
) |
Read the subcontent of a StdIteration tab (array) object from the current cursor position and the given lenght (like the fread C-function). Next, the position will be updated (current position + lenght)
Prototype : fun [StdIteration I] tab u0
- Parameters
-
StdIteration : a StdIteration object to iterate I : a lenght (can be a negative or positive integer)
- Returns
- tab u0 : a new tab (its size is the given length) or nil if an error occurs
- See Also
- std_itRead Removed !
Update the cursor position.
Prototype : fun [StdIteration I I] StdIteration
- Parameters
-
StdIteration : a StdIteration object to iterate I : a new position (if negative, the new position will be 0, if too long, the new position will be truncated. I : a flag : - STD_IT_FROMBEGIN : position given from beginning of the object
- STD_IT_FROMCURRENT : position given from the current cursor position of the object
- STD_IT_FROMEND : position given from end of the object
- Returns
- StdIteration : the same StdIteration object or nil if an error occurs
std_itSetPosBegin | ( | oIt | , |
iPosBegin | |||
) |
Set the minimum cursor position. By default it is 0.
Prototype : fun [StdIteration I] StdIteration
- Parameters
-
StdIteration : a StdIteration object to iterate I : a new minimum position (can be negative, the new position will be from the maximum).
- Returns
- StdIteration : the same StdIteration object or nil if an error occurs
- See Also
- std_itSetPosEnd
std_itSetPosEnd | ( | oIt | , |
iPosEnd | |||
) |
Set themaximum cursor position. By default it is the lenght of the object.
Prototype : fun [StdIteration I I] StdIteration
- Parameters
-
StdIteration : a StdIteration object to iterate I : a new maximum position (can be negative, the new position will be from the old maximum).
- Returns
- StdIteration : the same StdIteration object or nil if an error occurs
- See Also
- std_itSetPosBegin
std_itGetPosBegin | ( | oIt | ) |
Get the minimum cursor position.
Prototype : fun [StdIteration] I
- Parameters
-
StdIteration : a StdIteration object to iterate
- Returns
- I : the minimum position
std_itGetPosEnd | ( | oIt | ) |
Get the maximum cursor position.
Prototype : fun [StdIteration] I
- Parameters
-
StdIteration : a StdIteration object to iterate
- Returns
- I : the maximum position
std_itGetLength | ( | oIt | ) |
Get the length of a StdIteration object.
Prototype : fun [StdIteration] I
- Parameters
-
StdIteration : a StdIteration object to iterate
- Returns
- I : this length or nil if error / not supported
std_itGetPos | ( | oIt | ) |
Get the current cursor position of a StdIteration object.
Prototype : fun [StdIteration] I
- Parameters
-
StdIteration : a StdIteration object to iterate
- Returns
- I : the current position or nil if error
std_itGetLastLength | ( | oIt | ) |
Get the last given length for read.
Prototype : fun [StdIteration] I
- Parameters
-
StdIteration : a StdIteration object to iterate
- Returns
- I : this last length or nil if error
std_itGet | ( | oIt | ) |
Return the initial object.
Prototype : fun [StdIteration] S
- Parameters
-
StdIteration : a StdIteration object to iterate
- Returns
- S : the object : a string, a path name, ... or nil if error
std_itSetCbEnd | ( | oIt | , |
cbfun | |||
) |
Set the function called when the ioterator comes to the end.
Prototype : fun [StdIteration fun [StdIteration] I] StdIteration
- Parameters
-
StdIteration : a StdIteration object to iterate fun [StdIteration] I : the callback (the argument is the StdIteration object itself)
- Returns
- StdIteration : the same StdIteration object or nil if an error occurs
std_itSetCb | ( | oIt | , |
cbfun | |||
) |
Set the function called for each iteration.
Prototype : fun [StdIteration fun [StdIteration S] I] StdIteration
- Parameters
-
StdIteration : a StdIteration object to iterate fun [StdIteration S] I : the callback. The arguments are : - the StdIteration object itself
- the sub-content
- Returns
- StdIteration : the same StdIteration object or nil if an error occurs
- See Also
- std_itRead
std_itAdd | ( | oIt | , |
szToAdd | |||
) |
Add the substring to a StdIteration object from the current cursor position. The cursor position keeps unchanged.
Prototype : fun [StdIteration S] StdIteration
- Parameters
-
StdIteration : a StdIteration object to iterate S : a string to add (to include)
- Returns
- StdIteration : the same StdIteration object or nil if an error occurs
std_itSetSep | ( | oIt | , |
iSep | |||
) |
Define a separator for a StdIteration object.
A separator is an ascii value.
Prototype : fun [StdIteration I] StdIteration
- Parameters
-
StdIteration : a StdIteration object to iterate I : an ascii value
- Returns
- StdIteration : the same StdIteration object or nil if an error occurs
- See Also
- std_itSetSepFromS
std_itSetSepFromS | ( | oIt | , |
szSep | |||
) |
Define a separator for a StdIteration object.
A separator is an ascii value.
Prototype : fun [StdIteration S] StdIteration
- Parameters
-
StdIteration : a StdIteration object to iterate S : a string. The first char will take off only, others are ignored. This function is a convenience to avoid to give the ascii value directly.
- Returns
- StdIteration : the same StdIteration object or nil if an error occurs
- See Also
- std_itSetSep
std_itGetSep | ( | oIt | ) |
Get the current defined seperator.
Prototype : fun [StdIteration] I
- Parameters
-
StdIteration : a StdIteration object to iterate
- Returns
- I : the ascii value of the current separator (nil if undefined)
std_itSepIncluded | ( | oIt | , |
iFlag | |||
) |
Set if the separator is included in the return or not.
Prototype : fun [StdIteration I] StdIteration
- Parameters
-
StdIteration : a StdIteration object to iterate I : 1 to include, 0 to not include (default)
- Returns
- StdIteration : the same StdIteration object or nil if an error occurs
- See Also
- std_itReadSep
std_itGepIncluded | ( | oIt | ) |
Get if the current defined seperator is included (or not in the return.
Prototype : fun [StdIteration] I
- Parameters
-
StdIteration : a StdIteration object to iterate
- Returns
- I : 1 if included else 0
- See Also
- std_itReadSep
std_itReadSep | ( | oIt | ) |
Read the subcontent of a StdIteration object from the current cursor position until the next separator found.
If the separator is not found, th ewhole subcontent from the current sursor position until the end position is returned. Next, the cursor position will be updated.
Prototype : fun [StdIteration] S
- Parameters
-
StdIteration : a StdIteration object to iterate
- Returns
- S : the subcontent or nil if an error occurs
- See Also
- std_itSepIncluded
- std_itSetSep
- std_itRead
- std_itSetPosEnd to define the end position (otherwise, it is the end of the object)
Generated on Sat Jan 31 2015 19:15:45 for Scol standard library package by 1.8.1.2