|
Developer Documentation |
|||||||||
prev file | next file | ||||||||||
SUMMARY: fields | routine DETAILS: routine | ||||||||||
./toolbox/io index_file_section__define.pro
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 |
number of lines that buffers grow by internally as necessary. Placed here for consistency only. |
MAX_LINE_WIDTH |
maximum number of chars allowed on each line |
NUM_LINES |
the current number of lines in this section |
FILENAME |
full pathname to the file where this section resides |
LUN |
logical unit number for file |
SECTION_MARKER |
name of section |
LINE_NUMS |
pointer to an array of indicies locating each line in file (line #s zero based) |
LINES |
pointer to an array holding all lines in this section |
SECTION_READ |
boolean flag for wether section is in memory or not |
ALLOW_APPEND |
boolean flag for wether this section allows appends |
PAD_WIDTH |
boolean flag determines wether lines are padded to max width |
DEBUG |
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 |
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 |
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 |
what line to start section on in file |
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
INDEX_FILE_SECTION::get_line_nums |
function INDEX_FILE_SECTION::get_line_nums() |
Retrieves the location of each section line in the file
INDEX_FILE_SECTION::get_num_lines |
function INDEX_FILE_SECTION::get_num_lines() |
Retrieves the number of lines in this 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
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 |
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.
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.
Parameters | |
line |
line that is searched for in section |
line_index |
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
Parameters | |
line |
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.
Parameters | |
old_line |
identifies the string to replace. must be unique. |
new_line |
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.
Parameters | |
line_str |
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 |
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?