1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>libqalculate-0.9.7: CompositeUnit Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="classes.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="classes.html"><span>Alphabetical List</span></a></li>
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>CompositeUnit Class Reference</h1><!-- doxytag: class="CompositeUnit" --><!-- doxytag: inherits="Unit" -->A unit consisting of a number of other units.
<a href="#_details">More...</a>
<p>
<code>#include <Unit.h></code>
<p>
<div class="dynheader">
Inheritance diagram for CompositeUnit:</div>
<div class="dynsection">
<p><center><img src="classCompositeUnit.png" usemap="#CompositeUnit_map" border="0" alt=""></center>
<map name="CompositeUnit_map">
<area href="classUnit.html" alt="Unit" shape="rect" coords="0,56,96,80">
<area href="classExpressionItem.html" alt="ExpressionItem" shape="rect" coords="0,0,96,24">
</map>
</div>
<p>
<a href="classCompositeUnit-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="20794bf0f7fc27be51c329c7a92f2682"></a><!-- doxytag: member="CompositeUnit::CompositeUnit" ref="20794bf0f7fc27be51c329c7a92f2682" args="(string cat_, string name_, string title_="", string base_expression_="", bool is_local=true, bool is_builtin=false, bool is_active=true)" -->
</td><td class="memItemRight" valign="bottom"><b>CompositeUnit</b> (string cat_, string name_, string title_="", string base_expression_="", bool is_local=true, bool is_builtin=false, bool is_active=true)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9d6cdfe3cd3014ff993da766601fa6a1"></a><!-- doxytag: member="CompositeUnit::CompositeUnit" ref="9d6cdfe3cd3014ff993da766601fa6a1" args="(const CompositeUnit *unit)" -->
</td><td class="memItemRight" valign="bottom"><b>CompositeUnit</b> (const <a class="el" href="classCompositeUnit.html">CompositeUnit</a> *unit)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="aa28249f9f533a9ead2635df8c25b753"></a><!-- doxytag: member="CompositeUnit::copy" ref="aa28249f9f533a9ead2635df8c25b753" args="() const " -->
virtual <a class="el" href="classExpressionItem.html">ExpressionItem</a> * </td><td class="memItemRight" valign="bottom"><b>copy</b> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2c08f514f6ff46ca5080f09b1aaa6b6e"></a><!-- doxytag: member="CompositeUnit::set" ref="2c08f514f6ff46ca5080f09b1aaa6b6e" args="(const ExpressionItem *item)" -->
virtual void </td><td class="memItemRight" valign="bottom"><b>set</b> (const <a class="el" href="classExpressionItem.html">ExpressionItem</a> *item)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCompositeUnit.html#29bb1470357216a0bac8b48fbaf782fe">add</a> (<a class="el" href="classUnit.html">Unit</a> *u, int exp=1, <a class="el" href="classPrefix.html">Prefix</a> *prefix=NULL)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classUnit.html">Unit</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classCompositeUnit.html#d8efa0ee81f5b76c09042f42f1af1d5c">get</a> (size_t index, int *exp=NULL, <a class="el" href="classPrefix.html">Prefix</a> **prefix=NULL) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="edb6ed03595e9660bbdb7211c9a993e2"></a><!-- doxytag: member="CompositeUnit::setExponent" ref="edb6ed03595e9660bbdb7211c9a993e2" args="(size_t index, int exp)" -->
virtual void </td><td class="memItemRight" valign="bottom"><b>setExponent</b> (size_t index, int exp)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3f387be24aedc778eb5c8a1d8b9464e7"></a><!-- doxytag: member="CompositeUnit::setPrefix" ref="3f387be24aedc778eb5c8a1d8b9464e7" args="(size_t index, Prefix *prefix)" -->
virtual void </td><td class="memItemRight" valign="bottom"><b>setPrefix</b> (size_t index, <a class="el" href="classPrefix.html">Prefix</a> *prefix)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classCompositeUnit.html#aa4645bfab416d5c0ba79905a0a5922d">countUnits</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b5db4561a5af88dc56fd0a5585b7050b"></a><!-- doxytag: member="CompositeUnit::find" ref="b5db4561a5af88dc56fd0a5585b7050b" args="(Unit *u) const " -->
virtual size_t </td><td class="memItemRight" valign="bottom"><b>find</b> (<a class="el" href="classUnit.html">Unit</a> *u) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="fc2aaf66c439fa0fdd4c026c02504dc1"></a><!-- doxytag: member="CompositeUnit::del" ref="fc2aaf66c439fa0fdd4c026c02504dc1" args="(size_t index)" -->
virtual void </td><td class="memItemRight" valign="bottom"><b>del</b> (size_t index)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual string </td><td class="memItemRight" valign="bottom"><a class="el" href="classCompositeUnit.html#d559c0605c9801cd78fd4bf841658a2f">print</a> (bool plural_, bool short_, bool use_unicode=false, bool(*can_display_unicode_string_function)(const char *, void *)=NULL, void *can_display_unicode_string_arg=NULL) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classCompositeUnit.html#12eb9a85f6e2994afa64ef037037f4f9">subtype</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classCompositeUnit.html#6a84382a720c02dba4212c13057b50bc">containsRelativeTo</a> (<a class="el" href="classUnit.html">Unit</a> *u) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classMathStructure.html">MathStructure</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCompositeUnit.html#9b689b47703ca28458063f53a8aabae9">generateMathStructure</a> (bool make_division=false) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d9244e7f29c4cffe3c1d0b9e3f9f1c08"></a><!-- doxytag: member="CompositeUnit::setBaseExpression" ref="d9244e7f29c4cffe3c1d0b9e3f9f1c08" args="(string base_expression_)" -->
virtual void </td><td class="memItemRight" valign="bottom"><b>setBaseExpression</b> (string base_expression_)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCompositeUnit.html#57866a6e169bb83e66793c8f475a9f67">clear</a> ()</td></tr>
<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0e9d08254795f6de38b4ea6d6bab8e07"></a><!-- doxytag: member="CompositeUnit::sshort" ref="0e9d08254795f6de38b4ea6d6bab8e07" args="" -->
string </td><td class="memItemRight" valign="bottom"><b>sshort</b></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="99a8e517204a3e64ec60b52031b38ed9"></a><!-- doxytag: member="CompositeUnit::units" ref="99a8e517204a3e64ec60b52031b38ed9" args="" -->
vector< <a class="el" href="classAliasUnit__Composite.html">AliasUnit_Composite</a> * > </td><td class="memItemRight" valign="bottom"><b>units</b></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A unit consisting of a number of other units.
<p>
Composite units are defined by a unit expression with multiple units. Composite units often have an alias unit associated with them, as they do not have a reference name on their own. For example, a joule is defined as an alias defined in relation to a composite unit defined as "Newton * meter".<p>
The names of composite units is only used to reference the unit in definitions of other units. They can not be used in expressions.<p>
Composite units is definited as a composition of units. The units, with prefixes and exponents, can either be added one by one with <a class="el" href="classCompositeUnit.html#29bb1470357216a0bac8b48fbaf782fe">add()</a> or parsed from an expression (ex. "cm^3/g) with setBaseExpression(). <hr><h2>Member Function Documentation</h2>
<a class="anchor" name="29bb1470357216a0bac8b48fbaf782fe"></a><!-- doxytag: member="CompositeUnit::add" ref="29bb1470357216a0bac8b48fbaf782fe" args="(Unit *u, int exp=1, Prefix *prefix=NULL)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual void CompositeUnit::add </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classUnit.html">Unit</a> * </td>
<td class="paramname"> <em>u</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"> <em>exp</em> = <code>1</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classPrefix.html">Prefix</a> * </td>
<td class="paramname"> <em>prefix</em> = <code>NULL</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Adds a sub/base unit with specified exponent and an optional prefix.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>u</em> </td><td><a class="el" href="classUnit.html" title="A unit for measurement.">Unit</a>. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>exp</em> </td><td>Exponent. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>prefix</em> </td><td><a class="el" href="classPrefix.html" title="Abstract class for prefixes.">Prefix</a>. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="d8efa0ee81f5b76c09042f42f1af1d5c"></a><!-- doxytag: member="CompositeUnit::get" ref="d8efa0ee81f5b76c09042f42f1af1d5c" args="(size_t index, int *exp=NULL, Prefix **prefix=NULL) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classUnit.html">Unit</a>* CompositeUnit::get </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>index</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"> <em>exp</em> = <code>NULL</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classPrefix.html">Prefix</a> ** </td>
<td class="paramname"> <em>prefix</em> = <code>NULL</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Retrieves information about a sub/base unit<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>index</em> </td><td>Index starting at 1. </td></tr>
<tr><td valign="top"><tt>[out]</tt> </td><td valign="top"><em>exp</em> </td><td>Exponent. </td></tr>
<tr><td valign="top"><tt>[out]</tt> </td><td valign="top"><em>prefix</em> </td><td><a class="el" href="classPrefix.html" title="Abstract class for prefixes.">Prefix</a>. </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Sub/base unit (AliasUnit_Composite::firstBaseUnit()). </dd></dl>
</div>
</div><p>
<a class="anchor" name="aa4645bfab416d5c0ba79905a0a5922d"></a><!-- doxytag: member="CompositeUnit::countUnits" ref="aa4645bfab416d5c0ba79905a0a5922d" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual size_t CompositeUnit::countUnits </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the number of sub/base units
</div>
</div><p>
<a class="anchor" name="d559c0605c9801cd78fd4bf841658a2f"></a><!-- doxytag: member="CompositeUnit::print" ref="d559c0605c9801cd78fd4bf841658a2f" args="(bool plural_, bool short_, bool use_unicode=false, bool(*can_display_unicode_string_function)(const char *, void *)=NULL, void *can_display_unicode_string_arg=NULL) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual string CompositeUnit::print </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>plural_</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>short_</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>use_unicode</em> = <code>false</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool(*)(const char *, void *) </td>
<td class="paramname"> <em>can_display_unicode_string_function</em> = <code>NULL</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"> <em>can_display_unicode_string_arg</em> = <code>NULL</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Prints out the sub/base units with prefixes and exponents. This is the representation of the unit in expressions.
<p>Reimplemented from <a class="el" href="classUnit.html#4ad80de27c26cbe1963f584b38e00e61">Unit</a>.</p>
</div>
</div><p>
<a class="anchor" name="12eb9a85f6e2994afa64ef037037f4f9"></a><!-- doxytag: member="CompositeUnit::subtype" ref="12eb9a85f6e2994afa64ef037037f4f9" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual int CompositeUnit::subtype </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the subtype of the unit, corresponding to which subsubclass the object belongs to.<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd><a class="el" href="Unit_8h.html#187e4d06747a26a2325145b16ff73915" title="Type of unit.">UnitSubtype</a>. </dd></dl>
<p>Reimplemented from <a class="el" href="classUnit.html#d9f4f05c29ed947195274abc7d9a39a3">Unit</a>.</p>
</div>
</div><p>
<a class="anchor" name="6a84382a720c02dba4212c13057b50bc"></a><!-- doxytag: member="CompositeUnit::containsRelativeTo" ref="6a84382a720c02dba4212c13057b50bc" args="(Unit *u) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual bool CompositeUnit::containsRelativeTo </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classUnit.html">Unit</a> * </td>
<td class="paramname"> <em>u</em> </td>
<td> ) </td>
<td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
If this unit contains a sub/base unit with a relation to the specified unit.
</div>
</div><p>
<a class="anchor" name="9b689b47703ca28458063f53a8aabae9"></a><!-- doxytag: member="CompositeUnit::generateMathStructure" ref="9b689b47703ca28458063f53a8aabae9" args="(bool make_division=false) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classMathStructure.html">MathStructure</a> CompositeUnit::generateMathStructure </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>make_division</em> = <code>false</code> </td>
<td> ) </td>
<td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a <a class="el" href="classMathStructure.html" title="A structure representing a mathematical value/expression/result.">MathStructure</a> with the sub/base units of the unit.
</div>
</div><p>
<a class="anchor" name="57866a6e169bb83e66793c8f475a9f67"></a><!-- doxytag: member="CompositeUnit::clear" ref="57866a6e169bb83e66793c8f475a9f67" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual void CompositeUnit::clear </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td width="100%"><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Removes all sub/base units.
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>libqalculate/<a class="el" href="Unit_8h.html">Unit.h</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jan 5 08:26:29 2010 for libqalculate-0.9.7 by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
</body>
</html>
|