class LineEditor {
// class to model the functions of a line editor
public:
LineEditor();
// default constructor; sets list to empty
virtual ~LineEditor();
// destructor; deletes linked list
bool load(string file);
// loads the data in the file given in the parameter to the linked list
void save();
// saves the list to "default.txt"
void saveAs(string file);
// saves the list to the file passed in the parameter
void showLines();
// displays the lines in the list with line numbers
void insertLine(int lineNum, string newLine);
// inserts a line at the given line number; if the line number is < 0,
// the line is inserted at 0; if the line number is >= the number of lines
// in the list, the line is inserted as the last line in the list
void replaceLine(int lineNum, string replacementLine);
// if the line number passed is valid, that line is replaced by the passed
// line
void deleteLine(int lineNum);
// if the line number passed is valid, that line is removed from the list
private:
class LineNode { // node to store a line
public:
string line; // a single line
LineNode *next; // pointer to the next line node
};
LineNode *lineList; // pointer to linked list of nodes containing lines
int numLines; // number of lines in the list stored in the linked list
string filePath; // name of file
};