aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a04503.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/a04503.html')
-rw-r--r--docs/doxygen/nel/a04503.html1146
1 files changed, 1146 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a04503.html b/docs/doxygen/nel/a04503.html
new file mode 100644
index 00000000..28fc0713
--- /dev/null
+++ b/docs/doxygen/nel/a04503.html
@@ -0,0 +1,1146 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>NeL: load_form.h File Reference</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head><body>
+<!-- Generated by Doxygen 1.3.6 -->
+<div class="qindex"> <form class="search" action="search.php" method="get">
+<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a> | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
+<h1>load_form.h File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
+quick load of values from georges sheet (using a fast load with compacted file)<p>
+<dl compact><dt><b>Id</b></dt><dd><a class="el" href="a04503.html">load_form.h</a>,v 1.31 2003/11/04 09:25:09 distrib Exp </dd></dl>
+
+<p>
+Definition in file <a class="el" href="a05926.html">load_form.h</a>.
+<p>
+<code>#include "<a class="el" href="a06590.html">nel/misc/types_nl.h</a>"</code><br>
+<code>#include &lt;map&gt;</code><br>
+<code>#include &lt;string&gt;</code><br>
+<code>#include &lt;vector&gt;</code><br>
+<code>#include "<a class="el" href="a06168.html">nel/misc/path.h</a>"</code><br>
+<code>#include "<a class="el" href="a05709.html">nel/misc/file.h</a>"</code><br>
+<code>#include "<a class="el" href="a06385.html">nel/misc/sheet_id.h</a>"</code><br>
+<code>#include "<a class="el" href="a06604.html">nel/georges/u_form_loader.h</a>"</code><br>
+<code>#include "<a class="el" href="a06601.html">nel/georges/u_form.h</a>"</code><br>
+
+<p>
+<a href="a05926.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
+<tr><td></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class T&gt; void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a04503.html#a6">loadForm</a> (const std::vector&lt; std::string &gt; &amp;sheetFilters, const std::string &amp;packedFilename, std::map&lt; std::string, T &gt; &amp;container, bool updatePackedSheet=true, bool errorIfPackedSheetNotGood=true)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class T&gt; void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a04503.html#a5">loadForm</a> (const std::string &amp;sheetFilter, const std::string &amp;packedFilename, std::map&lt; std::string, T &gt; &amp;container, bool updatePackedSheet=true, bool errorIfPackedSheetNotGood=true)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class T&gt; void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a04503.html#a4">loadForm</a> (const std::vector&lt; std::string &gt; &amp;sheetFilters, const std::string &amp;packedFilename, std::map&lt; <a class="el" href="a03384.html">NLMISC::CSheetId</a>, T &gt; &amp;container, bool updatePackedSheet=true, bool errorIfPackedSheetNotGood=true)</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>template&lt;class T&gt; void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a04503.html#a3">loadForm</a> (const std::string &amp;sheetFilter, const std::string &amp;packedFilename, std::map&lt; <a class="el" href="a03384.html">NLMISC::CSheetId</a>, T &gt; &amp;container, bool updatePackedSheet=true, bool errorIfPackedSheetNotGood=true)</td></tr>
+
+<tr><td colspan=2><br><h2>Variables</h2></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a04558.html#a11">uint32</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a04503.html#a0">PACKED_SHEET_HEADER</a> = 'PKSH'</td></tr>
+
+<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Dictionnaley entry for dependency information. <a href="#a0"></a><br><br></td></tr>
+<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a04558.html#a11">uint32</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a04503.html#a1">PACKED_SHEET_VERSION</a> = 5</td></tr>
+
+<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a04558.html#a11">uint32</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a04503.html#a2">PACKED_SHEET_VERSION_COMPATIBLE</a> = 0</td></tr>
+
+</table>
+<hr><h2>Function Documentation</h2>
+<a class="anchor" name="a6" doxytag="load_form.h::loadForm" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" colspan="4">
+template&lt;class T&gt; </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap valign="top"> void loadForm </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::vector&lt; std::string &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>sheetFilters</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const std::string &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>packedFilename</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>std::map&lt; std::string, T &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>container</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>updatePackedSheet</em> = true, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>errorIfPackedSheetNotGood</em> = true</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function is used to load values from georges sheet in a quick way. <dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign=top><em>sheetFilter</em>&nbsp;</td><td>a vector of string to filter the sheet in the case you need more than one filter </td></tr>
+ <tr><td valign=top><em>packedFilename</em>&nbsp;</td><td>the name of the file that this function will generate (extension must be "packed_sheets") </td></tr>
+ <tr><td valign=top><em>container</em>&nbsp;</td><td>the map that will be filled by this function </td></tr>
+ </table>
+</dl>
+
+<p>
+Definition at line <a class="el" href="a05926.html#l00522">522</a> of file <a class="el" href="a05926.html">load_form.h</a>.
+<p>
+References <a class="el" href="a05708.html#l00531">NLMISC::COFile::close()</a>, <a class="el" href="a05708.html#l00255">NLMISC::CIFile::close()</a>, <a class="el" href="a05730.html#l00053">NLGEORGES::UFormLoader::createLoader()</a>, <a class="el" href="a06167.html#l00087">NLMISC::CPath::getFileList()</a>, <a class="el" href="a06167.html#l01485">NLMISC::CFile::getFileModificationDate()</a>, <a class="el" href="a06167.html#l01333">NLMISC::CFile::getFilename()</a>, <a class="el" href="a06552.html#l00055">NLMISC::CTime::getLocalTime()</a>, <a class="el" href="a05708.html#l00613">NLMISC::COFile::getPos()</a>, <a class="el" href="a02559.html#NLGEORGES_1_1UFormLoadera0">NLGEORGES::UFormLoader::loadForm()</a>, <a class="el" href="a06167.html#l00320">NLMISC::CPath::lookup()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00154">nlerror</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05708.html#l00503">NLMISC::COFile::open()</a>, <a class="el" href="a05708.html#l00135">NLMISC::CIFile::open()</a>, <a class="el" href="a05926.html#l00120">PACKED_SHEET_HEADER</a>, <a class="el" href="a05926.html#l00121">PACKED_SHEET_VERSION</a>, <a class="el" href="a05926.html#l00123">PACKED_SHEET_VERSION_COMPATIBLE</a>, <a class="el" href="a05730.html#l00060">NLGEORGES::UFormLoader::releaseLoader()</a>, <a class="el" href="a05646.html#l01119">res</a>, <a class="el" href="a05708.html#l00586">NLMISC::COFile::seek()</a>, <a class="el" href="a06462.html#l00232">NLMISC::IStream::serial()</a>, <a class="el" href="a05708.html#l00355">NLMISC::CIFile::serialBuffer()</a>, <a class="el" href="a06462.html#l00520">NLMISC::IStream::serialCheck()</a>, <a class="el" href="a06462.html#l00324">NLMISC::IStream::serialCont()</a>, <a class="el" href="a06461.html#l00266">NLMISC::IStream::serialVersion()</a>, <a class="el" href="a05708.html#l00242">NLMISC::CIFile::setCacheFileOnOpen()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a06553.html#l00047">NLMISC::TTime</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00100">uint32</a>.
+<p>
+Referenced by <a class="el" href="a05926.html#l00132">loadForm()</a>.
+<p>
+<div class="fragment"><pre>00523 {
+00524 std::vector&lt;std::string&gt; dictionnary;
+00525 std::map&lt;std::string, uint&gt; dictionnaryIndex;
+00526 std::map&lt;std::string, std::vector&lt;uint32&gt; &gt; dependencies;
+00527 std::vector&lt;uint32&gt; dependencyDates;
+00528
+00529 <span class="comment">// check the extension (i know that file like "foo.packed_sheetsbar" will be accepted but this check is enough...)</span>
+00530 <a class="code" href="a04199.html#a6">nlassert</a> (packedFilename.find (<span class="stringliteral">".packed_sheets"</span>) != std::string::npos);
+00531
+00532 std::string packedFilenamePath = <a class="code" href="a03072.html#NLMISC_1_1CPathe15">NLMISC::CPath::lookup</a>(packedFilename, <span class="keyword">false</span>, <span class="keyword">false</span>);
+00533 <span class="keywordflow">if</span> (packedFilenamePath.empty())
+00534 {
+00535 packedFilenamePath = packedFilename;
+00536 }
+00537
+00538 <span class="comment">// make sure the CSheetId singleton has been properly initialised</span>
+00539 <span class="comment">// NLMISC::CSheetId::init(updatePackedSheet);</span>
+00540
+00541 <span class="comment">// load the packed sheet if exists</span>
+00542 <span class="keywordflow">try</span>
+00543 {
+00544 <a class="code" href="a02653.html">NLMISC::CIFile</a> ifile;
+00545 ifile.<a class="code" href="a02653.html#NLMISC_1_1CIFilea20">setCacheFileOnOpen</a>(<span class="keyword">true</span>);
+00546 ifile.<a class="code" href="a02653.html#NLMISC_1_1CIFilea12">open</a> (packedFilenamePath);
+00547 <span class="comment">// an exception will be launch if the file is not the good version or if the file is not found</span>
+00548
+00549 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"loadForm(): Loading packed file '%s'"</span>, packedFilename.c_str());
+00550
+00551 <span class="comment">// read the header</span>
+00552 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_0">serialCheck</a>(PACKED_SHEET_HEADER);
+00553 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_0">serialCheck</a>(PACKED_SHEET_VERSION);
+00554 <a class="code" href="a04558.html#a14">sint</a> loadFormVersion= ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_8">serialVersion</a>(PACKED_SHEET_VERSION_COMPATIBLE);
+00555
+00556 <span class="comment">// Read depend block size</span>
+00557 <a class="code" href="a04558.html#a11">uint32</a> dependBlockSize;
+00558 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(dependBlockSize);
+00559
+00560 <span class="comment">// Read the dependencies only if update packed sheet</span>
+00561 <span class="keywordflow">if</span>(updatePackedSheet)
+00562 {
+00563 <span class="comment">// read the dictionnary</span>
+00564 {
+00565 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(dictionnary);
+00566 }
+00567 <span class="comment">// read the dependency data</span>
+00568 {
+00569 <a class="code" href="a04558.html#a11">uint32</a> depSize;
+00570 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(depSize);
+00571 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;depSize; ++i)
+00572 {
+00573 std::string sheetName;
+00574
+00575 <span class="comment">// Avoid copy, use []</span>
+00576 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(sheetName);
+00577 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(dependencies[sheetName]);
+00578 }
+00579 }
+00580 }
+00581 <span class="comment">// else dummy read one big block =&gt; no heavy reallocation / free</span>
+00582 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(dependBlockSize&gt;0)
+00583 {
+00584 std::vector&lt;uint8&gt; bigBlock;
+00585 bigBlock.resize(dependBlockSize);
+00586 ifile.<a class="code" href="a02653.html#NLMISC_1_1CIFilea15">serialBuffer</a>(&amp;bigBlock[0], dependBlockSize);
+00587 }
+00588
+00589 <span class="comment">// read the packed sheet data</span>
+00590 <a class="code" href="a04558.html#a11">uint32</a> nbEntries;
+00591 <a class="code" href="a04558.html#a11">uint32</a> ver;
+00592 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a> (nbEntries);
+00593 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a> (ver);
+00594 <span class="keywordflow">if</span>(ver != T::getVersion ())
+00595 <span class="keywordflow">throw</span> <a class="code" href="a02482.html">Exception</a>(<span class="stringliteral">"The packed sheet version in stream is different of the code"</span>);
+00596 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a> (container);
+00597 ifile.<a class="code" href="a02653.html#NLMISC_1_1CIFilea3">close</a> ();
+00598 }
+00599 <span class="keywordflow">catch</span> (<a class="code" href="a02482.html">NLMISC::Exception</a> &amp;e)
+00600 {
+00601 <span class="comment">// clear the container because it can contains partially loaded sheet so we must clean it before continue</span>
+00602 container.clear ();
+00603 <span class="keywordflow">if</span> (!updatePackedSheet)
+00604 {
+00605 <span class="keywordflow">if</span> (errorIfPackedSheetNotGood)
+00606 <a class="code" href="a04199.html#a3">nlerror</a> (<span class="stringliteral">"loadForm(): Exception during reading the packed file and can't reconstruct them (%s)"</span>, e.what());
+00607 <span class="keywordflow">else</span>
+00608 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"loadForm(): Exception during reading the packed file and can't reconstruct them (%s)"</span>, e.what());
+00609
+00610 <span class="keywordflow">return</span>;
+00611 }
+00612 <span class="keywordflow">else</span>
+00613 {
+00614 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"loadForm(): Exception during reading the packed file, I'll reconstruct it (%s)"</span>, e.what());
+00615 }
+00616 }
+00617
+00618 <span class="comment">// if we don't want to update packed sheet, we nothing more to do</span>
+00619 <span class="keywordflow">if</span> (!updatePackedSheet)
+00620 {
+00621 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"Don't update the packed sheet with real sheet"</span>);
+00622 <span class="keywordflow">return</span>;
+00623 }
+00624
+00625 <span class="comment">// retreive the date of all dependency file</span>
+00626 {
+00627 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;dictionnary.size(); ++i)
+00628 {
+00629 std::string p = <a class="code" href="a03072.html#NLMISC_1_1CPathe15">NLMISC::CPath::lookup</a> (dictionnary[i], <span class="keyword">false</span>, <span class="keyword">false</span>);
+00630 <span class="keywordflow">if</span> (!p.empty())
+00631 {
+00632 <a class="code" href="a04558.html#a11">uint32</a> d = <a class="code" href="a02524.html#NLMISC_1_1CFilee9">NLMISC::CFile::getFileModificationDate</a>(p);
+00633 dependencyDates.push_back(d);
+00634 }
+00635 <span class="keywordflow">else</span>
+00636 {
+00637 <span class="comment">// file not found !</span>
+00638 <span class="comment">// write a future date to invalidate any file dependent on it</span>
+00639 <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"Can't find dependent file %s !"</span>, dictionnary[i].c_str());
+00640 dependencyDates.push_back(0xffffffff);
+00641 }
+00642 }
+00643 }
+00644
+00645 <span class="comment">// build a vector of the sheetFilters sheet ids (ie: "item")</span>
+00646 std::vector&lt;std::string&gt; sheetNames;
+00647 {
+00648 std::vector&lt;std::string&gt;::const_iterator first(sheetFilters.begin()), last(sheetFilters.end());
+00649 <span class="keywordflow">for</span> (; first != last; ++first)
+00650 <a class="code" href="a03072.html#NLMISC_1_1CPathe10">NLMISC::CPath::getFileList</a>(*first, sheetNames);
+00651
+00652 }
+00653
+00654 <span class="comment">// if there s no file, nothing to do</span>
+00655 <span class="keywordflow">if</span> (sheetNames.empty())
+00656 <span class="keywordflow">return</span>;
+00657
+00658 <span class="comment">// set up the current sheet in container to remove sheet that are in the container and not in the directory anymore</span>
+00659 std::map&lt;std::string, bool&gt; sheetToRemove;
+00660 {
+00661 <span class="keyword">typename</span> std::map&lt;std::string, T&gt;::iterator first(container.begin()), last(container.end());
+00662 <span class="keywordflow">for</span>(; first != last; ++first)
+00663 sheetToRemove.insert (make_pair(first-&gt;first, <span class="keyword">true</span>));
+00664 }
+00665
+00666 <span class="comment">// check if we need to create a new .pitems or just read it</span>
+00667 <a class="code" href="a04558.html#a11">uint32</a> packedFiledate = <a class="code" href="a02524.html#NLMISC_1_1CFilee9">NLMISC::CFile::getFileModificationDate</a>(packedFilenamePath);
+00668
+00669 <span class="keywordtype">bool</span> containerChanged = <span class="keyword">false</span>;
+00670
+00671 <a class="code" href="a02559.html">NLGEORGES::UFormLoader</a> *formLoader = NULL;
+00672
+00673 std::vector&lt;uint&gt; NeededToRecompute;
+00674
+00675 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = 0; k &lt; sheetNames.size(); k++)
+00676 {
+00677 std::string p = <a class="code" href="a03072.html#NLMISC_1_1CPathe15">NLMISC::CPath::lookup</a> (sheetNames[k], <span class="keyword">false</span>, <span class="keyword">false</span>);
+00678 <span class="keywordflow">if</span> (p.empty())
+00679 {
+00680 <span class="keywordflow">continue</span>;
+00681 }
+00682 <a class="code" href="a04558.html#a11">uint32</a> d = <a class="code" href="a02524.html#NLMISC_1_1CFilee9">NLMISC::CFile::getFileModificationDate</a>(p);
+00683
+00684 <span class="comment">// no need to remove this sheet</span>
+00685 sheetToRemove[sheetNames[k]] = <span class="keyword">false</span>;
+00686
+00687 <span class="keywordflow">if</span>( d &gt; packedFiledate || container.find (sheetNames[k]) == container.end())
+00688 {
+00689 NeededToRecompute.push_back(k);
+00690 }
+00691 <span class="keywordflow">else</span>
+00692 {
+00693 <span class="comment">// check the date of each parent</span>
+00694 <a class="code" href="a04199.html#a6">nlassert</a>(dependencies.find(sheetNames[k]) != dependencies.end());
+00695 std::vector&lt;uint32&gt; &amp;depends = dependencies[sheetNames[k]];
+00696
+00697 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;depends.size(); ++i)
+00698 {
+00699 <span class="keywordflow">if</span> (dependencyDates[depends[i]] &gt; packedFiledate)
+00700 {
+00701 <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"Dependancy on %s for %s not up to date !"</span>,
+00702 dictionnary[depends[i]].c_str(), sheetNames[k].c_str());
+00703 NeededToRecompute.push_back(k);
+00704 <span class="keywordflow">break</span>;
+00705 }
+00706 }
+00707 }
+00708 }
+00709
+00710 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"%d sheets checked, %d need to be recomputed"</span>, sheetNames.size(), NeededToRecompute.size());
+00711
+00712 <a class="code" href="a05378.html#a242">NLMISC::TTime</a> lastTime = <a class="code" href="a02142.html#NLMISC_1_1CTimee0">NLMISC::CTime::getLocalTime</a> ();
+00713 <a class="code" href="a05378.html#a242">NLMISC::TTime</a> start = <a class="code" href="a02142.html#NLMISC_1_1CTimee0">NLMISC::CTime::getLocalTime</a> ();
+00714
+00715 <a class="code" href="a03408.html">NLMISC::CSmartPtr&lt;NLGEORGES::UForm&gt;</a> form;
+00716
+00717 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j = 0; j &lt; NeededToRecompute.size(); j++)
+00718 {
+00719 <span class="keywordflow">if</span>(<a class="code" href="a02142.html#NLMISC_1_1CTimee0">NLMISC::CTime::getLocalTime</a> () &gt; lastTime + 5000)
+00720 {
+00721 lastTime = <a class="code" href="a02142.html#NLMISC_1_1CTimee0">NLMISC::CTime::getLocalTime</a> ();
+00722 <span class="keywordflow">if</span>(j&gt;0)
+00723 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"%.0f%% completed (%d/%d), %d seconds remaining"</span>, (<span class="keywordtype">float</span>)j*100.0/NeededToRecompute.size(),j,NeededToRecompute.size(), (NeededToRecompute.size()-j)*(lastTime-start)/j/1000);
+00724 }
+00725
+00726 <span class="comment">// create the georges loader if necessary</span>
+00727 <span class="keywordflow">if</span> (formLoader == NULL)
+00728 {
+00729 NLMISC::WarningLog-&gt;addNegativeFilter(<span class="stringliteral">"CFormLoader: Can't open the form file"</span>);
+00730 formLoader = <a class="code" href="a02559.html#NLGEORGES_1_1UFormLoadere0">NLGEORGES::UFormLoader::createLoader</a> ();
+00731 }
+00732
+00733 <span class="comment">// Load the form with given sheet id</span>
+00734 form = formLoader-&gt;<a class="code" href="a02559.html#NLGEORGES_1_1UFormLoadera0">loadForm</a> (sheetNames[NeededToRecompute[j]].c_str ());
+00735 <span class="keywordflow">if</span> (form)
+00736 {
+00737 <span class="comment">// build the dependency data</span>
+00738 {
+00739 std::vector&lt;uint32&gt; depends;
+00740 std::set&lt;std::string&gt; dependFiles;
+00741 form-&gt;getDependencies (dependFiles);
+00742 <a class="code" href="a04199.html#a6">nlassert</a>(dependFiles.find(sheetNames[NeededToRecompute[j]]) != dependFiles.end());
+00743 <span class="comment">// remove the sheet itself from the container</span>
+00744 dependFiles.erase(sheetNames[NeededToRecompute[j]]);
+00745
+00746 std::set&lt;std::string&gt;::iterator first(dependFiles.begin()), last(dependFiles.end());
+00747 <span class="keywordflow">for</span> (; first != last; ++first)
+00748 {
+00749 std::string p = <a class="code" href="a03072.html#NLMISC_1_1CPathe15">NLMISC::CPath::lookup</a> (*first, <span class="keyword">false</span>, <span class="keyword">false</span>);
+00750 <span class="keywordflow">if</span> (!p.empty())
+00751 {
+00752 <a class="code" href="a04558.html#a11">uint32</a> date = <a class="code" href="a02524.html#NLMISC_1_1CFilee9">NLMISC::CFile::getFileModificationDate</a>(p);
+00753
+00754 <a class="code" href="a04558.html#a15">uint</a> dicIndex;
+00755 std::string <a class="code" href="a05377.html#a2">filename</a> = <a class="code" href="a02524.html#NLMISC_1_1CFilee10">NLMISC::CFile::getFilename</a>(p);
+00756
+00757 <span class="keywordflow">if</span> (dictionnaryIndex.find(filename) == dictionnaryIndex.end())
+00758 {
+00759 <span class="comment">// add a new dictionnary entry</span>
+00760 dicIndex = dictionnary.size();
+00761 dictionnaryIndex.insert(std::make_pair(filename, dictionnary.size()));
+00762 dictionnary.push_back(filename);
+00763 }
+00764 <span class="keywordflow">else</span>
+00765 {
+00766 dicIndex = dictionnaryIndex.find(filename)-&gt;second;
+00767 }
+00768
+00769 <span class="comment">// add the dependecy index</span>
+00770 depends.push_back(dicIndex);
+00771 }
+00772 }
+00773 <span class="comment">// store the dependency list with the sheet ID</span>
+00774 dependencies[sheetNames[NeededToRecompute[j]]] = depends;
+00775 }
+00776
+00777 <span class="comment">// add the new creature, it could be already loaded by the packed sheets but will be overwrite with the new one</span>
+00778 <span class="keyword">typedef</span> <span class="keyword">typename</span> std::map&lt;std::string, T&gt;::iterator TType1;
+00779 <span class="keyword">typedef</span> <span class="keyword">typename</span> std::pair&lt;TType1, bool&gt; TType2;
+00780 TType2 <a class="code" href="a04223.html#a643">res</a> = container.insert(std::make_pair(sheetNames[NeededToRecompute[j]],T()));
+00781
+00782 (*<a class="code" href="a04223.html#a643">res</a>.first).second.readGeorges (form, sheetNames[NeededToRecompute[j]]);
+00783 containerChanged = <span class="keyword">true</span>;
+00784 }
+00785 }
+00786
+00787 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"%d seconds to recompute %d sheets"</span>, (<a class="code" href="a04558.html#a11">uint32</a>)(NLMISC::CTime::getLocalTime()-start)/1000, NeededToRecompute.size());
+00788
+00789 <span class="comment">// free the georges loader if necessary</span>
+00790 <span class="keywordflow">if</span> (formLoader != NULL)
+00791 {
+00792 <a class="code" href="a02559.html#NLGEORGES_1_1UFormLoadere1">NLGEORGES::UFormLoader::releaseLoader</a> (formLoader);
+00793 NLMISC::WarningLog-&gt;removeFilter (<span class="stringliteral">"CFormLoader: Can't open the form file"</span>);
+00794 }
+00795
+00796 <span class="comment">// we have now to remove sheet that are in the container and not exist anymore in the sheet directories</span>
+00797 <span class="keywordflow">for</span> (std::map&lt;std::string, bool&gt;::iterator it2 = sheetToRemove.begin(); it2 != sheetToRemove.end(); it2++)
+00798 {
+00799 <span class="keywordflow">if</span>(it2-&gt;second)
+00800 {
+00801 <span class="comment">// informe the contained object that it is no more needed.</span>
+00802 container.find(it2-&gt;first)-&gt;second.removed();
+00803 container.erase(it2-&gt;first);
+00804 containerChanged = <span class="keyword">true</span>;
+00805 dependencies.erase((*it2).first);
+00806 }
+00807 }
+00808
+00809 <span class="comment">// now, save the new container in the packedfile</span>
+00810 <span class="keywordflow">try</span>
+00811 {
+00812 <span class="keywordflow">if</span>(containerChanged)
+00813 {
+00814 <a class="code" href="a03011.html">NLMISC::COFile</a> ofile;
+00815 ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea9">open</a>(packedFilenamePath);
+00816
+00817 <span class="comment">// write the header.</span>
+00818 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_0">serialCheck</a>(PACKED_SHEET_HEADER);
+00819 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_0">serialCheck</a>(PACKED_SHEET_VERSION);
+00820 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_8">serialVersion</a>(PACKED_SHEET_VERSION_COMPATIBLE);
+00821
+00822 <span class="comment">// Write a dummy block size for now</span>
+00823 <a class="code" href="a04558.html#a10">sint32</a> posBlockSize= ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea4">getPos</a>();
+00824 <a class="code" href="a04558.html#a11">uint32</a> dependBlockSize= 0;
+00825 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(dependBlockSize);
+00826
+00827 <span class="comment">// write the dictionnary</span>
+00828 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(dictionnary);
+00829
+00830 <span class="comment">// write the dependencies data</span>
+00831 <a class="code" href="a04558.html#a11">uint32</a> depSize = dependencies.size();
+00832 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(depSize);
+00833 std::map&lt;std::string, std::vector&lt;uint32&gt; &gt;::iterator first(dependencies.begin()), last(dependencies.end());
+00834 <span class="keywordflow">for</span> (; first != last; ++first)
+00835 {
+00836 std::string sheetName = first-&gt;first;
+00837 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(sheetName);
+00838 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(first-&gt;second);
+00839 }
+00840
+00841 <span class="comment">// Then get the dicionary + dependencies size, and write it back to posBlockSize</span>
+00842 <a class="code" href="a04558.html#a10">sint32</a> endBlockSize= ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea4">getPos</a>();
+00843 dependBlockSize= (endBlockSize - posBlockSize) - 4;
+00844 ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea10">seek</a>(posBlockSize, NLMISC::IStream::begin);
+00845 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(dependBlockSize);
+00846 ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea10">seek</a>(endBlockSize, NLMISC::IStream::begin);
+00847
+00848 <span class="comment">// write the sheet data</span>
+00849 <a class="code" href="a04558.html#a11">uint32</a> nbEntries = sheetNames.size();
+00850 <a class="code" href="a04558.html#a11">uint32</a> ver = T::getVersion ();
+00851 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a> (nbEntries);
+00852 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a> (ver);
+00853 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(container);
+00854 ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea0">close</a> ();
+00855 }
+00856 }
+00857 <span class="keywordflow">catch</span> (<a class="code" href="a02482.html">NLMISC::Exception</a> &amp;e)
+00858 {
+00859 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"loadForm(): Exception during saving the packed file, it will be recreated next launch (%s)"</span>, e.what());
+00860 }
+00861
+00862 <span class="comment">// housekeeping</span>
+00863 sheetNames.clear ();
+00864 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a5" doxytag="load_form.h::loadForm" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" colspan="4">
+template&lt;class T&gt; </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap valign="top"> void loadForm </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>sheetFilter</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const std::string &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>packedFilename</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>std::map&lt; std::string, T &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>container</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>updatePackedSheet</em> = true, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>errorIfPackedSheetNotGood</em> = true</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function is used to load values from georges sheet in a quick way. <dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign=top><em>sheetFilter</em>&nbsp;</td><td>a string to filter the sheet (ie: ".item") </td></tr>
+ <tr><td valign=top><em>packedFilename</em>&nbsp;</td><td>the name of the file that this function will generate (extension must be "packed_sheets") </td></tr>
+ <tr><td valign=top><em>container</em>&nbsp;</td><td>the map that will be filled by this function </td></tr>
+ </table>
+</dl>
+
+<p>
+Definition at line <a class="el" href="a05926.html#l00508">508</a> of file <a class="el" href="a05926.html">load_form.h</a>.
+<p>
+References <a class="el" href="a05926.html#l00522">loadForm()</a>.
+<p>
+<div class="fragment"><pre>00509 {
+00510 std::vector&lt;std::string&gt; vs;
+00511 vs.push_back(sheetFilter);
+00512 <a class="code" href="a04503.html#a6">loadForm</a>(vs, packedFilename, container, updatePackedSheet, errorIfPackedSheetNotGood);
+00513 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a4" doxytag="load_form.h::loadForm" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" colspan="4">
+template&lt;class T&gt; </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap valign="top"> void loadForm </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::vector&lt; std::string &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>sheetFilters</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const std::string &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>packedFilename</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>std::map&lt; <a class="el" href="a03384.html">NLMISC::CSheetId</a>, T &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>container</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>updatePackedSheet</em> = true, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>errorIfPackedSheetNotGood</em> = true</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function is used to load values from georges sheet in a quick way. <dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign=top><em>sheetFilter</em>&nbsp;</td><td>a vector of string to filter the sheet in the case you need more than one filter </td></tr>
+ <tr><td valign=top><em>packedFilename</em>&nbsp;</td><td>the name of the file that this function will generate (extension must be "packed_sheets") </td></tr>
+ <tr><td valign=top><em>container</em>&nbsp;</td><td>the map that will be filled by this function </td></tr>
+ </table>
+</dl>
+
+<p>
+Definition at line <a class="el" href="a05926.html#l00145">145</a> of file <a class="el" href="a05926.html">load_form.h</a>.
+<p>
+References <a class="el" href="a06384.html#l00499">NLMISC::CSheetId::buildIdVector()</a>, <a class="el" href="a05708.html#l00531">NLMISC::COFile::close()</a>, <a class="el" href="a05708.html#l00255">NLMISC::CIFile::close()</a>, <a class="el" href="a05730.html#l00053">NLGEORGES::UFormLoader::createLoader()</a>, <a class="el" href="a06167.html#l01485">NLMISC::CFile::getFileModificationDate()</a>, <a class="el" href="a06167.html#l01333">NLMISC::CFile::getFilename()</a>, <a class="el" href="a06552.html#l00055">NLMISC::CTime::getLocalTime()</a>, <a class="el" href="a05708.html#l00613">NLMISC::COFile::getPos()</a>, <a class="el" href="a06384.html#l00304">NLMISC::CSheetId::init()</a>, <a class="el" href="a02559.html#NLGEORGES_1_1UFormLoadera0">NLGEORGES::UFormLoader::loadForm()</a>, <a class="el" href="a06167.html#l00320">NLMISC::CPath::lookup()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00154">nlerror</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05708.html#l00503">NLMISC::COFile::open()</a>, <a class="el" href="a05708.html#l00135">NLMISC::CIFile::open()</a>, <a class="el" href="a05926.html#l00120">PACKED_SHEET_HEADER</a>, <a class="el" href="a05926.html#l00121">PACKED_SHEET_VERSION</a>, <a class="el" href="a05926.html#l00123">PACKED_SHEET_VERSION_COMPATIBLE</a>, <a class="el" href="a05730.html#l00060">NLGEORGES::UFormLoader::releaseLoader()</a>, <a class="el" href="a05646.html#l01119">res</a>, <a class="el" href="a05708.html#l00586">NLMISC::COFile::seek()</a>, <a class="el" href="a06462.html#l00232">NLMISC::IStream::serial()</a>, <a class="el" href="a05708.html#l00355">NLMISC::CIFile::serialBuffer()</a>, <a class="el" href="a06462.html#l00520">NLMISC::IStream::serialCheck()</a>, <a class="el" href="a06462.html#l00324">NLMISC::IStream::serialCont()</a>, <a class="el" href="a06461.html#l00266">NLMISC::IStream::serialVersion()</a>, <a class="el" href="a05708.html#l00242">NLMISC::CIFile::setCacheFileOnOpen()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a06553.html#l00047">NLMISC::TTime</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00100">uint32</a>.
+<p>
+<div class="fragment"><pre>00146 {
+00147 std::vector&lt;std::string&gt; dictionnary;
+00148 std::map&lt;std::string, uint&gt; dictionnaryIndex;
+00149 std::map&lt;NLMISC::CSheetId, std::vector&lt;uint32&gt; &gt; dependencies;
+00150 std::vector&lt;uint32&gt; dependencyDates;
+00151
+00152 <span class="comment">// check the extension (i know that file like "foo.packed_sheetsbar" will be accepted but this check is enough...)</span>
+00153 <a class="code" href="a04199.html#a6">nlassert</a> (packedFilename.find (<span class="stringliteral">".packed_sheets"</span>) != std::string::npos);
+00154
+00155 std::string packedFilenamePath = <a class="code" href="a03072.html#NLMISC_1_1CPathe15">NLMISC::CPath::lookup</a>(NLMISC::CFile::getFilename(packedFilename), <span class="keyword">false</span>, <span class="keyword">false</span>);
+00156 <span class="keywordflow">if</span> (packedFilenamePath.empty())
+00157 {
+00158 packedFilenamePath = packedFilename;
+00159 }
+00160
+00161 <span class="comment">// make sure the CSheetId singleton has been properly initialised</span>
+00162 <a class="code" href="a03384.html#NLMISC_1_1CSheetIde8">NLMISC::CSheetId::init</a>(updatePackedSheet);
+00163
+00164 <span class="comment">// load the packed sheet if exists</span>
+00165 <span class="keywordflow">try</span>
+00166 {
+00167 <a class="code" href="a02653.html">NLMISC::CIFile</a> ifile;
+00168 ifile.<a class="code" href="a02653.html#NLMISC_1_1CIFilea20">setCacheFileOnOpen</a>(<span class="keyword">true</span>);
+00169 <span class="keywordflow">if</span> (!ifile.<a class="code" href="a02653.html#NLMISC_1_1CIFilea12">open</a> (packedFilenamePath))
+00170 {
+00171 <span class="keywordflow">throw</span> <a class="code" href="a02482.html">NLMISC::Exception</a>(<span class="stringliteral">"can't open PackedSheet %s"</span>, packedFilenamePath.c_str());
+00172 }
+00173 <span class="comment">// an exception will be launch if the file is not the good version or if the file is not found</span>
+00174
+00175 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"loadForm(): Loading packed file '%s'"</span>, packedFilename.c_str());
+00176
+00177 <span class="comment">// read the header</span>
+00178 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_0">serialCheck</a>(PACKED_SHEET_HEADER);
+00179 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_0">serialCheck</a>(PACKED_SHEET_VERSION);
+00180 <a class="code" href="a04558.html#a14">sint</a> loadFormVersion= ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_8">serialVersion</a>(PACKED_SHEET_VERSION_COMPATIBLE);
+00181
+00182 <span class="comment">// Read depend block size</span>
+00183 <a class="code" href="a04558.html#a11">uint32</a> dependBlockSize;
+00184 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(dependBlockSize);
+00185
+00186 <span class="comment">// Read the dependencies only if update packed sheet</span>
+00187 <span class="keywordflow">if</span>(updatePackedSheet)
+00188 {
+00189 <span class="comment">// read the dictionnary</span>
+00190 {
+00191 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(dictionnary);
+00192 }
+00193 <span class="comment">// read the dependency data</span>
+00194 {
+00195 <a class="code" href="a04558.html#a11">uint32</a> depSize;
+00196 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(depSize);
+00197 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;depSize; ++i)
+00198 {
+00199 <a class="code" href="a03384.html">NLMISC::CSheetId</a> sheetId;
+00200
+00201 <span class="comment">// Avoid copy, use []</span>
+00202 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(sheetId);
+00203 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(dependencies[sheetId]);
+00204 }
+00205 }
+00206 }
+00207 <span class="comment">// else dummy read one big block =&gt; no heavy reallocation / free</span>
+00208 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(dependBlockSize&gt;0)
+00209 {
+00210 std::vector&lt;uint8&gt; bigBlock;
+00211 bigBlock.resize(dependBlockSize);
+00212 ifile.<a class="code" href="a02653.html#NLMISC_1_1CIFilea15">serialBuffer</a>(&amp;bigBlock[0], dependBlockSize);
+00213 }
+00214
+00215 <span class="comment">// read the packed sheet data</span>
+00216 <a class="code" href="a04558.html#a11">uint32</a> nbEntries;
+00217 <a class="code" href="a04558.html#a11">uint32</a> ver;
+00218 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a> (nbEntries);
+00219 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a> (ver);
+00220 <span class="keywordflow">if</span>(ver != T::getVersion ())
+00221 <span class="keywordflow">throw</span> <a class="code" href="a02482.html">NLMISC::Exception</a>(<span class="stringliteral">"The packed sheet version in stream is different of the code"</span>);
+00222 ifile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a> (container);
+00223 ifile.<a class="code" href="a02653.html#NLMISC_1_1CIFilea3">close</a> ();
+00224 }
+00225 <span class="keywordflow">catch</span> (<a class="code" href="a02482.html">NLMISC::Exception</a> &amp;e)
+00226 {
+00227 <span class="comment">// clear the container because it can contains partially loaded sheet so we must clean it before continue</span>
+00228 container.clear ();
+00229 <span class="keywordflow">if</span> (!updatePackedSheet)
+00230 {
+00231 <span class="keywordflow">if</span> (errorIfPackedSheetNotGood)
+00232 <a class="code" href="a04199.html#a3">nlerror</a> (<span class="stringliteral">"loadForm(): Exception during reading the packed file and can't reconstruct them (%s)"</span>, e.what());
+00233 <span class="keywordflow">else</span>
+00234 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"loadForm(): Exception during reading the packed file and can't reconstruct them (%s)"</span>, e.what());
+00235
+00236 <span class="keywordflow">return</span>;
+00237 }
+00238 <span class="keywordflow">else</span>
+00239 {
+00240 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"loadForm(): Exception during reading the packed file, I'll reconstruct it (%s)"</span>, e.what());
+00241 }
+00242 }
+00243
+00244 <span class="comment">// if we don't want to update packed sheet, we nothing more to do</span>
+00245 <span class="keywordflow">if</span> (!updatePackedSheet)
+00246 {
+00247 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"Don't update the packed sheet with real sheet"</span>);
+00248 <span class="keywordflow">return</span>;
+00249 }
+00250
+00251 <span class="comment">// retreive the date of all dependency file</span>
+00252 {
+00253 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;dictionnary.size(); ++i)
+00254 {
+00255 std::string p = <a class="code" href="a03072.html#NLMISC_1_1CPathe15">NLMISC::CPath::lookup</a> (dictionnary[i], <span class="keyword">false</span>, <span class="keyword">false</span>);
+00256 <span class="keywordflow">if</span> (!p.empty())
+00257 {
+00258 <a class="code" href="a04558.html#a11">uint32</a> d = <a class="code" href="a02524.html#NLMISC_1_1CFilee9">NLMISC::CFile::getFileModificationDate</a>(p);
+00259 dependencyDates.push_back(d);
+00260 }
+00261 <span class="keywordflow">else</span>
+00262 {
+00263 <span class="comment">// file not found !</span>
+00264 <span class="comment">// write a future date to invalidate any file dependent on it</span>
+00265 <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"Can't find dependent file %s !"</span>, dictionnary[i].c_str());
+00266 dependencyDates.push_back(0xffffffff);
+00267 }
+00268 }
+00269 }
+00270
+00271 <span class="comment">// build a vector of the sheetFilters sheet ids (ie: "item")</span>
+00272 std::vector&lt;NLMISC::CSheetId&gt; sheetIds;
+00273 std::vector&lt;std::string&gt; filenames;
+00274 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i = 0; i &lt; sheetFilters.size(); i++)
+00275 <a class="code" href="a03384.html#NLMISC_1_1CSheetIde4">NLMISC::CSheetId::buildIdVector</a>(sheetIds, filenames, sheetFilters[i]);
+00276
+00277 <span class="comment">// if there s no file, nothing to do</span>
+00278 <span class="keywordflow">if</span> (sheetIds.empty())
+00279 <span class="keywordflow">return</span>;
+00280
+00281 <span class="comment">// set up the current sheet in container to remove sheet that are in the container and not in the directory anymore</span>
+00282 std::map&lt;NLMISC::CSheetId, bool&gt; sheetToRemove;
+00283 <span class="keywordflow">for</span> (<span class="keyword">typename</span> std::map&lt;NLMISC::CSheetId, T&gt;::iterator it = container.begin(); it != container.end(); it++)
+00284 {
+00285 sheetToRemove.insert (std::make_pair((*it).first, <span class="keyword">true</span>));
+00286 }
+00287
+00288 <span class="comment">// check if we need to create a new .pitems or just read it</span>
+00289 <a class="code" href="a04558.html#a11">uint32</a> packedFiledate = <a class="code" href="a02524.html#NLMISC_1_1CFilee9">NLMISC::CFile::getFileModificationDate</a>(packedFilenamePath);
+00290
+00291 <span class="keywordtype">bool</span> containerChanged = <span class="keyword">false</span>;
+00292
+00293 <a class="code" href="a02559.html">NLGEORGES::UFormLoader</a> *formLoader = NULL;
+00294
+00295 std::vector&lt;uint&gt; NeededToRecompute;
+00296
+00297 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = 0; k &lt; filenames.size(); k++)
+00298 {
+00299 std::string p = <a class="code" href="a03072.html#NLMISC_1_1CPathe15">NLMISC::CPath::lookup</a> (filenames[k], <span class="keyword">false</span>, <span class="keyword">false</span>);
+00300 <span class="keywordflow">if</span> (p.empty()) <span class="keywordflow">continue</span>;
+00301 <a class="code" href="a04558.html#a11">uint32</a> d = <a class="code" href="a02524.html#NLMISC_1_1CFilee9">NLMISC::CFile::getFileModificationDate</a>(p);
+00302
+00303 <span class="comment">// no need to remove this sheet</span>
+00304 sheetToRemove[sheetIds[k]] = <span class="keyword">false</span>;
+00305
+00306 <span class="keywordflow">if</span>( d &gt; packedFiledate || container.find (sheetIds[k]) == container.end())
+00307 {
+00308 NeededToRecompute.push_back(k);
+00309 }
+00310 <span class="keywordflow">else</span>
+00311 {
+00312 <span class="comment">// check the date of each parent</span>
+00313 <a class="code" href="a04199.html#a6">nlassert</a>(dependencies.find(sheetIds[k]) != dependencies.end());
+00314 std::vector&lt;uint32&gt; &amp;depends = dependencies[sheetIds[k]];
+00315
+00316 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i&lt;depends.size(); ++i)
+00317 {
+00318 <span class="keywordflow">if</span> (dependencyDates[depends[i]] &gt; packedFiledate)
+00319 {
+00320 <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"Dependancy on %s for %s not up to date !"</span>,
+00321 dictionnary[depends[i]].c_str(), sheetIds[k].<a class="code" href="a05378.html#a244">toString</a>().c_str());
+00322 NeededToRecompute.push_back(k);
+00323 <span class="keywordflow">break</span>;
+00324 }
+00325 }
+00326 }
+00327 }
+00328
+00329 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"%d sheets checked, %d need to be recomputed"</span>, filenames.size(), NeededToRecompute.size());
+00330
+00331 <a class="code" href="a05378.html#a242">NLMISC::TTime</a> last = <a class="code" href="a02142.html#NLMISC_1_1CTimee0">NLMISC::CTime::getLocalTime</a> ();
+00332 <a class="code" href="a05378.html#a242">NLMISC::TTime</a> start = <a class="code" href="a02142.html#NLMISC_1_1CTimee0">NLMISC::CTime::getLocalTime</a> ();
+00333
+00334 <a class="code" href="a03408.html">NLMISC::CSmartPtr&lt;NLGEORGES::UForm&gt;</a> form;
+00335 std::vector&lt;NLMISC::CSmartPtr&lt;NLGEORGES::UForm&gt; &gt; cacheFormList;
+00336
+00337 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j = 0; j &lt; NeededToRecompute.size(); j++)
+00338 {
+00339 <span class="keywordflow">if</span>(<a class="code" href="a02142.html#NLMISC_1_1CTimee0">NLMISC::CTime::getLocalTime</a> () &gt; last + 5000)
+00340 {
+00341 last = <a class="code" href="a02142.html#NLMISC_1_1CTimee0">NLMISC::CTime::getLocalTime</a> ();
+00342 <span class="keywordflow">if</span>(j&gt;0)
+00343 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"%.0f%% completed (%d/%d), %d seconds remaining"</span>, (<span class="keywordtype">float</span>)j*100.0/NeededToRecompute.size(),j,NeededToRecompute.size(), (NeededToRecompute.size()-j)*(last-start)/j/1000);
+00344 }
+00345
+00346 <span class="comment">// create the georges loader if necessary</span>
+00347 <span class="keywordflow">if</span> (formLoader == NULL)
+00348 {
+00349 NLMISC::WarningLog-&gt;addNegativeFilter(<span class="stringliteral">"CFormLoader: Can't open the form file"</span>);
+00350 formLoader = <a class="code" href="a02559.html#NLGEORGES_1_1UFormLoadere0">NLGEORGES::UFormLoader::createLoader</a> ();
+00351 }
+00352
+00353 <span class="comment">// cache used to retain information (to optimize time).</span>
+00354 <span class="keywordflow">if</span> (form)
+00355 cacheFormList.push_back (form);
+00356
+00357 <span class="comment">// Load the form with given sheet id</span>
+00358 form = formLoader-&gt;<a class="code" href="a02559.html#NLGEORGES_1_1UFormLoadera0">loadForm</a> (sheetIds[NeededToRecompute[j]].<a class="code" href="a05378.html#a244">toString</a>().c_str ());
+00359 <span class="keywordflow">if</span> (form)
+00360 {
+00361 <span class="comment">// build the dependency data</span>
+00362 {
+00363 std::vector&lt;uint32&gt; depends;
+00364 std::set&lt;std::string&gt; dependFiles;
+00365 form-&gt;getDependencies (dependFiles);
+00366 <a class="code" href="a04199.html#a6">nlassert</a>(dependFiles.find(sheetIds[NeededToRecompute[j]].toString()) != dependFiles.end());
+00367 <span class="comment">// remove the sheet itself from the container</span>
+00368 dependFiles.erase(sheetIds[NeededToRecompute[j]].<a class="code" href="a05378.html#a244">toString</a>());
+00369
+00370 std::set&lt;std::string&gt;::iterator first(dependFiles.begin()), last(dependFiles.end());
+00371 <span class="keywordflow">for</span> (; first != last; ++first)
+00372 {
+00373 <span class="keyword">const</span> std::string <a class="code" href="a05377.html#a2">filename</a> = <a class="code" href="a02524.html#NLMISC_1_1CFilee10">NLMISC::CFile::getFilename</a>(*first);
+00374 std::map&lt;std::string,uint&gt;::iterator findDicIt=dictionnaryIndex.find(filename);
+00375
+00376 <span class="keywordflow">if</span> (findDicIt!=dictionnaryIndex.end())
+00377 {
+00378 depends.push_back(findDicIt-&gt;second);
+00379 <span class="keywordflow">continue</span>;
+00380 }
+00381
+00382 std::string p = <a class="code" href="a03072.html#NLMISC_1_1CPathe15">NLMISC::CPath::lookup</a> (*first, <span class="keyword">false</span>, <span class="keyword">false</span>);
+00383 <span class="keywordflow">if</span> (!p.empty())
+00384 {
+00385 <span class="comment">// uint32 date = NLMISC::CFile::getFileModificationDate(p);</span>
+00386
+00387 <a class="code" href="a04558.html#a15">uint</a> dicIndex;
+00388 <span class="comment">// std::string filename = NLMISC::CFile::getFilename(p);</span>
+00389
+00390 <span class="comment">// if (dictionnaryIndex.find(filename) == dictionnaryIndex.end())</span>
+00391 <span class="comment">// {</span>
+00392 <span class="comment">// add a new dictionnary entry</span>
+00393 dicIndex = dictionnary.size();
+00394 dictionnaryIndex.insert(std::make_pair(filename, dictionnary.size()));
+00395 dictionnary.push_back(filename);
+00396 <span class="comment">// }</span>
+00397 <span class="comment">// else</span>
+00398 <span class="comment">// {</span>
+00399 <span class="comment">// dicIndex = dictionnaryIndex.find(filename)-&gt;second;</span>
+00400 <span class="comment">// }</span>
+00401
+00402 <span class="comment">// add the dependecy index</span>
+00403 depends.push_back(dicIndex);
+00404 }
+00405 }
+00406 <span class="comment">// store the dependency list with the sheet ID</span>
+00407 dependencies[sheetIds[NeededToRecompute[j]]] = depends;
+00408 }
+00409
+00410 <span class="comment">// add the new creature, it could be already loaded by the packed sheets but will be overwrite with the new one</span>
+00411 <span class="keyword">typedef</span> <span class="keyword">typename</span> std::map&lt;NLMISC::CSheetId, T&gt;::iterator TType1;
+00412 <span class="keyword">typedef</span> <span class="keyword">typename</span> std::pair&lt;TType1, bool&gt; TType2;
+00413 TType2 <a class="code" href="a04223.html#a643">res</a> = container.insert(std::make_pair(sheetIds[NeededToRecompute[j]],T()));
+00414
+00415 (*<a class="code" href="a04223.html#a643">res</a>.first).second.readGeorges (form, sheetIds[NeededToRecompute[j]]);
+00416 containerChanged = <span class="keyword">true</span>;
+00417 }
+00418 }
+00419
+00420 <span class="keywordflow">if</span>(NeededToRecompute.size() &gt; 0)
+00421 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"%d seconds to recompute %d sheets"</span>, (<a class="code" href="a04558.html#a11">uint32</a>)(NLMISC::CTime::getLocalTime()-start)/1000, NeededToRecompute.size());
+00422
+00423 <span class="comment">// free the georges loader if necessary</span>
+00424 <span class="keywordflow">if</span> (formLoader != NULL)
+00425 {
+00426 <a class="code" href="a02559.html#NLGEORGES_1_1UFormLoadere1">NLGEORGES::UFormLoader::releaseLoader</a> (formLoader);
+00427 NLMISC::WarningLog-&gt;removeFilter (<span class="stringliteral">"CFormLoader: Can't open the form file"</span>);
+00428 }
+00429
+00430 <span class="comment">// we have now to remove sheet that are in the container and not exist anymore in the sheet directories</span>
+00431 <span class="keywordflow">for</span> (std::map&lt;NLMISC::CSheetId, bool&gt;::iterator it2 = sheetToRemove.begin(); it2 != sheetToRemove.end(); it2++)
+00432 {
+00433 <span class="keywordflow">if</span>((*it2).second)
+00434 {
+00435 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"the sheet '%s' is not in the directory, remove it from container"</span>, (*it2).first.toString().c_str());
+00436 container.find((*it2).first)-&gt;second.removed();
+00437 container.erase((*it2).first);
+00438 containerChanged = <span class="keyword">true</span>;
+00439 dependencies.erase((*it2).first);
+00440 }
+00441 }
+00442
+00443 <span class="comment">// now, save the new container in the packedfile</span>
+00444 <span class="keywordflow">try</span>
+00445 {
+00446 <span class="keywordflow">if</span>(containerChanged)
+00447 {
+00448 <a class="code" href="a03011.html">NLMISC::COFile</a> ofile;
+00449 ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea9">open</a>(packedFilenamePath);
+00450
+00451 <span class="comment">// write the header.</span>
+00452 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_0">serialCheck</a>(PACKED_SHEET_HEADER);
+00453 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_0">serialCheck</a>(PACKED_SHEET_VERSION);
+00454 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2035_8">serialVersion</a>(PACKED_SHEET_VERSION_COMPATIBLE);
+00455
+00456 <span class="comment">// Write a dummy block size for now</span>
+00457 <a class="code" href="a04558.html#a10">sint32</a> posBlockSize= ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea4">getPos</a>();
+00458 <a class="code" href="a04558.html#a11">uint32</a> dependBlockSize= 0;
+00459 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(dependBlockSize);
+00460
+00461 <span class="comment">// write the dictionnary</span>
+00462 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(dictionnary);
+00463
+00464 <span class="comment">// write the dependencies data</span>
+00465 <a class="code" href="a04558.html#a11">uint32</a> depSize = dependencies.size();
+00466 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(depSize);
+00467 std::map&lt;NLMISC::CSheetId, std::vector&lt;uint32&gt; &gt;::iterator first(dependencies.begin()), last(dependencies.end());
+00468 <span class="keywordflow">for</span> (; first != last; ++first)
+00469 {
+00470 <a class="code" href="a03384.html">NLMISC::CSheetId</a> si = first-&gt;first;
+00471 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(si);
+00472 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(first-&gt;second);
+00473 }
+00474
+00475 <span class="comment">// Then get the dicionary + dependencies size, and write it back to posBlockSize</span>
+00476 <a class="code" href="a04558.html#a10">sint32</a> endBlockSize= ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea4">getPos</a>();
+00477 dependBlockSize= (endBlockSize - posBlockSize) - 4;
+00478 ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea10">seek</a>(posBlockSize, NLMISC::IStream::begin);
+00479 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(dependBlockSize);
+00480 ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea10">seek</a>(endBlockSize, NLMISC::IStream::begin);
+00481
+00482 <span class="comment">// write the sheet data</span>
+00483 <a class="code" href="a04558.html#a11">uint32</a> nbEntries = sheetIds.size();
+00484 <a class="code" href="a04558.html#a11">uint32</a> ver = T::getVersion ();
+00485 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a> (nbEntries);
+00486 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a> (ver);
+00487 ofile.<a class="code" href="a02270.html#NLMISC_1_1IStreamz2033_9">serialCont</a>(container);
+00488 ofile.<a class="code" href="a03011.html#NLMISC_1_1COFilea0">close</a> ();
+00489 }
+00490 }
+00491 <span class="keywordflow">catch</span> (<a class="code" href="a02482.html">NLMISC::Exception</a> &amp;e)
+00492 {
+00493 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"loadForm(): Exception during saving the packed file, it will be recreated next launch (%s)"</span>, e.what());
+00494 }
+00495
+00496 <span class="comment">// housekeeping</span>
+00497 sheetIds.clear ();
+00498 filenames.clear ();
+00499 }
+</pre></div> </td>
+ </tr>
+</table>
+<a class="anchor" name="a3" doxytag="load_form.h::loadForm" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" colspan="4">
+template&lt;class T&gt; </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap valign="top"> void loadForm </td>
+ <td class="md" valign="top">(&nbsp;</td>
+ <td class="md" nowrap valign="top">const std::string &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>sheetFilter</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>const std::string &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>packedFilename</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>std::map&lt; <a class="el" href="a03384.html">NLMISC::CSheetId</a>, T &gt; &amp;&nbsp;</td>
+ <td class="mdname" nowrap> <em>container</em>, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>updatePackedSheet</em> = true, </td>
+ </tr>
+ <tr>
+ <td class="md" nowrap align="right"></td>
+ <td></td>
+ <td class="md" nowrap>bool&nbsp;</td>
+ <td class="mdname" nowrap> <em>errorIfPackedSheetNotGood</em> = true</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class="md">)&nbsp;</td>
+ <td class="md" colspan="2"></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+This function is used to load values from georges sheet in a quick way. <dl compact><dt><b>Parameters:</b></dt><dd>
+ <table border="0" cellspacing="2" cellpadding="0">
+ <tr><td valign=top><em>sheetFilter</em>&nbsp;</td><td>a string to filter the sheet (ie: ".item") </td></tr>
+ <tr><td valign=top><em>packedFilename</em>&nbsp;</td><td>the name of the file that this function will generate (extension must be "packed_sheets") </td></tr>
+ <tr><td valign=top><em>container</em>&nbsp;</td><td>the map that will be filled by this function </td></tr>
+ </table>
+</dl>
+
+<p>
+Definition at line <a class="el" href="a05926.html#l00132">132</a> of file <a class="el" href="a05926.html">load_form.h</a>.
+<p>
+References <a class="el" href="a05926.html#l00522">loadForm()</a>.
+<p>
+<div class="fragment"><pre>00133 {
+00134 std::vector&lt;std::string&gt; vs;
+00135 vs.push_back(sheetFilter);
+00136 <a class="code" href="a04503.html#a6">loadForm</a>(vs, packedFilename, container, updatePackedSheet, errorIfPackedSheetNotGood);
+00137 }
+</pre></div> </td>
+ </tr>
+</table>
+<hr><h2>Variable Documentation</h2>
+<a class="anchor" name="a0" doxytag="load_form.h::PACKED_SHEET_HEADER" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a04503.html#a0">PACKED_SHEET_HEADER</a> = 'PKSH'
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+Dictionnaley entry for dependency information.
+<p>
+This function is used to load values from georges sheet in a quick way. The first time it loads the sheet and parse it with the readGeorges function provided by the user to read the value he wants. It'll generate a packed file that contains this values (using serialCont). The next launch, the function will only load the packed file and if some sheet have changed, it'll automatically regenerate the packed file.<p>
+To use the <a class="el" href="a04503.html#a3">loadForm()</a>, you first have to create a class that will contains values for one sheet. This class must also implements 2 functions (readGeorges() and serial()) and 1 static functions (getVersion())<p>
+Extension file name for the packedFilename must be ".packed_sheets"<p>
+Classical use (copy/paste this in your code):<p>
+For each sheet in the packed sheet, an instance of this class is created and stored into an stl container. This class must be default and copy constructable. class CContainerEntry { public: CContainerEntry () : WalkSpeed(1.3f), RunSpeed(6.0f) {}<p>
+float WalkSpeed, RunSpeed;<p>
+load the values using the george sheet void readGeorges (const NLMISC::CSmartPtr&lt;NLGEORGES::UForm&gt; &amp;form, const <a class="el" href="a03384.html">NLMISC::CSheetId</a> &amp;sheetId) { the form was found so read the true values from George form-&gt;getRootNode ().getValueByName (WalkSpeed, "Basics.MovementSpeeds.WalkSpeed"); form-&gt;getRootNode ().getValueByName (RunSpeed, "Basics.MovementSpeeds.RunSpeed"); }<p>
+load/save the values using the serial system void serial (<a class="el" href="a02270.html">NLMISC::IStream</a> &amp;s) { s.serial (WalkSpeed, RunSpeed); }<p>
+Event to implement any action when the sheet is no longeur existent. This method is call when a sheet have been read from the packed sheet and the associated sheet file no more exist in the directories. void removed() { any action that is needed if the sheet no more exist. }<p>
+return the version of this class, increments this value when the content hof this class changed static uint getVersion () { return 1; } };<p>
+this structure is fill by the <a class="el" href="a04503.html#a3">loadForm()</a> function and will contain all you need std::map&lt;NLMISC::CSheetId,CContainerEntry&gt; Container;<p>
+void init () { load the values using the george sheet or packed file and fill the container loadForm(".creature", "test.packed_sheets", Container); }<p>
+Now you can access the Container (using the CSheedId) to know the WalkSpeed and RunSpeed of all creatures.
+<p>
+Definition at line <a class="el" href="a05926.html#l00120">120</a> of file <a class="el" href="a05926.html">load_form.h</a>.
+<p>
+Referenced by <a class="el" href="a05926.html#l00145">loadForm()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a1" doxytag="load_form.h::PACKED_SHEET_VERSION" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a04503.html#a1">PACKED_SHEET_VERSION</a> = 5
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a05926.html#l00121">121</a> of file <a class="el" href="a05926.html">load_form.h</a>.
+<p>
+Referenced by <a class="el" href="a05926.html#l00145">loadForm()</a>. </td>
+ </tr>
+</table>
+<a class="anchor" name="a2" doxytag="load_form.h::PACKED_SHEET_VERSION_COMPATIBLE" ></a><p>
+<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
+ <tr>
+ <td class="mdRow">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td class="md" nowrap valign="top"> const <a class="el" href="a04558.html#a11">uint32</a> <a class="el" href="a04503.html#a2">PACKED_SHEET_VERSION_COMPATIBLE</a> = 0
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+
+<p>
+Definition at line <a class="el" href="a05926.html#l00123">123</a> of file <a class="el" href="a05926.html">load_form.h</a>.
+<p>
+Referenced by <a class="el" href="a05926.html#l00145">loadForm()</a>. </td>
+ </tr>
+</table>
+<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:42:53 2004 for NeL by
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.png" alt="doxygen" align="middle" border=0 >
+</a>1.3.6 </small></address>
+</body>
+</html>