Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > aaf33964de706a538481c929c1da6a44 > files > 3072

faust-doc-0.9.10-5mdv2010.1.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>FAUST compiler: description.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>description.cpp File Reference</h1><code>#include &lt;map&gt;</code><br/>
<code>#include &lt;set&gt;</code><br/>
<code>#include &lt;string&gt;</code><br/>
<code>#include &quot;<a class="el" href="description_8hh_source.html">description.hh</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="Text_8hh_source.html">Text.hh</a>&quot;</code><br/>
<div class="dynheader">
Include dependency graph for description.cpp:</div>
<div class="dynsection">
</div>

<p><a href="description_8cpp_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="description_8cpp.html#a96e69d2d939df869ffe8081b135df075">rmWhiteSpaces</a> (const string &amp;s)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><a class="el" href="description_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces()</a>: Remove the leading and trailing white spaces of a string (but not those in the middle of the string)  <a href="#a96e69d2d939df869ffe8081b135df075"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="description_8cpp.html#af40d9db717982956ede067d6eeab6105">extractMetadata</a> (const string &amp;fulllabel, string &amp;label, map&lt; string, set&lt; string &gt; &gt; &amp;metadata)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Extracts metdata from a label : 'vol [unit: dB]' -&gt; 'vol' + metadata.  <a href="#af40d9db717982956ede067d6eeab6105"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="description_8cpp.html#a1e3d472857254af93731659f878b78de">xmlize</a> (const string &amp;fullsrc)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">removes enclosing quotes and transforms '&lt;', '&gt;' and '&amp;' characters  <a href="#a1e3d472857254af93731659f878b78de"></a><br/></td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="af40d9db717982956ede067d6eeab6105"></a><!-- doxytag: member="description.cpp::extractMetadata" ref="af40d9db717982956ede067d6eeab6105" args="(const string &amp;fulllabel, string &amp;label, map&lt; string, set&lt; string &gt; &gt; &amp;metadata)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static void extractMetadata </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&nbsp;</td>
          <td class="paramname"> <em>fulllabel</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">string &amp;&nbsp;</td>
          <td class="paramname"> <em>label</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">map&lt; string, set&lt; string &gt; &gt; &amp;&nbsp;</td>
          <td class="paramname"> <em>metadata</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Extracts metdata from a label : 'vol [unit: dB]' -&gt; 'vol' + metadata. </p>

<p>Definition at line <a class="el" href="description_8cpp_source.html#l00030">30</a> of file <a class="el" href="description_8cpp_source.html">description.cpp</a>.</p>

<p>References <a class="el" href="description_8cpp_source.html#l00015">rmWhiteSpaces()</a>.</p>

