Difference between revisions of "LOADOBJECT()"

From Recital Documentation Wiki
Jump to: navigation, search
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
{{YLM to do}}
 
 
 
==Purpose==
 
==Purpose==
 
Function to load an object or dynamic array from an external .obf file  
 
Function to load an object or dynamic array from an external .obf file  
Line 10: Line 8:
  
 
==See Also==
 
==See Also==
[[ADDPROPERTY()]], [[ARRAY()]], [[CLASS - Methods]], [[CLASS - Parameters]], [[CLASS - Properties]], [[CLASS - Scoping]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DISPLAY CLASSES]], [[DODEFAULT()]], [[LIST CLASSES]], [[METHOD]], [[NEWOBJECT()]], [[OBJECT()]], [[REMOVEPROPERTY()]], [[SAVEOBJECT()]],  
+
[[ACLASS()]], [[ADDPROPERTY()]], [[AMEMBERS()]], [[CLASS]], [[CLASS - Methods]], [[CLASS - Parameters]], [[CLASS - Properties]], [[CLASS - Scoping]], [[COMPOBJ()]], [[CREATEOBJECT()]], [[DEFINE CLASS]], [[DISPLAY CLASSES]], [[DODEFAULT()]], [[FOREACH]], [[LIST CLASSES]], [[METHOD]], [[NEWOBJECT()]], [[OBJECT()]], [[PRINT_HTML()]], [[PRINT_JSON()]], [[PRINT_R()]], [[PRINT_XML()]], [[REMOVEPROPERTY()]], [[REQUIRE_ONCE()]], [[SAVEOBJECT()]], [[SQL SELECT]], [[WITH]]
  
  
 
==Description==
 
==Description==
The LOADOBJECT() function is used to load an object or dynamic array from an external .obf file.   
+
The LOADOBJECT() function is used to load an object or dynamic array from an external .obf file.  The name of an existing file is specified in <expC>; if no file extension is included, '.obf' is assumed.  The LOADOBJECT() function returns an object.
returns an object
+
<expC> is filename
+
  
The SAVEOBJECT() function is used to save an object or dynamic array to an external .obf file.  The <object> is the name of the object and <expC> is the name of the target file.  If the file extension is not specififed, '.obf' is assumed.  The SAVEOBJECT() function returns .T. (true) if the object is successfully saved.
+
For existing objects, the built-in ''load'' [[CLASS - Methods|class method]] can also be used to load an object definition from an external .obf file.  Similarly, the SAVEOBJECT() function can be used to save an object or dynamic array to an external .obf file and existing objects have access to the built-in ''save'' class method.
 
+
The built-in ''save'' class method can also be used to save an object to an external .obf file.  Similarly, the LOADOBJECT() function can be used to restore an object or dynamic array from an external .obf file and objects have access to the built-in ''load'' class method.
+
 
   
 
   
  
Line 26: Line 20:
 
<code lang="recital">
 
<code lang="recital">
 
class myclass
 
class myclass
...
 
 
endclass
 
endclass
  
obj1 = new myclass()
+
obj1=new myclass()
saveobject(obj1,"file1")
+
// or
+
 
obj1.save("file1")
 
obj1.save("file1")
+
obj2=loadobject("file1")
 
+
==Example==
+
<code lang="recital">
+
 
+
</code>
+
  
 +
// or for an existing object
 +
obj1.load("file1")
 +
</code>
  
 
==Products==
 
==Products==

Latest revision as of 15:06, 14 December 2009

Purpose

Function to load an object or dynamic array from an external .obf file


Syntax

LOADOBJECT(<expC>)


See Also

ACLASS(), ADDPROPERTY(), AMEMBERS(), CLASS, CLASS - Methods, CLASS - Parameters, CLASS - Properties, CLASS - Scoping, COMPOBJ(), CREATEOBJECT(), DEFINE CLASS, DISPLAY CLASSES, DODEFAULT(), FOREACH, LIST CLASSES, METHOD, NEWOBJECT(), OBJECT(), PRINT_HTML(), PRINT_JSON(), PRINT_R(), PRINT_XML(), REMOVEPROPERTY(), REQUIRE_ONCE(), SAVEOBJECT(), SQL SELECT, WITH


Description

The LOADOBJECT() function is used to load an object or dynamic array from an external .obf file. The name of an existing file is specified in <expC>; if no file extension is included, '.obf' is assumed. The LOADOBJECT() function returns an object.

For existing objects, the built-in load class method can also be used to load an object definition from an external .obf file. Similarly, the SAVEOBJECT() function can be used to save an object or dynamic array to an external .obf file and existing objects have access to the built-in save class method.


Example

class myclass
endclass
 
obj1=new myclass()
obj1.save("file1")
obj2=loadobject("file1")
 
// or for an existing object
obj1.load("file1")

Products

Recital, Recital Server