Produced by IDL 6.1
Developer Documentation

./toolbox/io
index_file_section__define.pro

Last modification date:
Thu Jun 2 23:56:08 2005

This is the base class for managing a section in an index file. Sections are started with a line: '[section_name]'. This class manages all basic i/o functions for a section. See UML for all IO Classes

Fields Summary
LINES_INCR
longword integer
number of lines that buffers grow by internally as necessary. Placed here for consistency only.
MAX_LINE_WIDTH
longword integer
maximum number of chars allowed on each line
NUM_LINES
longword integer
the current number of lines in this section
FILENAME
string
full pathname to the file where this section resides
LUN
longword integer
logical unit number for file
SECTION_MARKER
string
name of section
LINE_NUMS
pointer
pointer to an array of indicies locating each line in file (line #s zero based)
LINES
pointer
pointer to an array holding all lines in this section
SECTION_READ
longword integer
boolean flag for wether section is in memory or not
ALLOW_APPEND
longword integer
boolean flag for wether this section allows appends
PAD_WIDTH
longword integer
boolean flag determines wether lines are padded to max width
DEBUG
longword integer
boolean flag for wether this class is verbose or not

Routine Summary  23 routines

procedure index_file_section__define

This is the base class for managing a section in an index file.

function INDEX_FILE_SECTION::init(lun, section, filename)

private

Class Constructor

procedure INDEX_FILE_SECTION::cleanup

private

Class Destructor

procedure INDEX_FILE_SECTION::set_file_name, file_name

Sets file name of file to be written to

procedure INDEX_FILE_SECTION::pad_width_on

Sets object to pad lines written with spaces to their max width

procedure INDEX_FILE_SECTION::pad_width_off

Sets object to NOT pad lines written with spaces to their max width

procedure INDEX_FILE_SECTION::create[, start_line_number], [lines=string array], [append=bool]

Creates the section in the file.

function INDEX_FILE_SECTION::pad_line(line)

function INDEX_FILE_SECTION::get_lines()

Retrieves array of lines in section

function INDEX_FILE_SECTION::get_line_nums()

Retrieves the location of each section line in the file

function INDEX_FILE_SECTION::get_num_lines()

Retrieves the number of lines in this section

procedure INDEX_FILE_SECTION::increment_num_lines

private

Increments the number of lines this class believes are in the section.

function INDEX_FILE_SECTION::read_file()

Reads the file, locates the section, and loads all lines and metainfo into objects memory

procedure INDEX_FILE_SECTION::go_to_line, line_number

private

Advances file pointer to right before the line number parameter.

procedure INDEX_FILE_SECTION::set_line, line_number, line[, line_index]

Replaces a line already in the index with a new string.

function INDEX_FILE_SECTION::get_line_location(line[, line_index])

Finds the file line number of a given string.

function INDEX_FILE_SECTION::get_line_index(line)

Retrieves the index of the param line in the array of section lines: in other words, tells wether this is the first, second, etc.

procedure INDEX_FILE_SECTION::rewrite_line, old_line, new_line

Replaces a line in the section with a new one.

procedure INDEX_FILE_SECTION::delete_line, line_str

Replaces the line passed in with a blank in the index file, and removes this line from the objects memory.

procedure INDEX_FILE_SECTION::append_lines, lines

Appends lines to end of section (if allowed).

procedure INDEX_FILE_SECTION::set_debug_on

Makes object verbose

procedure INDEX_FILE_SECTION::set_debug_off

Makes object quiet

function INDEX_FILE_SECTION::is_section_read()

Has the section been read?

Routine Details

index_file_section__define

procedure index_file_section__define

This is the base class for managing a section in an index file. Sections are started with a line: '[section_name]'. This class manages all basic i/o functions for a section. See UML for all IO Classes

INDEX_FILE_SECTION::init private

function INDEX_FILE_SECTION::init(lun, section, filename)

Class Constructor

Parameters
lun
.
section
.
filename
.

INDEX_FILE_SECTION::cleanup private

procedure INDEX_FILE_SECTION::cleanup

Class Destructor

INDEX_FILE_SECTION::set_file_name

procedure INDEX_FILE_SECTION::set_file_name, file_name

Sets file name of file to be written to

Parameters
file_name
in
string
name of index file

INDEX_FILE_SECTION::pad_width_on

procedure INDEX_FILE_SECTION::pad_width_on

Sets object to pad lines written with spaces to their max width

INDEX_FILE_SECTION::pad_width_off

procedure INDEX_FILE_SECTION::pad_width_off

Sets object to NOT pad lines written with spaces to their max width

INDEX_FILE_SECTION::create

procedure INDEX_FILE_SECTION::create[, start_line_number], [lines=string array], [append=bool]

Creates the section in the file.

Parameters
start_line_number
in, optional
long
what line to start section on in file

Keywords
lines
in, optional
string array
array of lines to be written in section upon creation (does not include section marker).
append
in, optional
bool
exclusive with start_line_number: if set, lines get written at end of section

INDEX_FILE_SECTION::pad_line

function INDEX_FILE_SECTION::pad_line(line)

Parameters
line
.

INDEX_FILE_SECTION::get_lines

function INDEX_FILE_SECTION::get_lines()

Retrieves array of lines in section

Returns
array of lines in section

INDEX_FILE_SECTION::get_line_nums

function INDEX_FILE_SECTION::get_line_nums()

Retrieves the location of each section line in the file

Returns
integer array which is locatio of each section line in file

INDEX_FILE_SECTION::get_num_lines

function INDEX_FILE_SECTION::get_num_lines()

Retrieves the number of lines in this section

Returns
long integer - number of lines in the section

INDEX_FILE_SECTION::increment_num_lines private

procedure INDEX_FILE_SECTION::increment_num_lines

Increments the number of lines this class believes are in the section.

INDEX_FILE_SECTION::read_file

function INDEX_FILE_SECTION::read_file()

Reads the file, locates the section, and loads all lines and metainfo into objects memory

Returns
0 - failure, 1 - success

INDEX_FILE_SECTION::go_to_line private

procedure INDEX_FILE_SECTION::go_to_line, line_number

Advances file pointer to right before the line number parameter. To be used to write to a specific line in file. File must be opened beforehand and closed after call. This is something that idl should provide.

Parameters
line_number
in, required
long
line number to go to (0-based)

INDEX_FILE_SECTION::set_line

procedure INDEX_FILE_SECTION::set_line, line_number, line[, line_index]

Replaces a line already in the index with a new string.

Parameters
line_number
in, required
long
the file line number (first line, second line, etc. ) to replace.
line
in, required
string
new line to place in section
line_index
out, optional
variable
index in array of lines for this section specified by line_number

INDEX_FILE_SECTION::get_line_location

function INDEX_FILE_SECTION::get_line_location(line[, line_index])

Finds the file line number of a given string. If line not found, or line is found multiple times, error is raised.

Returns
the file line number where the param line is found

Parameters
line
in, required
string
line that is searched for in section
line_index
out, optional
variable
the index at which this line is found in the array of section lines

INDEX_FILE_SECTION::get_line_index

function INDEX_FILE_SECTION::get_line_index(line)

Retrieves the index of the param line in the array of section lines: in other words, tells wether this is the first, second, etc. line in this section

Returns
the index of the param line in the array of section lines.

Parameters
line
in, required
string
line to be searched for in array of section lines

INDEX_FILE_SECTION::rewrite_line

procedure INDEX_FILE_SECTION::rewrite_line, old_line, new_line

Replaces a line in the section with a new one.

Uses
get_line_location

Parameters
old_line
in, required
string
identifies the string to replace. must be unique.
new_line
in, required
string
the new line to replace the old one

INDEX_FILE_SECTION::delete_line

procedure INDEX_FILE_SECTION::delete_line, line_str

Replaces the line passed in with a blank in the index file, and removes this line from the objects memory.

Uses
get_line_index rewrite_line

Parameters
line_str
in, required
string
line to be deleted. Must be unique.

INDEX_FILE_SECTION::append_lines

procedure INDEX_FILE_SECTION::append_lines, lines

Appends lines to end of section (if allowed). Keeps objects memory in sync with section

Parameters
lines
in, required
string array
lines to append to section

INDEX_FILE_SECTION::set_debug_on

procedure INDEX_FILE_SECTION::set_debug_on

Makes object verbose

INDEX_FILE_SECTION::set_debug_off

procedure INDEX_FILE_SECTION::set_debug_off

Makes object quiet

INDEX_FILE_SECTION::is_section_read

function INDEX_FILE_SECTION::is_section_read()

Has the section been read?

Returns
0 - no, 1 - yes


Produced by IDLdoc 1.6 on Thu Jun 2 23:56:30 2005