Click here to Skip to main content
15,884,537 members
Articles / Desktop Programming / MFC

UMLEditor - revisiting the vector editor

Rate me:
Please Sign up or sign in to vote.
4.99/5 (156 votes)
5 Jul 2006Public Domain8 min read 376K   37.1K   326  
An UML editor with code-generation capabilities derived from CDiagramEditor.
<html>
<head>
<style>
body{font-size: 10pt;color: black;font-family: Verdana, Helvetica, Arial, sans-serif;background-color: #ffffff}
p{font-size: 10pt;color: black;font-family: Verdana, Helvetica, Arial, sans-serif;}
h2{font-size: 13pt;color: #ff9900;font-family: Verdana, Helvetica, Arial, sans-serif;font-weight: bold;}
h3{color: #ff9900;font-weight: bold;font-size: 11pt;font-family: Arial, sans-serif;}
table{background-color:#f0f0ff;}
td{font-size: 10pt;color: black;font-family: Verdana, Helvetica, Arial, sans-serif;padding:4px;}
pre{padding-right: 7pt;padding-left: 7pt;padding-bottom: 7pt;font: 9pt 'Courier New', Courier, mono;width: 100%;padding-top: 7pt;white-space: pre;background-color: #fbedbb}
code{color: #990000;font-family: 'Courier New', Courier, mono;}
A:link{text-decoration: none}
A:visited{text-decoration: none}
A:active{text-decoration: underline}
A:hover{text-decoration: underline}
A.top:link{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
A.top:visited{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
A.top:active{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
A.top:hoover{font-size:8pt;color:red;font-family:Verdana,Helvetica,Arial,sans-serif;}
</style>
</head>
<body>
<h2>CDocumentGenerator</h2><h3>Overview</h3>
<blockquote>
<b>Purpose</b><br>
<code>CDocumentGenerator</code> is a class for generating documentation for a c++-class from a cpp-file with rigidly formatted comments.<br>
<p><b>Description</b><br>
The class is an intermediate between the application main dialog and the generator <code>CDocumentationGenerator</code> - used to generate for single cpp-files.<br>
<p><b>Usage</b><br>
Call <code>Generate</code> with the desired input and output folder. All cpp-files in the folder will be processed. If no output name is given, the input folder + '_docs' will be used. If a file called 'index.html' is found in the output folder, it will be scanned for the tags <code>&lt;!-- start-class-list --&gt;</code> and <code>&lt;!-- end-class-list --&gt;</code>. Links to the generated ducumentation will be placed between those two tags - the original information removed. If index.html or the two tags are not found, a new index.html will be created. If a file html_header.txt is found in the application directory, it's used as the header of the resulting HTML-files (up to and including the <code>&lt;body&gt;</code>-tag), otherwise, a default header is created by the application. If html_footer.txt is found, it's used as the footer of the HTML-files (from and including the <code>&lt;/body&gt;</code>-tag), otherwise, a default footer is created by the application.
<p><a class='top' href='index.html'>[back to the index page]</a>
</blockquote>
<a name='contents'></a><h3>Contents</h3>
<b>- A -</b><br>
<a href='#AddBaseFilenameconstCStringstr'>AddBaseFilename( const CString& str )</a><br>
<a href='#AddClassNameconstCStringcls'>AddClassName( const CString& cls )</a><br>
<a href='#AddDescriptionconstCStringdesc'>AddDescription( const CString& desc )</a><br>
<p>
<b>- C -</b><br>
<a href='#CDocumentGeneratorCListBoxfeedback'>CDocumentGenerator( CListBox* feedback )</a><br>
<p>
<b>- G -</b><br>
<a href='#GenerateconstCStringinputdirectoryconstCStringoutputdirectory'>Generate( const CString& inputdirectory, const CString& outputdirectory )</a><br>
<a href='#GenerateDocumentationconstCStringinputfilenameconstCStringdest'>GenerateDocumentation( const CString& inputfilename, const CString& dest )</a><br>
<a href='#GenerateIndexFileconstCStringdest'>GenerateIndexFile( const CString& dest )</a><br>
<a href='#GetErrorMessageconst'>GetErrorMessage(  ) const</a><br>
<p>
<b>- S -</b><br>
<a href='#SetErrorMessageCStringvalue'>SetErrorMessage( CString value )</a><br>
<a href='#SetFooterCStringArrayoutput'>SetFooter( CStringArray& output )</a><br>
<a href='#SetHeaderCStringArrayoutput'>SetHeader( CStringArray& output )</a><br>
<p>
<b>- ~ -</b><br>
<a href='#~CDocumentGenerator'>~CDocumentGenerator(  )</a><br>
<p><h3>Functions</h3><hr>
<code><b><a name='AddBaseFilenameconstCStringstr'></a>void AddBaseFilename( const CString& str )</b></code>
<blockquote>
<b>Description</b><br>
Adds a filename to the internal filename list.
<br><b>Access</b><br>
Private
<br><br><b>Parameters</b><br>
<code>const CString& str </code> -  Filename to add<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call after a cpp-file has been processed. The filenames are used to generate an index file.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='AddClassNameconstCStringcls'></a>void AddClassName( const CString& cls )</b></code>
<blockquote>
<b>Description</b><br>
Adds a class to the internal class list.
<br><b>Access</b><br>
Private
<br><br><b>Parameters</b><br>
<code>const CString& cls </code> -  Class to add<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call as soon as a new class is processed. The internal class list will be used to create an index file.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='AddDescriptionconstCStringdesc'></a>void AddDescription( const CString& desc )</b></code>
<blockquote>
<b>Description</b><br>
Adds a description of a class to the internal description list.
<br><b>Access</b><br>
Private
<br><br><b>Parameters</b><br>
<code>const CString& desc </code> -  Description to add<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call as soon as a new class is processed. The internal class description list will be used to create an index file.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='CDocumentGeneratorCListBoxfeedback'></a>CDocumentGenerator( CListBox* feedback )</b></code>
<blockquote>
<b>Description</b><br>
Constructor
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Should normally be created on the stack<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GenerateconstCStringinputdirectoryconstCStringoutputdirectory'></a>BOOL Generate( const CString& inputdirectory, const CString& outputdirectory )</b></code>
<blockquote>
<b>Description</b><br>
Generates html-files with documentation from all cpp-files in <code>inputdirectory</code>.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>const CString& inputdirectory </code> -  dir to generate from<br><code>const CString& outputdirectory </code> -  dir to generate to. Defaults to empty<br>
<b>Returns</b><br>
<code>BOOL       </code> -  <code>TRUE</code> if OK
<br><br><b>Usage</b><br>
This is the main function of the class - call to generate information from all cpp-files in <code>inputdirectory</code>. If the function returns <code>FALSE</code>, call <code>GetErrorMessage</code> for an error message. If <code>outputdirectory</code> is empty, <code>inputdirectory</code> + '_docs' will be used.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GenerateDocumentationconstCStringinputfilenameconstCStringdest'></a>BOOL GenerateDocumentation( const CString& inputfilename, const CString& dest )</b></code>
<blockquote>
<b>Description</b><br>
Generates documentation for the cpp-file <code>inputfilename</code>.
<br><b>Access</b><br>
Private
<br><br><b>Parameters</b><br>
<code>const CString& inputfilename </code> -  File to generate<br><code>const CString& dest    </code> -  Folder to generate to<br>
<b>Returns</b><br>
<code>BOOL </code> -  <code>TRUE</code> if OK.
<br><br><b>Usage</b><br>
Main engine of the class. Called for each cpp-file in the input directory.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GenerateIndexFileconstCStringdest'></a>BOOL GenerateIndexFile( const CString& dest )</b></code>
<blockquote>
<b>Description</b><br>
Generates an index file for all the document files created.
<br><b>Access</b><br>
Private
<br><br><b>Parameters</b><br>
<code>const CString& dest </code> -  Directory to create index file in<br>
<b>Returns</b><br>
<code>BOOL    </code> -  <code>TRUE</code> if OK.
<br><br><b>Usage</b><br>
Call to generate an index file after the individual cpp-files are created.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='GetErrorMessageconst'></a>CString GetErrorMessage(  ) const</b></code>
<blockquote>
<b>Description</b><br>
Accessor. Getter for <code>m_errorMessage</code>
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>CString </code> -  The current error message
<br><br><b>Usage</b><br>
Call to get an error message, if appropriate.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetErrorMessageCStringvalue'></a>void SetErrorMessage( CString value )</b></code>
<blockquote>
<b>Description</b><br>
Accessor. Setter for <code>m_errorMessage</code>
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CString value </code> -  New value<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to set the internal error message.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetFooterCStringArrayoutput'></a>void SetFooter( CStringArray& output )</b></code>
<blockquote>
<b>Description</b><br>
Creates a HTML-footer in <code>stra</code>
<br><b>Access</b><br>
Private
<br><br><b>Parameters</b><br>
<code>CStringArray& output </code> -  Array to add footer to.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to finish a HTML-file. If the file html_footer.txt is found in the application directory, it is used as a footer. Otherwise, a hardcoded version is used.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='SetHeaderCStringArrayoutput'></a>void SetHeader( CStringArray& output )</b></code>
<blockquote>
<b>Description</b><br>
Fills <code>output</code> with an appropriate HTML-header.
<br><b>Access</b><br>
Private
<br><br><b>Parameters</b><br>
<code>CStringArray& output </code> -  Array to fill<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call this function to create a HTML-header. If the file html_header.txt is found in the application directory, it is used as a header. Otherwise, a hardcoded version is used.<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<code><b><a name='~CDocumentGenerator'></a>~CDocumentGenerator(  )</b></code>
<blockquote>
<b>Description</b><br>
Destructor
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
-<p>
<a class='top' href='#contents'>[back to the contents]</a>&nbsp;<a class='top' href='index.html'>[back to the index page]</a></p>
</blockquote>
<hr>
<b><small>Copyright 2004 Johan Rosengren Abstrakt Mekanik AB</small></b>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Software Developer (Senior) Abstrakt Mekanik AB
Sweden Sweden
45 years old, married, three kids.

Started with computers more than 20 years ago on a CBM-64.

Read Theoretical Philosophy at the University of Lund.

Working as a C++ consultant developer.

Science-fiction freak. Enjoy vintage punkrock.

Comments and Discussions