Purpose | The include statement is used to include code in other files into a Superx++ program. This allows for partitioning of large programs into files of manageable sizes. | |||||
Format |
include({file path});
include({file path}) {
{file path} |
the path to the file with the Superx++ code to be include |
{finder expr} |
the expression to be used to find the set of objects within the file to be included-- this allows for partial inclusion |
|
|
Example #1 |
include("C:\\MyDir\\MyFile.xml"); This will include all the contents of the file found at C:\\MyDir\\MyFile.xml. This kind of inclusion where the whole contents of a file are included into the program is common in other languages. You might call it complete inclusion. |
|||||
Example #2 |
include("http://MyServer/MyDir/MyFile.xml") { has node:class and attr:name=XPlant }; This will include only the class statement defining the XPlant class within the file found at http://MyServer/MyDir/MyFile.xml. If there are other statements in the file then they are not included. This is called partial inclusion. |
|||||
Example #3 |
if (kind = "partial") { include("http://MyServer/MyDir/MyFile.xml") { has node:class }; } else { include("http://MyServer/MyDir/MyFile.xml"); }; This will include all the class statements within the file found at http://MyServer/MyDir/MyFile.xml because the parameter kind is set to partial. If kind had a different value then the entire contents of the file would be included instead. This run-time determination of what gets included (or in a different example, you could make it include different files entirely) is called conditional inclusion. |