templating/
mgfftemplate__define.pro
input/output
Allows substitution into a text file specified template by data held in structures or objects.
Examples
The typical template use from a template file looks something like:
template = obj_new('MGffTemplate', template_filename)
template->process, data, output_filename
obj_destroy, template
Author information
- Author
Michael Galloy
Other file information
- Requires:
IDL 6.1
- Todo:
Allow a C format code specification string as in:
The format specification could be a variable itself, as in:[% "%0.1f" % temp %]
where the template was processed with variables like:[% format % temp %]
{ format: '%0.1f', temp: 77. }
- Uses:
Class description for mgfffortemplate
Properties
Properties in mgfffortemplate
- spaces
number of spaces to indent the include
- string_array
set to indicate that
template_filename
is actually a string array containing the template
Class description for mgffcompoundtemplate
Class description for mgfftemplate
Properties
Properties in mgfftemplate
- spaces init
- string_array init
Routines
Routines from mgfftemplate__define.pro
mgfftemplate::process, variables [, output_filename] [, lun=long]
Process the template with the given variables and send output to the given filename.
mgfftemplate::reset
Reset the template to run again from the start of the template.
mgfftemplate::cleanup
Frees resources.
result = mgfftemplate::init(template_filename [, spaces=integer] [, /string_array])
Create a template class for a given template.
mgfftemplate__define
Define instance variables.
Routine details
top mgfftemplate::process
mgfftemplate::process, variables [, output_filename] [, lun=long]
Process the template with the given variables and send output to the given filename.
Parameters
- variables in required type=structure
either a structure or an object with getVariable method
- output_filename in optional type=string
filename of the output file
Keywords
- lun in optional type=long
logical unit number of an already open file to send output to
top mgfftemplate::reset
mgfftemplate::reset
Reset the template to run again from the start of the template.
top mgfftemplate::init
result = mgfftemplate::init(template_filename [, spaces=integer] [, /string_array])
Create a template class for a given template. A template can be used many times with different sets of data sent to the process method.
Return value
1 for success, 0 otherwise
Parameters
- template_filename in required type=string
filename of the template file
Keywords
- spaces in optional type=integer default=0
number of spaces to indent the include
- string_array in optional type=boolean
set to indicate that
template_filename
is actually a string array containing the template
File attributes
Modification date: | Tue Jun 24 15:31:46 2014 |
Lines: | 461 |
Docformat: | rst rst |
Contact me if you have enhancement requests or bug fixes.