<p>Referenced by <a class="el" href="description_8cpp_source.html#l00128">xmlize()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00031"></a>00031 {
<a name="l00032"></a>00032     <span class="keyword">enum</span> {kLabel, kEscape1, kEscape2, kEscape3, kKey, kValue};
<a name="l00033"></a>00033     <span class="keywordtype">int</span> state = kLabel; <span class="keywordtype">int</span> deep = 0;
<a name="l00034"></a>00034     <span class="keywordtype">string</span> key, value;
<a name="l00035"></a>00035 
<a name="l00036"></a>00036     <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0; i &lt; fulllabel.size(); i++) {
<a name="l00037"></a>00037         <span class="keywordtype">char</span> c = fulllabel[i];
<a name="l00038"></a>00038         <span class="keywordflow">switch</span> (state) {
<a name="l00039"></a>00039             <span class="keywordflow">case</span> kLabel :
<a name="l00040"></a>00040                 assert (deep == 0);
<a name="l00041"></a>00041                 <span class="keywordflow">switch</span> (c) {
<a name="l00042"></a>00042                     <span class="keywordflow">case</span> <span class="charliteral">&#39;\\&#39;</span> : state = kEscape1; <span class="keywordflow">break</span>;
<a name="l00043"></a>00043                     <span class="keywordflow">case</span> <span class="charliteral">&#39;[&#39;</span> : state = kKey; deep++; <span class="keywordflow">break</span>;
<a name="l00044"></a>00044                     <span class="keywordflow">default</span> : label += c;
<a name="l00045"></a>00045                 }
<a name="l00046"></a>00046                 <span class="keywordflow">break</span>;
<a name="l00047"></a>00047 
<a name="l00048"></a>00048             <span class="keywordflow">case</span> kEscape1 :
<a name="l00049"></a>00049                 label += c;
<a name="l00050"></a>00050                 state = kLabel;
<a name="l00051"></a>00051                 <span class="keywordflow">break</span>;
<a name="l00052"></a>00052 
<a name="l00053"></a>00053             <span class="keywordflow">case</span> kEscape2 :
<a name="l00054"></a>00054                 key += c;
<a name="l00055"></a>00055                 state = kKey;
<a name="l00056"></a>00056                 <span class="keywordflow">break</span>;
<a name="l00057"></a>00057 
<a name="l00058"></a>00058             <span class="keywordflow">case</span> kEscape3 :
<a name="l00059"></a>00059                 value += c;
<a name="l00060"></a>00060                 state = kValue;
<a name="l00061"></a>00061                 <span class="keywordflow">break</span>;
<a name="l00062"></a>00062 
<a name="l00063"></a>00063             <span class="keywordflow">case</span> kKey :
<a name="l00064"></a>00064                 assert (deep &gt; 0);
<a name="l00065"></a>00065                 <span class="keywordflow">switch</span> (c) {
<a name="l00066"></a>00066                     <span class="keywordflow">case</span> <span class="charliteral">&#39;\\&#39;</span> :  state = kEscape2;
<a name="l00067"></a>00067                                 <span class="keywordflow">break</span>;
<a name="l00068"></a>00068 
<a name="l00069"></a>00069                     <span class="keywordflow">case</span> <span class="charliteral">&#39;[&#39;</span> :  deep++;
<a name="l00070"></a>00070                                 key += c;
<a name="l00071"></a>00071                                 <span class="keywordflow">break</span>;
<a name="l00072"></a>00072 
<a name="l00073"></a>00073                     <span class="keywordflow">case</span> <span class="charliteral">&#39;:&#39;</span> :  <span class="keywordflow">if</span> (deep == 1) {
<a name="l00074"></a>00074                                     state = kValue;
<a name="l00075"></a>00075                                 } <span class="keywordflow">else</span> {
<a name="l00076"></a>00076                                     key += c;
<a name="l00077"></a>00077                                 }
<a name="l00078"></a>00078                                 <span class="keywordflow">break</span>;
<a name="l00079"></a>00079                     <span class="keywordflow">case</span> <span class="charliteral">&#39;]&#39;</span> :  deep--;
<a name="l00080"></a>00080                                 <span class="keywordflow">if</span> (deep &lt; 1) {
<a name="l00081"></a>00081                                     metadata[<a class="code" href="description_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces</a>(key)].insert(<span class="stringliteral">&quot;&quot;</span>);
<a name="l00082"></a>00082                                     state = kLabel;
<a name="l00083"></a>00083                                     key=<span class="stringliteral">&quot;&quot;</span>;
<a name="l00084"></a>00084                                     value=<span class="stringliteral">&quot;&quot;</span>;
<a name="l00085"></a>00085                                 } <span class="keywordflow">else</span> {
<a name="l00086"></a>00086                                     key += c;
<a name="l00087"></a>00087                                 }
<a name="l00088"></a>00088                                 <span class="keywordflow">break</span>;
<a name="l00089"></a>00089                     <span class="keywordflow">default</span> :   key += c;
<a name="l00090"></a>00090                 }
<a name="l00091"></a>00091                 <span class="keywordflow">break</span>;
<a name="l00092"></a>00092 
<a name="l00093"></a>00093             <span class="keywordflow">case</span> kValue :
<a name="l00094"></a>00094                 assert (deep &gt; 0);
<a name="l00095"></a>00095                 <span class="keywordflow">switch</span> (c) {
<a name="l00096"></a>00096                     <span class="keywordflow">case</span> <span class="charliteral">&#39;\\&#39;</span> : state = kEscape3;
<a name="l00097"></a>00097                                 <span class="keywordflow">break</span>;
<a name="l00098"></a>00098 
<a name="l00099"></a>00099                     <span class="keywordflow">case</span> <span class="charliteral">&#39;[&#39;</span> :  deep++;
<a name="l00100"></a>00100                                 value += c;
<a name="l00101"></a>00101                                 <span class="keywordflow">break</span>;
<a name="l00102"></a>00102 
<a name="l00103"></a>00103                     <span class="keywordflow">case</span> <span class="charliteral">&#39;]&#39;</span> :  deep--;
<a name="l00104"></a>00104                                 <span class="keywordflow">if</span> (deep &lt; 1) {
<a name="l00105"></a>00105                                     metadata[<a class="code" href="description_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces</a>(key)].insert(<a class="code" href="description_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces</a>(value));
<a name="l00106"></a>00106                                     state = kLabel;
<a name="l00107"></a>00107                                     key=<span class="stringliteral">&quot;&quot;</span>;
<a name="l00108"></a>00108                                     value=<span class="stringliteral">&quot;&quot;</span>;
<a name="l00109"></a>00109                                 } <span class="keywordflow">else</span> {
<a name="l00110"></a>00110                                     value += c;
<a name="l00111"></a>00111                                 }
<a name="l00112"></a>00112                                 <span class="keywordflow">break</span>;
<a name="l00113"></a>00113                     <span class="keywordflow">default</span> :   value += c;
<a name="l00114"></a>00114                 }
<a name="l00115"></a>00115                 <span class="keywordflow">break</span>;
<a name="l00116"></a>00116 
<a name="l00117"></a>00117             <span class="keywordflow">default</span> :
<a name="l00118"></a>00118                 cerr &lt;&lt; <span class="stringliteral">&quot;ERROR unrecognized state &quot;</span> &lt;&lt; state &lt;&lt; endl;
<a name="l00119"></a>00119         }
<a name="l00120"></a>00120     }
<a name="l00121"></a>00121     label = <a class="code" href="description_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces</a>(label);
<a name="l00122"></a>00122 }
</pre></div></p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="a96e69d2d939df869ffe8081b135df075"></a><!-- doxytag: member="description.cpp::rmWhiteSpaces" ref="a96e69d2d939df869ffe8081b135df075" args="(const string &amp;s)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static string rmWhiteSpaces </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&nbsp;</td>
          <td class="paramname"> <em>s</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p><a class="el" href="description_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces()</a>: Remove the leading and trailing white spaces of a string (but not those in the middle of the string) </p>

