Source |
Comments |
constructor cxxDocument
1 set the default class template file
2 create a root object for the object tree
3 register the following variable types "int,short,long,float,double,bool"
4 register the following document tags "author,description,revision,category"
5 set the degault category tag to "none"
6 set the default parentname tag to "none"
7 evaluate CXXDOCUMENTOR_DEBUG environmental variable
destructor ~cxxDocument
1 delete all object tree nodes
method setTemplate
1 the template file to generate the class page
method analyze
1 for each token in the file
1.1 if begins with "//" then
1.1.1 create a new cxxComment object1.2 else if one of "if,else,elseif,while,for,do" then
1.2.1 create a new cxxStatement object1.3 else if the current object is the root then break
1.4 else if the token if one of "if,else,elseif,while,for,do" then
1.4.1 if the token is "else" then1.5 else if the token begins with "(" then
1.4.1.1 if the next token is "if" then1.4.2 else get the next token and parse the conditionals
1.4.1.1.1 set the statement name to "elseif"
1.4.1.1.2 get the next token and parse the conditionals
1.4.1.1.1 else set the statement name to "else"
1.4.3 add the object as a child of the current object
1.5.1 if the last variable created has the same name as token then1.6 else if the token matches one of the registered data types (i.e. float, int, etc.) then
1.5.1.1 if the last variable was "identifier" then set it as "fuctioncall"1.5.2 else
1.5.1.2 parse the functioncall arguments
1.5.2.1 create a new cxxVariable object
1.5.2.2 set the variable type as "functioncall"
1.5.2.3 add the object as a child of the current object
1.6.1 create a new cxxVariable object1.7 else if the token is one of "=,+=,-=" then
1.6.2 parse the type by checking the last two tokens
1.6.3 add the object as a child of the current object
1.7.1 create a new cxxVariable object1.8 if the token ends with ";" then set the current object to the parent object
1.7.2 set the variable type to "assignment"
1.7.3 add the object as a child of the current object
method addVariable
1 add a variable to the variables list
2 call recursively on all variable children
method findTag
1 parse a comment string for instances of registered document tags
2 while there are tokens in the comment string
2.1 for each registered tag
2.1.1 add ":" to the document tag
2.1.2 if the tag matches the token then
2.1.2.1 parse out the rest of the comment string
2.1.2.2 set the associated document tag to the parsed string
method replaceTags
1 search for document tags in a string and replace with the registered data
method getTag
1 return the document tag mapped to the given string
method printVariables
1 print out all variables from the variables list
method printFunctions
1 print out all functions from the functions list
method printStatements
1 print out all statements from the statements list
method printComments
1 print out all comments from the comments list
method print
1 print all variables, fucntions, statements, and comments
method getFunctionCall
method printHeaderHTML
1 print out the first comment child of the root of the object tree
method printCommentsHTML
1 traverse the object tree and print out each comment with associated indention and labels
method printHTML
1 attempt to recreate the source code by traversing the object tree and printing each C++ element
method report
1 open the class template file
2 if file is not found then
2.1 open the file at /usr/local/cxxDocuemtor_0.23 if file is not found then error and return
4 open the class output file
5 while not at the end of the file
5.1 get a line from the stream6 close the input stream
5.2 output the line to the output file
5.3 if the line contains "5.3.1 extract the first meta tag parameter from the line
5.3.2 extract the second meta tag parameter from the line
5.3.3 if the name meta tag parameter equals "cxxDocument" then
5.3.3.1 if the meta tag content parameter equals "header" then
5.3.3.1.1 print out the header HTML5.3.3.2 else if the meta tag content parameter equals "print" then
5.3.3.2.1 print out the source code in HTML5.3.3.3 else if the meta tag content parameter equals "comments" then
5.3.3.3.1 print out the comments in HTML
7 close the output stream