MoveFromId (Stringlist subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
 
(22 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:Stringlist:MoveFromId subtitle}}
{{Template:Stringlist:MoveFromId subtitle}}


This method moves data ($list items) from a $list to a Stringlist. MoveFromId is a subroutine that accepts one argument: the $list identifier of the $list from which data is to be moved. For more information about $list identifiers, see the ''Sirius Functions Reference Manual''.
This method moves data ([[$lists|$list]] items) from a $list to a <var>Stringlist</var>. <var>MoveFromId</var> is a subroutine that accepts one argument: the $list identifier of the $list from which data is to be moved.  
 
MoveFromId is a member of the [[Stringlist class]].


==Syntax==
==Syntax==
{{Template:Stringlist:MoveFromId syntax}}
{{Template:Stringlist:MoveFromId syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>sl </th>
<tr><th>sl</th>
<td>A Stringlist object.</td></tr>
<td>A <var>Stringlist</var> object.</td></tr>
<tr><th>listid</th>
 
<tr><th>listId</th>
<td>The $list identifier of the $list from which data is to be moved.</td></tr>
<td>The $list identifier of the $list from which data is to be moved.</td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
<ul><li>All errors in MoveFromId result in request cancellation.<li>After the MovefromId method is invoked, the source $list is empty, though the $list identifier is still valid.<li>MoveFromId discards the original contents of the method Stringlist.<li>The MoveFromId method copies to the method Stringlist any image association that is set via $listimg.<li>MoveFromid simply moves the pointers to the $list data to the object Stringlist. It does '''not''' actually perform any data movement; therefore, it is extremely efficient.<li>MoveFromid is intended to facilitate migration to Stringlists of existing applications that use $lists. For example, suppose complex subroutine Summarize takes a $list identifier as its input parameter. Further suppose that the subroutine is rewritten to use Stringlists rather than $lists.  
<ul>
The following code illustrates how this can be accomplished:
<li>All errors in <var>MoveFromId</var> result in request cancellation.
 
<li>After <var>MovefromId</var> is invoked, the source $list will be emptied, although the $list identifier is still valid.
 
<li><var>MoveFromId</var> discards any current contents of the method <var>Stringlist</var>.
 
<li><var>MoveFromId</var> copies to the method <var>Stringlist</var> any image association that is set via <var>[[$ListImg]]</var>.
 
<li><var>MoveFromid</var> simply moves the internal $list data pointers to the object <var>stringlist</var>. It does <b><i>not</i></b> actually perform any data movement; therefore, it is extremely efficient.
 
<li><var>MoveFromid</var> is intended to facilitate migration to <var>stringlists</var> of existing applications that use $lists.
 
<li> <var>stringlists</var> should always be used in preference to $lists, so <var>MoveFromId</var> is provided only for the migration of existing $list applications to the use of <var>Stringlists</var>.
</ul>


<pre>
==Examples==
subroutine summarize(%listId is float)
Suppose complex subroutine <code>Summarize</code> takes a $list identifier as its input parameter. Further suppose that the subroutine is rewritten to use a <var>Stringlist</var> rather than a $list. The following code illustrates how this can be accomplished:
 
<p class="code">subroutine summarize(%listId is float)
%list is object stringList
%list is object stringList
%list = new
%list = new
Line 27: Line 42:
%list:moveToid(%listId)
%list:moveToid(%listId)
return
return
</pre>
</p>
 
Of course, if the subroutine "forgets" to restore the input $list contents with <var>MoveToId</var>, the input $list remains empty at the end of the subroutine.


Of course, if the subroutine "forgets" to restore the input $list contents with MoveToId, the input $list remains empty at the end of the subroutine. Stringlists should always be used in preference to $lists, so MoveFromId is provided only for the migration of existing $list applications to the use of Stringlists.
==See also==
<ul>
<li><var>[[MoveToId (Stringlist subroutine)|MoveToId]]</var> does the converse of <var>MoveToid</var> (moves <var>Stringlist</var> data into a $list).
</ul>
</ul>


[[Category:Stringlist methods|MoveFromId subroutine]]
{{Template:Stringlist:MoveFromId footer}}

Latest revision as of 16:44, 31 October 2012

Move data from $list to Stringlist (Stringlist class)


This method moves data ($list items) from a $list to a Stringlist. MoveFromId is a subroutine that accepts one argument: the $list identifier of the $list from which data is to be moved.

Syntax

sl:MoveFromId( listId)

Syntax terms

sl A Stringlist object.
listId The $list identifier of the $list from which data is to be moved.

Usage notes

  • All errors in MoveFromId result in request cancellation.
  • After MovefromId is invoked, the source $list will be emptied, although the $list identifier is still valid.
  • MoveFromId discards any current contents of the method Stringlist.
  • MoveFromId copies to the method Stringlist any image association that is set via $ListImg.
  • MoveFromid simply moves the internal $list data pointers to the object stringlist. It does not actually perform any data movement; therefore, it is extremely efficient.
  • MoveFromid is intended to facilitate migration to stringlists of existing applications that use $lists.
  • stringlists should always be used in preference to $lists, so MoveFromId is provided only for the migration of existing $list applications to the use of Stringlists.

Examples

Suppose complex subroutine Summarize takes a $list identifier as its input parameter. Further suppose that the subroutine is rewritten to use a Stringlist rather than a $list. The following code illustrates how this can be accomplished:

subroutine summarize(%listId is float) %list is object stringList %list = new %list:moveFromid(%listId) ... %list:moveToid(%listId) return

Of course, if the subroutine "forgets" to restore the input $list contents with MoveToId, the input $list remains empty at the end of the subroutine.

See also

  • MoveToId does the converse of MoveToid (moves Stringlist data into a $list).