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 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
|
<!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>libqalculate-0.9.6: CompositeUnit Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.3 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div>
<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>
<p>Inheritance diagram for CompositeUnit:
<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>
<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="a0"></a><!-- doxytag: member=<CompositeUnit::CompositeUnit> ref=<a0> 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="a1"></a><!-- doxytag: member=<CompositeUnit::CompositeUnit> ref=<a1> 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="a3"></a><!-- doxytag: member=<CompositeUnit::copy> ref=<a3> 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="a4"></a><!-- doxytag: member=<CompositeUnit::set> ref=<a4> 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#a5">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#a6">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="a7"></a><!-- doxytag: member=<CompositeUnit::setExponent> ref=<a7> 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="a8"></a><!-- doxytag: member=<CompositeUnit::setPrefix> ref=<a8> 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#a9">countUnits</a> () const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a10"></a><!-- doxytag: member=<CompositeUnit::find> ref=<a10> 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="a11"></a><!-- doxytag: member=<CompositeUnit::del> ref=<a11> 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#a12">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#a13">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#a14">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#a15">generateMathStructure</a> (bool make_division=false) const </td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a16"></a><!-- doxytag: member=<CompositeUnit::setBaseExpression> ref=<a16> 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#a17">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="p0"></a><!-- doxytag: member=<CompositeUnit::sshort> ref=<p0> 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="p1"></a><!-- doxytag: member=<CompositeUnit::units> ref=<p1> 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#a5">add()</a> or parsed from an expression (ex. "cm^3/g) with setBaseExpression().
<p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a5"></a><!-- doxytag: member=<CompositeUnit::add> ref=<a5> args=<(Unit *u, int exp=1, Prefix *prefix=NULL)> --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">virtual void CompositeUnit::add </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="classUnit.html">Unit</a> * </td>
<td class="mdname" nowrap> <em>u</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>int </td>
<td class="mdname" nowrap> <em>exp</em> = <code>1</code>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="classPrefix.html">Prefix</a> * </td>
<td class="mdname" nowrap> <em>prefix</em> = <code>NULL</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<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">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">Prefix</a>.</td></tr>
</table>
</dl>
</td>
</tr>
</table>
<a class="anchor" name="a17"></a><!-- doxytag: member=<CompositeUnit::clear> ref=<a17> args=<()> --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">virtual void CompositeUnit::clear </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap><code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Removes all sub/base units. </td>
</tr>
</table>
<a class="anchor" name="a14"></a><!-- doxytag: member=<CompositeUnit::containsRelativeTo> ref=<a14> args=<(Unit *u) const > --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">virtual bool CompositeUnit::containsRelativeTo </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top"><a class="el" href="classUnit.html">Unit</a> * </td>
<td class="mdname1" valign="top" nowrap> <em>u</em> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
If this unit contains a sub/base unit with a relation to the specified unit. </td>
</tr>
</table>
<a class="anchor" name="a9"></a><!-- doxytag: member=<CompositeUnit::countUnits> ref=<a9> args=<() const > --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">virtual size_t CompositeUnit::countUnits </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Returns the number of sub/base units </td>
</tr>
</table>
<a class="anchor" name="a15"></a><!-- doxytag: member=<CompositeUnit::generateMathStructure> ref=<a15> args=<(bool make_division=false) const > --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">virtual <a class="el" href="classMathStructure.html">MathStructure</a> CompositeUnit::generateMathStructure </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">bool </td>
<td class="mdname1" valign="top" nowrap> <em>make_division</em> = <code>false</code> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Creates a <a class="el" href="classMathStructure.html">MathStructure</a> with the sub/base units of the unit. </td>
</tr>
</table>
<a class="anchor" name="a6"></a><!-- doxytag: member=<CompositeUnit::get> ref=<a6> args=<(size_t index, int *exp=NULL, Prefix **prefix=NULL) const > --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">virtual <a class="el" href="classUnit.html">Unit</a>* CompositeUnit::get </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">size_t </td>
<td class="mdname" nowrap> <em>index</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>int * </td>
<td class="mdname" nowrap> <em>exp</em> = <code>NULL</code>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="classPrefix.html">Prefix</a> ** </td>
<td class="mdname" nowrap> <em>prefix</em> = <code>NULL</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"> const<code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<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">Prefix</a>. </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>Sub/base unit (AliasUnit_Composite::firstBaseUnit()).</dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="a12"></a><!-- doxytag: member=<CompositeUnit::print> ref=<a12> 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 > --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">virtual string CompositeUnit::print </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">bool </td>
<td class="mdname" nowrap> <em>plural_</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>bool </td>
<td class="mdname" nowrap> <em>short_</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>bool </td>
<td class="mdname" nowrap> <em>use_unicode</em> = <code>false</code>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>bool(*)(const char *, void *) </td>
<td class="mdname" nowrap> <em>can_display_unicode_string_function</em> = <code>NULL</code>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>void * </td>
<td class="mdname" nowrap> <em>can_display_unicode_string_arg</em> = <code>NULL</code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">) </td>
<td class="md" colspan="2"> const<code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<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#a11">Unit</a>. </td>
</tr>
</table>
<a class="anchor" name="a13"></a><!-- doxytag: member=<CompositeUnit::subtype> ref=<a13> args=<() const > --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">virtual int CompositeUnit::subtype </td>
<td class="md" valign="top">( </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap> const<code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Returns the subtype of the unit, corresponding to which subsubclass the object belongs to.<p>
<dl compact><dt><b>Returns:</b></dt><dd><a class="el" href="Unit_8h.html#a3">UnitSubtype</a>.</dd></dl>
<p>
Reimplemented from <a class="el" href="classUnit.html#a25">Unit</a>. </td>
</tr>
</table>
<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>
<hr size="1"><address style="align: right;"><small>
Generated on 17 Jun 2007 for libqalculate-0.9.6 by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.3</small></address>
</body>
</html>
|