<p>Definition at line <a class="el" href="description_8cpp_source.html#l00015">15</a> of file <a class="el" href="description_8cpp_source.html">description.cpp</a>.</p>

<p>Referenced by <a class="el" href="description_8cpp_source.html#l00030">extractMetadata()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00016"></a>00016 {
<a name="l00017"></a>00017     <span class="keywordtype">size_t</span> i = s.find_first_not_of(<span class="stringliteral">&quot; \t&quot;</span>);
<a name="l00018"></a>00018     <span class="keywordtype">size_t</span> j = s.find_last_not_of(<span class="stringliteral">&quot; \t&quot;</span>);
<a name="l00019"></a>00019 
<a name="l00020"></a>00020     <span class="keywordflow">if</span> ( (i != string::npos) &amp; (j != string::npos) ) {
<a name="l00021"></a>00021         <span class="keywordflow">return</span> s.substr(i, 1+j-i);
<a name="l00022"></a>00022     } <span class="keywordflow">else</span> {
<a name="l00023"></a>00023         <span class="keywordflow">return</span> <span class="stringliteral">&quot;&quot;</span>;
<a name="l00024"></a>00024     }
<a name="l00025"></a>00025 }
</pre></div></p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="a1e3d472857254af93731659f878b78de"></a><!-- doxytag: member="description.cpp::xmlize" ref="a1e3d472857254af93731659f878b78de" args="(const string &amp;fullsrc)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static string xmlize </td>
          <td>(</td>
          <td class="paramtype">const string &amp;&nbsp;</td>
          <td class="paramname"> <em>fullsrc</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>removes enclosing quotes and transforms '&lt;', '&gt;' and '&amp;' characters </p>

<p>Definition at line <a class="el" href="description_8cpp_source.html#l00128">128</a> of file <a class="el" href="description_8cpp_source.html">description.cpp</a>.</p>

<p>References <a class="el" href="description_8cpp_source.html#l00030">extractMetadata()</a>.</p>

<p>Referenced by <a class="el" href="description_8cpp_source.html#l00210">Description::addGroup()</a>, <a class="el" href="description_8cpp_source.html#l00247">Description::addWidget()</a>, and <a class="el" href="description_8cpp_source.html#l00151">Description::print()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00129"></a>00129 {
<a name="l00130"></a>00130     map&lt;string, set&lt;string&gt; &gt; metadata;
<a name="l00131"></a>00131     <span class="keywordtype">string</span> dst;
<a name="l00132"></a>00132     <span class="keywordtype">string</span> src;
<a name="l00133"></a>00133 
<a name="l00134"></a>00134     <a class="code" href="description_8cpp.html#af40d9db717982956ede067d6eeab6105" title="Extracts metdata from a label : &amp;#39;vol [unit: dB]&amp;#39; -&amp;gt; &amp;#39;vol&amp;#39; + metadata...">extractMetadata</a>(fullsrc, src, metadata);
<a name="l00135"></a>00135     
<a name="l00136"></a>00136     <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0; i&lt;src.size(); i++) {
<a name="l00137"></a>00137         <span class="keywordflow">if</span> (src[i] == <span class="charliteral">&#39;&quot;&#39;</span> &amp; (i==0 | i==src.size()-1)) {
<a name="l00138"></a>00138             <span class="comment">// nothing to do just skip the quotes</span>
<a name="l00139"></a>00139         } <span class="keywordflow">else</span> {
<a name="l00140"></a>00140             <span class="keywordflow">switch</span> (src[i]) {
<a name="l00141"></a>00141                 <span class="keywordflow">case</span> <span class="charliteral">&#39;&lt;&#39;</span> : dst += <span class="stringliteral">&quot;&amp;lt;&quot;</span>; <span class="keywordflow">break</span>;
<a name="l00142"></a>00142                 <span class="keywordflow">case</span> <span class="charliteral">&#39;&gt;&#39;</span> : dst += <span class="stringliteral">&quot;&amp;gt;&quot;</span>; <span class="keywordflow">break</span>;
<a name="l00143"></a>00143                 <span class="keywordflow">case</span> <span class="charliteral">&#39;&amp;&#39;</span> : dst += <span class="stringliteral">&quot;&amp;amp;&quot;</span>; <span class="keywordflow">break</span>;
<a name="l00144"></a>00144                 <span class="keywordflow">default</span> :  dst += src[i];
<a name="l00145"></a>00145             }
<a name="l00146"></a>00146         }
<a name="l00147"></a>00147     }
<a name="l00148"></a>00148     <span class="keywordflow">return</span> dst;
<a name="l00149"></a>00149 }
</pre></div></p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Apr 29 00:00:03 2010 for FAUST compiler by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>