blob: 785840c567ecdf863136e5d5a494eea8f7fa2842 (
plain) (
tree)
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>swobject.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> </center>
<hr><h1>swobject.h</h1><div class="fragment"><pre>00001 <font class="preprocessor">#ifndef SWOBJECT_H</font>
00002 <font class="preprocessor"></font><font class="preprocessor">#define SWOBJECT_H</font>
00003 <font class="preprocessor"></font>
00004 <font class="preprocessor">#include <utilfuns.h></font>
00005 <font class="preprocessor">#if !defined(__GNUC__) && !defined(_WIN32_WCE)</font>
00006 <font class="preprocessor"></font><font class="preprocessor">#else</font>
00007 <font class="preprocessor"></font><font class="preprocessor">#include <unixstr.h></font>
00008 <font class="preprocessor">#endif</font>
00009 <font class="preprocessor"></font>
00010 <font class="preprocessor">#include <defs.h></font>
00011 <font class="preprocessor">#include <string.h></font>
00012
00013 <font class="preprocessor">#define SWDYNAMIC_CAST(className, object) (className *)((object)?((object->getClass()->isAssignableFrom(#className))?object:0):0)</font>
00014 <font class="preprocessor"></font>
<a name="l00018"></a><a class="code" href="class_s_w_class.html">00018</a> <font class="keyword">class </font>SWDLLEXPORT <a class="code" href="class_s_w_class.html">SWClass</a> {
00019 <font class="keyword">private</font>:
00020 <font class="keyword">const</font> <font class="keywordtype">char</font> **descends;
00021
00022 <font class="keyword">public</font>:
00023 <a class="code" href="class_s_w_class.html">SWClass</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> **descends) {
00024 this->descends = descends;
00025 }
00026
00027 <font class="keywordtype">bool</font> isAssignableFrom(<font class="keyword">const</font> <font class="keywordtype">char</font> *className)<font class="keyword"> const </font>{
00028 <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = 0; descends[i]; i++) {
00029 <font class="keywordflow">if</font> (!stricmp(descends[i], className))
00030 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00031 }
00032 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00033 }
00034 };
00035
<a name="l00041"></a><a class="code" href="class_s_w_object.html">00041</a> <font class="keyword">class </font><a class="code" href="class_s_w_object.html">SWObject</a> {
00042 <font class="keyword">protected</font>:
00043 <a class="code" href="class_s_w_class.html">SWClass</a> * myclass;
00044
00045 <font class="keyword">public</font>:
<a name="l00049"></a><a class="code" href="class_s_w_object.html#a0">00049</a> <font class="keyword">const</font> <a class="code" href="class_s_w_class.html">SWClass</a> *<a class="code" href="class_s_w_object.html#a0">getClass</a> ()<font class="keyword"> const </font>{
00050 <font class="keywordflow">return</font> myclass;
00051 }
00052 };
00053
00054 <font class="preprocessor">#endif</font>
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:00 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>
|