mglib

Personal IDL library for M. Galloy

single page | use frames     summary     class     fields     routine details     file attributes

fileio/

mgffoptions__define.pro

includes main-level program

This is the internal storage for configuration file options and their values. It is returned by MG_READ_CONFIG and can also be used through the DEFAULTS keyword of MG_READ_CONFIG to set defaults before reading a configuration file.

Other file information

Requires:

IDL 8.0

Class description for mgffoptions

Inheritance

Properties

Properties in mgffoptions

fold_case init

set for case-insensitive matching for section and option names.

sections get

array of section names

Routines

Methods inherited from idl_object

Routines from mgffoptions__define.pro

result = mgffoptions::_overloadBracketsRightSide(isRange, ss1 [, ss2])

Overload method to handle accessing options via array indexing notation.

mgffoptions::_overloadBracketsLeftSide, obj, value, isRange, ss1 [, ss2]

Overload method to handle setting option values using array notation.

result = mgffoptions::_overloadForeach(value, key)

Loop through sections of a MGffOptions object.

result = mgffoptions::_overloadHelp(varname)

Print help message about an MGffOptions object.

result = mgffoptions::_overloadPrint()

Print MGffOptions object content in an INI format that can be read by MG_READ_CONFIG.

mgffoptions::getProperty, sections=sections

Retrieve properties of the options object.

mgffoptions::put, option, value [, section=string]

Put a new option into the MGffOptions object.

result = mgffoptions::has_section(section)

Determine if an options object has a given section.

result = mgffoptions::has_option(option, section=string)

Determine if a particular section has a given option.

result = mgffoptions::options(section=string [, count=long])

Return an array of the option names for a given section.

result = mgffoptions::get(option [, section=string] [, /found] [, /raw] [, /extract] [, count=long] [, default=string])

Return value for a given option.

mgffoptions::cleanup

Free resources of mgffoptions object.

result = mgffoptions::init(fold_case=fold_case)

Initialize mgffoptions object.

mgffoptions__define

Define instance variables.

Routine details

top mgffoptions::_overloadBracketsRightSide

result = mgffoptions::_overloadBracketsRightSide(isRange, ss1 [, ss2])

Overload method to handle accessing options via array indexing notation.

Return value

string

Parameters

isRange in required type=bytarr

unused

ss1 in required type=string

option name if ss2 not given, section name if ss2 given

ss2 in optional type=string

option name if present

Examples

For example:

IDL> config = mgffoptions() IDL> config->put, 'City', 'Boulder', section='Mike' IDL> config->put, 'State', 'Colorado', section='Mike' IDL> config->put, 'City', 'Madison', section='Mark' IDL> config->put, 'State', 'Wisconsin', section='Mark' IDL> print, config['Mike', 'City'] Boulder

top mgffoptions::_overloadBracketsLeftSide

mgffoptions::_overloadBracketsLeftSide, obj, value, isRange, ss1 [, ss2]

Overload method to handle setting option values using array notation.

Parameters

obj in required type=MGffOptions object

MGffOptions object, should be self

value in required type=string

value from the right-hand side of the expression

isRange in required type=bytarr

unused

ss1 in required type=string

option name if ss2 not given, section name if ss2 given

ss2 in optional type=string

option name if present

Examples

For example:

IDL> config = mgffoptions() IDL> config['Mike', 'City'] = 'Boulder' IDL> config['Mike', 'State'] = 'Colorado' IDL> config['Mark', 'City'] = 'Madison' IDL> config['Mark', 'State'] = 'Wisconsin' IDL> print, config [ Mark ] City: Madison State: Wisconsin [ Mike ] City: Boulder State: Colorado

top mgffoptions::_overloadForeach

result = mgffoptions::_overloadForeach(value, key)

Loop through sections of a MGffOptions object.

Return value

1 if there is an element to return, 0 if there are no elements to retrieve

Parameters

value in required type=string

sections hash

key in required type=string

section name

Examples

Try:

IDL> config = mgffoptions() IDL> config->put, 'City', 'Boulder', section='Mike' IDL> config->put, 'State', 'Colorado', section='Mike' IDL> config->put, 'City', 'Madison', section='Mark' IDL> config->put, 'State', 'Wisconsin', section='Mark' IDL> foreach section, config, section_name do $ IDL> print, section_name, section['City'], section['State'], $ IDL> format='(%"%s lives in %s, %s.")' Mark lives in Madison, Wisconsin. Mike lives in Boulder, Colorado.

top mgffoptions::_overloadHelp

result = mgffoptions::_overloadHelp(varname)

Print help message about an MGffOptions object.

Return value

string

Parameters

varname in required type=string

MGffOptions object variable name

Examples

For example:

IDL> help, config CONFIG MGFFOPTIONS <NSECTIONS=2 NOPTIONS=4>

top mgffoptions::_overloadPrint

result = mgffoptions::_overloadPrint()

Print MGffOptions object content in an INI format that can be read by MG_READ_CONFIG.

Return value

string

Examples

For example:

IDL> print, config [ Mark ] City: Madison State: Wisconsin [ Mike ] City: Boulder State: Colorado

top mgffoptions::getProperty

mgffoptions::getProperty, sections=sections

Retrieve properties of the options object.

Keywords

sections

array of section names

top mgffoptions::put

mgffoptions::put, option, value [, section=string]

Put a new option into the MGffOptions object.

Parameters

option in required type=string

option name

value in required type=string

option value

Keywords

section in optional type=string

section name to place option in

top mgffoptions::has_section

result = mgffoptions::has_section(section)

Determine if an options object has a given section.

Return value

1B if section present, 0B if not

Parameters

section in required type=string

section to check

top mgffoptions::has_option

result = mgffoptions::has_option(option, section=string)

Determine if a particular section has a given option.

Return value

1B if option present, 0B if not

Parameters

option in required type=string

option to check

Keywords

section in required type=string

section to check

top mgffoptions::options

result = mgffoptions::options(section=string [, count=long])

Return an array of the option names for a given section.

Return value

strarr, or !null if no options present

Keywords

section in required type=string

section to list options for

count out optional type=long

set to a named variable to retrieve the number of options returned

top mgffoptions::get

result = mgffoptions::get(option [, section=string] [, /found] [, /raw] [, /extract] [, count=long] [, default=string])

Return value for a given option.

Return value

string or string array

Parameters

option in required type=string

option name to retrieve value for

Keywords

section in optional type=string

section to search for option in

found out optional type=boolean

set to a named variable to determine if the option is found

raw in optional type=boolean

set to retrieve value with no processing

extract in optional type=boolean

set to return an array of the elements in a value that is formatted like:

[0, 1, 2]

count out optional type=long

set to a named variable to determine the number of elements returned (most useful when using EXTRACT)

default in optional type=string

default value to return if option is not found

top mgffoptions::cleanup

mgffoptions::cleanup

Free resources of mgffoptions object.

top mgffoptions::init

result = mgffoptions::init(fold_case=fold_case)

Initialize mgffoptions object.

Return value

1 for success, 0 for failure

Keywords

fold_case

set for case-insensitive matching for section and option names.

top mgffoptions__define

mgffoptions__define

Define instance variables.

File attributes

Modification date: Wed Jun 18 09:29:59 2014
Lines: 224
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.