source: NonGTP/FCollada/Documentation/_f_c_d_library_8hpp-source.html @ 964

Revision 964, 10.5 KB checked in by igarcia, 18 years ago (diff)
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3<title>FCollada: FCDocument/FCDLibrary.hpp Source File</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5<link href="tabs.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.4.6-NO -->
8<div class="tabs">
9  <ul>
10    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
11    <li><a href="modules.html"><span>Modules</span></a></li>
12    <li><a href="namespaces.html"><span>Namespaces</span></a></li>
13    <li><a href="classes.html"><span>Classes</span></a></li>
14    <li id="current"><a href="files.html"><span>Files</span></a></li>
15    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
16  </ul></div>
17<div class="tabs">
18  <ul>
19    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
20    <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
21  </ul></div>
22<h1>FCDocument/FCDLibrary.hpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
23<a name="l00002"></a>00002 <span class="comment">    Copyright (C) 2005-2006 Feeling Software Inc.</span>
24<a name="l00003"></a>00003 <span class="comment">    MIT License: http://www.opensource.org/licenses/mit-license.php</span>
25<a name="l00004"></a>00004 <span class="comment">*/</span>
26<a name="l00005"></a>00005 <span class="comment">/*</span>
27<a name="l00006"></a>00006 <span class="comment">    Based on the FS Import classes:</span>
28<a name="l00007"></a>00007 <span class="comment">    Copyright (C) 2005-2006 Feeling Software Inc</span>
29<a name="l00008"></a>00008 <span class="comment">    Copyright (C) 2005-2006 Autodesk Media Entertainment</span>
30<a name="l00009"></a>00009 <span class="comment">    MIT License: http://www.opensource.org/licenses/mit-license.php</span>
31<a name="l00010"></a>00010 <span class="comment">*/</span>
32<a name="l00011"></a>00011
33<a name="l00012"></a>00012 <span class="preprocessor">#include "FUtils/FUDaeParser.h"</span>
34<a name="l00013"></a>00013
35<a name="l00014"></a>00014 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
36<a name="l00015"></a><a class="code" href="class_f_c_d_library.html#9cf3270dce2286c94003cabe65602bd3">00015</a> <a class="code" href="class_f_c_d_library.html#9cf3270dce2286c94003cabe65602bd3">FCDLibrary&lt;T&gt;::FCDLibrary</a>(<a class="code" href="class_f_c_document.html">FCDocument</a>* _document)
37<a name="l00016"></a>00016 {
38<a name="l00017"></a>00017     document = _document;
39<a name="l00018"></a>00018 }
40<a name="l00019"></a>00019
41<a name="l00020"></a>00020 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
42<a name="l00021"></a><a class="code" href="class_f_c_d_library.html#ca8cf97f6797c52ff37422d7e7158afd">00021</a> <a class="code" href="class_f_c_d_library.html#ca8cf97f6797c52ff37422d7e7158afd">FCDLibrary&lt;T&gt;::~FCDLibrary</a>()
43<a name="l00022"></a>00022 {
44<a name="l00023"></a>00023     <a class="code" href="_f_utils_8h.html#e98b3e13794565d9dc59353ac14afd9f">CLEAR_POINTER_VECTOR</a>(<a class="code" href="class_f_c_d_library.html#51f2628cd303aea6368029a8ce77a7e4">entities</a>);
45<a name="l00024"></a>00024 }
46<a name="l00025"></a>00025
47<a name="l00026"></a>00026
48<a name="l00027"></a>00027 <span class="comment">// Create a new entity within this library</span>
49<a name="l00028"></a>00028 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
50<a name="l00029"></a><a class="code" href="class_f_c_d_library.html#a5cdcac5a447298d5e3816e4f8c864d0">00029</a> T* <a class="code" href="class_f_c_d_library.html#a5cdcac5a447298d5e3816e4f8c864d0">FCDLibrary&lt;T&gt;::AddEntity</a>()
51<a name="l00030"></a>00030 {
52<a name="l00031"></a>00031 T* entity = <span class="keyword">new</span> T(document);
53<a name="l00032"></a>00032     <a class="code" href="class_f_c_d_library.html#51f2628cd303aea6368029a8ce77a7e4">entities</a>.push_back(entity);
54<a name="l00033"></a>00033 <span class="keywordflow">return</span> entity;
55<a name="l00034"></a>00034 }
56<a name="l00035"></a>00035
57<a name="l00036"></a>00036 <span class="comment">// Deletes a entity of this library</span>
58<a name="l00037"></a>00037 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
59<a name="l00038"></a><a class="code" href="class_f_c_d_library.html#3fbfbcf4ade5b9c94d2ee2f59db5921d">00038</a> <span class="keywordtype">void</span> <a class="code" href="class_f_c_d_library.html#3fbfbcf4ade5b9c94d2ee2f59db5921d">FCDLibrary&lt;T&gt;::ReleaseEntity</a>(T* entity)
60<a name="l00039"></a>00039 {
61<a name="l00040"></a>00040     <span class="comment">// Not yet implemented, as this will most likely result in dangling pointers!</span>
62<a name="l00041"></a>00041     <span class="comment">// Needs more structure...</span>
63<a name="l00042"></a>00042 }
64<a name="l00043"></a>00043
65<a name="l00044"></a>00044
66<a name="l00045"></a>00045 <span class="comment">// Read in a list of entities for a library of a COLLADA document</span>
67<a name="l00046"></a>00046 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
68<a name="l00047"></a><a class="code" href="class_f_c_d_library.html#813347c0e988c025235eaeaf12400d1a">00047</a> <a class="code" href="class_f_u_status.html">FUStatus</a> <a class="code" href="class_f_c_d_library.html#813347c0e988c025235eaeaf12400d1a">FCDLibrary&lt;T&gt;::LoadFromXML</a>(xmlNode* node)
69<a name="l00048"></a>00048 {
70<a name="l00049"></a>00049 <a class="code" href="class_f_u_status.html">FUStatus</a> status;
71<a name="l00050"></a>00050 <span class="keywordflow">for</span> (xmlNode* entityNode = node-&gt;children; entityNode != NULL; entityNode = entityNode-&gt;next)
72<a name="l00051"></a>00051     {
73<a name="l00052"></a>00052 <span class="keywordflow">if</span> (entityNode-&gt;type == XML_ELEMENT_NODE)
74<a name="l00053"></a>00053         {
75<a name="l00054"></a>00054             T* entity = <a class="code" href="class_f_c_d_library.html#a5cdcac5a447298d5e3816e4f8c864d0">AddEntity</a>();
76<a name="l00055"></a>00055             status.<a class="code" href="class_f_u_status.html#ea95ead156fcd99b4517c175c7723215">AppendStatus</a>(entity-&gt;LoadFromXML(entityNode));
77<a name="l00056"></a>00056         }
78<a name="l00057"></a>00057     }
79<a name="l00058"></a>00058 <span class="keywordflow">return</span> status;
80<a name="l00059"></a>00059 }
81<a name="l00060"></a>00060
82<a name="l00061"></a>00061 <span class="comment">// Write out the library to the COLLADA xml document</span>
83<a name="l00062"></a>00062 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
84<a name="l00063"></a><a class="code" href="class_f_c_d_library.html#297ebf05ef14830be557ddf57909471f">00063</a> <span class="keywordtype">void</span> <a class="code" href="class_f_c_d_library.html#297ebf05ef14830be557ddf57909471f">FCDLibrary&lt;T&gt;::WriteToXML</a>(xmlNode* node)<span class="keyword"> const</span>
85<a name="l00064"></a>00064 <span class="keyword"></span>{
86<a name="l00065"></a>00065 <span class="keywordflow">for</span> (<span class="keyword">typename</span> FCDEntityList::const_iterator itEntity = <a class="code" href="class_f_c_d_library.html#51f2628cd303aea6368029a8ce77a7e4">entities</a>.begin(); itEntity != <a class="code" href="class_f_c_d_library.html#51f2628cd303aea6368029a8ce77a7e4">entities</a>.end(); ++itEntity)
87<a name="l00066"></a>00066     {
88<a name="l00067"></a>00067 <span class="keyword">const</span> T* entity = (<span class="keyword">const</span> T*) (*itEntity);
89<a name="l00068"></a>00068         entity-&gt;WriteToXML(node);
90<a name="l00069"></a>00069     }
91<a name="l00070"></a>00070 }
92<a name="l00071"></a>00071
93<a name="l00072"></a>00072 <span class="comment">// Search for the entity in this library with a given COLLADA id.</span>
94<a name="l00073"></a>00073 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
95<a name="l00074"></a><a class="code" href="class_f_c_d_library.html#5d9fdcf2b8d4edb840a1502c9814dd27">00074</a> T* <a class="code" href="class_f_c_d_library.html#5d9fdcf2b8d4edb840a1502c9814dd27">FCDLibrary&lt;T&gt;::FindDaeId</a>(<span class="keyword">const</span> string&amp; _daeId)
96<a name="l00075"></a>00075 {
97<a name="l00076"></a>00076 <span class="keyword">const</span> <span class="keywordtype">char</span>* daeId = FUDaeParser::SkipPound(_daeId);
98<a name="l00077"></a>00077 <span class="keywordflow">for</span> (<span class="keyword">typename</span> FCDEntityList::iterator itEntity = <a class="code" href="class_f_c_d_library.html#51f2628cd303aea6368029a8ce77a7e4">entities</a>.begin(); itEntity != <a class="code" href="class_f_c_d_library.html#51f2628cd303aea6368029a8ce77a7e4">entities</a>.end(); ++itEntity)
99<a name="l00078"></a>00078     {
100<a name="l00079"></a>00079 <span class="keywordflow">if</span> ((*itEntity)-&gt;GetDaeId() == daeId) <span class="keywordflow">return</span> (*itEntity);
101<a name="l00080"></a>00080     }
102<a name="l00081"></a>00081 <span class="keywordflow">return</span> NULL;
103<a name="l00082"></a>00082 }
104<a name="l00083"></a>00083
105<a name="l00084"></a>00084 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
106<a name="l00085"></a><a class="code" href="class_f_c_d_library.html#6c0c8f49e36eb99b82f838231e013461">00085</a> <a class="code" href="classvector.html">StringList</a> <a class="code" href="class_f_c_d_library.html#6c0c8f49e36eb99b82f838231e013461">FCDLibrary&lt;T&gt;::GetPostProcessCmds</a>()<span class="keyword"> const</span>
107<a name="l00086"></a>00086 <span class="keyword"></span>{
108<a name="l00087"></a>00087 <a class="code" href="classvector.html">StringList</a> res;
109<a name="l00088"></a>00088 <span class="keywordflow">for</span> (<span class="keyword">typename</span> FCDEntityList::const_iterator itEntity = <a class="code" href="class_f_c_d_library.html#51f2628cd303aea6368029a8ce77a7e4">entities</a>.begin(); itEntity != <a class="code" href="class_f_c_d_library.html#51f2628cd303aea6368029a8ce77a7e4">entities</a>.end(); ++itEntity)
110<a name="l00089"></a>00089     {
111<a name="l00090"></a>00090         res = (*itEntity)-&gt;GetPostProcessCmds();
112<a name="l00091"></a>00091     }
113<a name="l00092"></a>00092 <span class="keywordflow">return</span> res;
114<a name="l00093"></a>00093 }
115</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri May 12 16:44:38 2006 for FCollada by&nbsp;
116<a href="http://www.doxygen.org/index.html">
117<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6-NO </small></address>
118</body>
119</html>
Note: See TracBrowser for help on using the repository browser.