Comp_4_Assignment_7_DavidLordan
 All Files Functions
Functions
main.cpp File Reference
#include <xercesc/dom/DOM.hpp>
#include <xercesc/framework/StdOutFormatTarget.hpp>
#include <iostream>
#include "xercesc/dom/DOMTreeWalker.hpp"
#include <string.h>
#include <stdlib.h>
#include "outputOptions.h"
#include "treeManipulation.h"
#include <boost/regex.hpp>

Go to the source code of this file.

Functions

void parseInput (string input, string &command, string &selector, string &parentName, string &childOrAtt, string &contentOrVal)
 
string getUserInput ()
 
void clearVars (string &parentName, string &childOrAtt, string &contentOrVal)
 
void userTree ()
 
int main (int argC, char *argV[])
 

Function Documentation

void clearVars ( string &  parentName,
string &  childOrAtt,
string &  contentOrVal 
)

Function to reset variable strings. This is to avoid having the values from longer commands carrying over to shorter commands.

Parameters
parentName- The parent variable used for tree manipulation.
childOrAtt- Element or attribute name variable also used for tree manipulation
contentOrVal- Element content or attribute value variable

Definition at line 182 of file main.cpp.

string getUserInput ( )

Function to prompt the user and accept input from the command line.

Returns
- A string of input commands to be parsed by the 'parseInput' function.

Definition at line 148 of file main.cpp.

int main ( int  argC,
char *  argV[] 
)

Standard C++ main function.

Parameters
argc- Number of command line arguments.
argv- Array of pointers to command line arguments.
Returns
- Returns error code if the program does not end properly.

Definition at line 296 of file main.cpp.

void parseInput ( string  input,
string &  command,
string &  selector,
string &  parentName,
string &  childOrAtt,
string &  contentOrVal 
)

A function that takes user input, uses regular expressions to parse it, and extracts keywords.

Parameters
input- The input string taken from the command line.
command- The basic command keyword to be updated.
selector- The selector keyword which specifies how a basic command is to be executed.
parentName- A string used to search for nodes.
childOrAtt- A string used to create or rename nodes.
contentOrVal- A string also used to create or rename nodes.

Definition at line 64 of file main.cpp.

void userTree ( )

Core function of the program. Uses a loop to repeatedly ask the user for inputs using the 'getUserInput' function. Then calls 'parseInput' to determine the meaning of the user's commands. Calls the appropriate function to match the basic command given and passes it the necessary variables. When the loop is ended the program terminates.

Strings which are used to store parsed user input. The are passed to most program functions by reference and are essentially global variables, though only defined in this function for maintainability.

Definition at line 196 of file main.cpp.