Click here to Skip to main content
15,891,943 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 377.4K   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>COperationContainer</h2><h3>Overview</h3>
<blockquote>
<b>Purpose</b><br>
A container for <code>COperation</code>s<br>
<p><b>Description</b><br>
The class has a <code>CObArray</code> to store the <code>COperation</code>s, and manages memory automatically.<br>
<p><b>Usage</b><br>
Use to handle arrays of operations. As memory will be freed automatically, use <code>Copy</code> to copy contents.
<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='#AddCOperationoperation'>Add( COperation * operation )</a><br>
<p>
<b>- C -</b><br>
<a href='#COperationContainer'>COperationContainer()</a><br>
<a href='#CopyCOperationContaineroperations'>Copy( COperationContainer & operations )</a><br>
<p>
<b>- G -</b><br>
<a href='#GetAtintindexconst'>GetAt( int index) const</a><br>
<a href='#GetSizeconst'>GetSize( ) const</a><br>
<a href='#GetStringintformatconst'>GetString( int format ) const</a><br>
<p>
<b>- R -</b><br>
<a href='#RemoveAll'>RemoveAll( )</a><br>
<a href='#RemoveAtintindex'>RemoveAt( int index)</a><br>
<p>
<b>- S -</b><br>
<a href='#SetAtintindexCOperationobj'>SetAt( int index, COperation* obj )</a><br>
<a href='#SetSizeintsize'>SetSize( int size )</a><br>
<p>
<b>- ~ -</b><br>
<a href='#~COperationContainer'>~COperationContainer()</a><br>
<p><h3>Functions</h3><hr>
<code><b><a name='AddCOperationoperation'></a>void Add( COperation * operation )</b></code>
<blockquote>
<b>Description</b><br>
Add an operation to the container.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>COperation * operation </code> -  Operation to add<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to add an operation to the container. The container owns the object.<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='COperationContainer'></a>COperationContainer()</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>
-<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='CopyCOperationContaineroperations'></a>void Copy( COperationContainer & operations )</b></code>
<blockquote>
<b>Description</b><br>
Copy the contents of operations to this container.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>COperationContainer & operations </code> -  Container to copy from<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to copy data from one container to another.<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='GetAtintindexconst'></a>COperation* GetAt( int index) const</b></code>
<blockquote>
<b>Description</b><br>
Get the operation at <code>index</code>
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int index </code> -  Index of object to get.<br>
<b>Returns</b><br>
<code>COperation* </code> -  Operation, or <code>NULL</code> if out of bounds.
<br><br><b>Usage</b><br>
Call to get a specific operation.<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='GetSizeconst'></a>int GetSize( ) const</b></code>
<blockquote>
<b>Description</b><br>
Gets the number of operations in the container.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>int </code> -  The number of operations
<br><br><b>Usage</b><br>
Call to get the size of data.<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='GetStringintformatconst'></a>CString GetString( int format ) const</b></code>
<blockquote>
<b>Description</b><br>
Get a string representation of all operations in format <code>format</code>.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int format </code> -  Format to use.<br>
<b>Returns</b><br>
<code>CString  </code> -  Resulting string
<br><br><b>Usage</b><br>
<code>format</code> can be one of: <p><table width='100%'><tr><td><code>STRING_FORMAT_SAVE</code></td><td>For saving to file </td></tr><tr><td><code>STRING_FORMAT_CPP</code></td><td>cpp-file format </td></tr><tr><td><code>STRING_FORMAT_UML</code></td><td>UML-format </td></tr><tr><td><code>STRING_FORMAT_H</code></td><td>h-file format </td></tr><tr><td><code>STRING_FORMAT_HTML</code></td><td>HTML-format </td></tr><tr><td><code>STRING_FORMAT_H_CTOR</code></td><td>ctor in a header</td></tr></table><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='RemoveAll'></a>void RemoveAll( )</b></code>
<blockquote>
<b>Description</b><br>
Remove all objects from container.
<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>
Frees memory as well.<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='RemoveAtintindex'></a>void RemoveAt( int index)</b></code>
<blockquote>
<b>Description</b><br>
Remove operation at <code>index</code>
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int index </code> -  Index to remove operation at.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Will automatically delete data.<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='SetAtintindexCOperationobj'></a>void SetAt( int index, COperation* obj )</b></code>
<blockquote>
<b>Description</b><br>
Sets <code>obj</code> at index <code>index</code> in the container.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int index  </code> -  Index where obj should be added<br><code>CAttribute* obj </code> -  Object to add.<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to directly set an object. Note that the container should be empty, with just <code>SetSize</code> called. As the function is included for speedier operations, as little error checking as possible is made. If an object is set into a slot with an exisiting object, a memory leak will result.<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='SetSizeintsize'></a>void SetSize( int size )</b></code>
<blockquote>
<b>Description</b><br>
Set the size of the container
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int size </code> - <br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Can be used to speed up container operations if the size is already known.<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='~COperationContainer'></a>~COperationContainer()</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>
Deletes all associated memory.<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