Click here to Skip to main content
15,892,298 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.5K   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>CTokenizer</h2><h3>Overview</h3>
<blockquote>
<b>Purpose</b><br>
<code>CTokenizer</code> is a very simple class to tokenize a string into a string array.<br>
<p><b>Description</b><br>
The string is chopped up and put into an internal <code>CStringArray</code>. With <code>GetAt</code>, different types of data can be read from the different elements.<br>
<p><b>Usage</b><br>
Create an instance of <code>CTokenizer</code> on the stack. Set the string to parse in the <code>ctor</code>, and the delimiter if not a comma. The <code>ctor</code> automatically tokenize the input string. Call <code>GetSize</code> to get the number of tokens, and <code>GetAt</code> to get a specific token. You can also reuse the tokenizer by calling <code>Init</code>.
<p><a class='top' href='index.html'>[back to the index page]</a>
</blockquote>
<a name='contents'></a><h3>Contents</h3>
<b>- C -</b><br>
<a href='#CTokenizerCStringstrInputconstCStringstrDelimiter'>CTokenizer( CString strInput, const CString & strDelimiter )</a><br>
<p>
<b>- G -</b><br>
<a href='#GetAtintnIndexCStringstrconst'>GetAt( int nIndex, CString & str ) const</a><br>
<a href='#GetAtintnIndexDWORDvarconst'>GetAt( int nIndex, DWORD & var ) const</a><br>
<a href='#GetAtintnIndexWORDvarconst'>GetAt( int nIndex, WORD & var ) const</a><br>
<a href='#GetAtintnIndexdoublevarconst'>GetAt( int nIndex, double & var ) const</a><br>
<a href='#GetAtintnIndexintvarconst'>GetAt( int nIndex, int & var ) const</a><br>
<a href='#GetSizeconst'>GetSize(  ) const</a><br>
<p>
<b>- I -</b><br>
<a href='#InitconstCStringstrInputconstCStringstrDelimiter'>Init( const CString & strInput, const CString & strDelimiter )</a><br>
<p><h3>Functions</h3><hr>
<code><b><a name='CTokenizerCStringstrInputconstCStringstrDelimiter'></a>CTokenizer( CString strInput, const CString & strDelimiter )</b></code>
<blockquote>
<b>Description</b><br>
Constructor.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>CString strInput    </code> -  String to tokenize<br><code>const CString & strDelimiter </code> -  Delimiter, defaults to comma.<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='GetAtintnIndexCStringstrconst'></a>void GetAt( int nIndex, CString & str ) const</b></code>
<blockquote>
<b>Description</b><br>
Get the token at <code>nIndex</code> and put it in <code>str</code>.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int nIndex  </code> -  Index to get token from<br><code>CString & str </code> -  Result<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to get the value of the token at <code>index</code>.<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='GetAtintnIndexDWORDvarconst'></a>void GetAt( int nIndex, DWORD & var ) const</b></code>
<blockquote>
<b>Description</b><br>
Get the token at <code>nIndex</code> and put it in <code>var</code>.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int nIndex </code> -  Index to get token from<br><code>DWORD & var </code> -  Result<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to get the value of the token at <code>index</code>.<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='GetAtintnIndexWORDvarconst'></a>void GetAt( int nIndex, WORD & var ) const</b></code>
<blockquote>
<b>Description</b><br>
Get the token at <code>nIndex</code> and put it in <code>var</code>.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int nIndex </code> -  Index to get token from<br><code>WORD & var </code> -  Result<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to get the value of the token at <code>index</code>.<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='GetAtintnIndexdoublevarconst'></a>void GetAt( int nIndex, double & var ) const</b></code>
<blockquote>
<b>Description</b><br>
Get the token at <code>nIndex</code> and put it in <code>var</code>.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int nIndex  </code> -  Index to get token from<br><code>double & var </code> -  Result<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to get the value of the token at <code>index</code>.<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='GetAtintnIndexintvarconst'></a>void GetAt( int nIndex, int & var ) const</b></code>
<blockquote>
<b>Description</b><br>
Get the token at <code>nIndex</code> and put it in <code>var</code>.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>int nIndex </code> -  Index to get token from<br><code>int & var </code> -  Result<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to get the value of the token at <code>index</code>.<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 tokens in the tokenizer.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
none<br>
<b>Returns</b><br>
<code>int </code> -  Number of tokens.
<br><br><b>Usage</b><br>
Call to get the number of tokens in the tokenizer.<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='InitconstCStringstrInputconstCStringstrDelimiter'></a>void Init( const CString & strInput, const CString & strDelimiter )</b></code>
<blockquote>
<b>Description</b><br>
Reinitializes and tokenizes the tokenizer with <code>strInput</code>. <code>strDelimiter</code> is the delimiter to use.
<br><b>Access</b><br>
Public
<br><br><b>Parameters</b><br>
<code>const CString & strInput  </code> -  New string<br><code>const CString & strDelimiter </code> -  Delimiter, defaults to comma<br>
<b>Returns</b><br>
void
<br><br><b>Usage</b><br>
Call to reinitialize the tokenizer.<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