/usr/share/gtk-doc/html/libinstpatch/libinstpatch-IpatchUnit.html is in libinstpatch-doc 1.0.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>IpatchUnit</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.1">
<link rel="home" href="index.html" title="libinstpatch Reference Manual">
<link rel="up" href="ch02.html" title="Utility objects and functions">
<link rel="prev" href="IpatchPaste.html" title="IpatchPaste">
<link rel="next" href="libinstpatch-IpatchUnit-generic.html" title="IpatchUnit_generic">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="ch01.html" title="Base objects and functions">
<link rel="chapter" href="ch02.html" title="Utility objects and functions">
<link rel="chapter" href="ch03.html" title="Sample data objects and functions">
<link rel="chapter" href="ch04.html" title="DLS patches">
<link rel="chapter" href="ch05.html" title="SoundFont patches">
<link rel="chapter" href="ch06.html" title="GigaSampler patches">
<link rel="chapter" href="ch07.html" title="Virtual banks">
<link rel="chapter" href="object-tree.html" title="Object Hierarchy">
<link rel="index" href="api-index-full.html" title="API Index">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="IpatchPaste.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">libinstpatch Reference Manual</th>
<td><a accesskey="n" href="libinstpatch-IpatchUnit-generic.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libinstpatch-IpatchUnit.synopsis" class="shortcut">Top</a>
|
<a href="#libinstpatch-IpatchUnit.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" title="IpatchUnit">
<a name="libinstpatch-IpatchUnit"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libinstpatch-IpatchUnit.top_of_page"></a>IpatchUnit</span></h2>
<p>IpatchUnit — Unit conversion system</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1" title="Stability Level">
<a name="libinstpatch-IpatchUnit.stability-level"></a><h2>Stability Level</h2>
Stable, unless otherwise indicated
</div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="libinstpatch-IpatchUnit.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a>;
enum <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitFlags"
>IpatchUnitFlags</a>;
void (<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchValueTransform"
>*IpatchValueTransform</a>) (const <a
href="http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#GValue"
>GValue</a> *src,
<a
href="http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#GValue"
>GValue</a> *dest);
enum <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitType"
>IpatchUnitType</a>;
#define <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IPATCH-UNIT-TYPE-FIRST-DYNAMIC-ID--CAPS"
>IPATCH_UNIT_TYPE_FIRST_DYNAMIC_ID</a>
enum <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitClassType"
>IpatchUnitClassType</a>;
<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> * <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-info-new"
>ipatch_unit_info_new</a> (void);
void <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-info-free"
>ipatch_unit_info_free</a> (<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> *info);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-register"
>ipatch_unit_register</a> (const <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> *info);
<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> * <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-lookup"
>ipatch_unit_lookup</a> (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> id);
<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> * <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-lookup-by-name"
>ipatch_unit_lookup_by_name</a> (const char *name);
void <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-class-register-map"
>ipatch_unit_class_register_map</a> (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> class_type,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> dest_units);
<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> * <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-class-lookup-map"
>ipatch_unit_class_lookup_map</a> (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> class_type,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units);
void <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-conversion-register"
>ipatch_unit_conversion_register</a> (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> dest_units,
<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchValueTransform"
>IpatchValueTransform</a> func);
<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchValueTransform"
>IpatchValueTransform</a> <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-conversion-lookup"
>ipatch_unit_conversion_lookup</a> (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> dest_units,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> *set);
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-convert"
>ipatch_unit_convert</a> (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> dest_units,
const <a
href="http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#GValue"
>GValue</a> *src_val,
<a
href="http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#GValue"
>GValue</a> *dest_val);
double <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-user-class-convert"
>ipatch_unit_user_class_convert</a> (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units,
const <a
href="http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#GValue"
>GValue</a> *src_val);
</pre>
</div>
<div class="refsect1" title="Description">
<a name="libinstpatch-IpatchUnit.description"></a><h2>Description</h2>
<p>
System for registering unit types and conversion functions.</p>
</div>
<div class="refsect1" title="Details">
<a name="libinstpatch-IpatchUnit.details"></a><h2>Details</h2>
<div class="refsect2" title="IpatchUnitInfo">
<a name="IpatchUnitInfo"></a><h3>IpatchUnitInfo</h3>
<pre class="programlisting">typedef struct {
guint16 id; /* unit type ID */
guint8 digits; /* significant digits to display to user */
guint8 flags; /* IpatchUnitFlags */
GType value_type; /* unit value type */
char *name; /* name identifier (constant) */
char *label; /* unit label (translated) */
char *descr; /* unit description (translated) */
} IpatchUnitInfo;
</pre>
</div>
<hr>
<div class="refsect2" title="enum IpatchUnitFlags">
<a name="IpatchUnitFlags"></a><h3>enum IpatchUnitFlags</h3>
<pre class="programlisting">typedef enum
{
IPATCH_UNIT_LOGARITHMIC = 1 << 0, /* unit is logarithmic */
IPATCH_UNIT_USER = 1 << 1 /* a user friendly unit type */
} IpatchUnitFlags;
</pre>
</div>
<hr>
<div class="refsect2" title="IpatchValueTransform ()">
<a name="IpatchValueTransform"></a><h3>IpatchValueTransform ()</h3>
<pre class="programlisting">void (*IpatchValueTransform) (const <a
href="http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#GValue"
>GValue</a> *src,
<a
href="http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#GValue"
>GValue</a> *dest);</pre>
<p>
Transform from one value to another. The <em class="parameter"><code>src</code></em> and <em class="parameter"><code>dest</code></em> values have
already been initialized to specific types and the transform function
should convert/process them as necessary.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src</code></em> :</span></p></td>
<td> Source value to transform from
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest</code></em> :</span></p></td>
<td> Destination value to transform to
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enum IpatchUnitType">
<a name="IpatchUnitType"></a><h3>enum IpatchUnitType</h3>
<pre class="programlisting">typedef enum
{
IPATCH_UNIT_TYPE_NONE = 0, /* a NULL value */
IPATCH_UNIT_TYPE_INT = 1,
IPATCH_UNIT_TYPE_UINT = 2,
IPATCH_UNIT_TYPE_RANGE = 3,
IPATCH_UNIT_TYPE_DECIBELS = 4,
IPATCH_UNIT_TYPE_PERCENT = 5,
IPATCH_UNIT_TYPE_SEMITONES = 6,
IPATCH_UNIT_TYPE_CENTS = 7,
IPATCH_UNIT_TYPE_TIME_CENTS = 8,
IPATCH_UNIT_TYPE_SAMPLE_RATE = 9,
IPATCH_UNIT_TYPE_SAMPLES = 10,
IPATCH_UNIT_TYPE_HERTZ = 11,
IPATCH_UNIT_TYPE_SECONDS = 12,
IPATCH_UNIT_TYPE_MULTIPLIER = 13,
/* 128 - 159 reserved for IpatchUnit_DLS.h */
IPATCH_UNIT_TYPE_DLS_GAIN = 128,
IPATCH_UNIT_TYPE_DLS_ABS_TIME = 129,
IPATCH_UNIT_TYPE_DLS_REL_TIME = 130,
IPATCH_UNIT_TYPE_DLS_ABS_PITCH = 131,
IPATCH_UNIT_TYPE_DLS_REL_PITCH = 132,
IPATCH_UNIT_TYPE_DLS_PERCENT = 133,
/* 160 - 169 reserved for IpatchUnit_SF2.h */
IPATCH_UNIT_TYPE_SF2_ABS_PITCH = 160,
IPATCH_UNIT_TYPE_SF2_OFS_PITCH = 161,
IPATCH_UNIT_TYPE_SF2_ABS_TIME = 162,
IPATCH_UNIT_TYPE_SF2_OFS_TIME = 163,
IPATCH_UNIT_TYPE_CENTIBELS = 164,
IPATCH_UNIT_TYPE_32K_SAMPLES = 165,
IPATCH_UNIT_TYPE_TENTH_PERCENT = 166
} IpatchUnitType;
</pre>
</div>
<hr>
<div class="refsect2" title="IPATCH_UNIT_TYPE_FIRST_DYNAMIC_ID">
<a name="IPATCH-UNIT-TYPE-FIRST-DYNAMIC-ID--CAPS"></a><h3>IPATCH_UNIT_TYPE_FIRST_DYNAMIC_ID</h3>
<pre class="programlisting">#define IPATCH_UNIT_TYPE_FIRST_DYNAMIC_ID 1024
</pre>
</div>
<hr>
<div class="refsect2" title="enum IpatchUnitClassType">
<a name="IpatchUnitClassType"></a><h3>enum IpatchUnitClassType</h3>
<pre class="programlisting">typedef enum
{
IPATCH_UNIT_CLASS_NONE, /* a NULL value */
IPATCH_UNIT_CLASS_USER, /* "user" conversion class (for humans) */
IPATCH_UNIT_CLASS_DLS, /* DLS (native patch type) class */
IPATCH_UNIT_CLASS_COUNT /* NOT A VALID CLASS - count of classes */
} IpatchUnitClassType;
</pre>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_info_new ()">
<a name="ipatch-unit-info-new"></a><h3>ipatch_unit_info_new ()</h3>
<pre class="programlisting"><a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> * ipatch_unit_info_new (void);</pre>
<p>
Allocate a unit info structure for registering unit types with
<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-register"
><code class="function">ipatch_unit_register()</code></a>. Using this function should minimize API changes
if additional fields are added to <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
><span class="type">IpatchUnitInfo</span></a>. Free the returned
structure with <code class="function">ipatch_unit_free()</code> when finished registering unit types.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The newly allocated unit info structure.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_info_free ()">
<a name="ipatch-unit-info-free"></a><h3>ipatch_unit_info_free ()</h3>
<pre class="programlisting">void ipatch_unit_info_free (<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> *info);</pre>
<p>
Free a unit info structure that was created with <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-info-new"
><code class="function">ipatch_unit_info_new()</code></a>.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>info</code></em> :</span></p></td>
<td> Unit info to free
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_register ()">
<a name="ipatch-unit-register"></a><h3>ipatch_unit_register ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> ipatch_unit_register (const <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> *info);</pre>
<p>
Add a new unit type to the unit registry. Note that the <em class="parameter"><code>info</code></em> structure
is shallow copied, so strings should be constant or guaranteed to not
be freed. If the <em class="structfield"><code>id</code></em> field is already set
(non-zero) in <em class="parameter"><code>info</code></em>, then it is used (should be 0 for dynamic unit
types). If the <em class="structfield"><code>label</code></em> field of the <em class="parameter"><code>info</code></em>
structure is <code class="literal">NULL</code> then it is set to the i18n translated string for
<em class="structfield"><code>name</code></em>. Unit types can not be un-registered.
Unit IDs of dynamic (non built-in types) should not be relied apon to
always be the same between program executions.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>info</code></em> :</span></p></td>
<td> Unit info (shallow copied)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> New unit ID
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_lookup ()">
<a name="ipatch-unit-lookup"></a><h3>ipatch_unit_lookup ()</h3>
<pre class="programlisting"><a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> * ipatch_unit_lookup (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> id);</pre>
<p>
Looks up unit info by ID.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>id</code></em> :</span></p></td>
<td> Unit ID
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Unit info structure with <em class="parameter"><code>id</code></em> or <code class="literal">NULL</code> if not found,
returned structure is internal and should not be modified or freed
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_lookup_by_name ()">
<a name="ipatch-unit-lookup-by-name"></a><h3>ipatch_unit_lookup_by_name ()</h3>
<pre class="programlisting"><a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> * ipatch_unit_lookup_by_name (const char *name);</pre>
<p>
Looks up unit info by name.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
<td> Unit name identifier
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Unit info structure with <em class="parameter"><code>name</code></em> or <code class="literal">NULL</code> if not found,
returned structure is internal and should not be modified or freed
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_class_register_map ()">
<a name="ipatch-unit-class-register-map"></a><h3>ipatch_unit_class_register_map ()</h3>
<pre class="programlisting">void ipatch_unit_class_register_map (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> class_type,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> dest_units);</pre>
<p>
Register a unit class mapping. Unit class types define domains of
conversion, an example is the "user" unit class
(<span class="type">IPATCH_UNIT_CLASS_USER</span>) which is used to convert values to units
digestable by a human. A conversion class is essentially a mapping
between unit types, which can then be used to lookup conversion
functions.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>class_type</code></em> :</span></p></td>
<td> Class type (see <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitClassType"
><span class="type">IpatchUnitClassType</span></a>)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_units</code></em> :</span></p></td>
<td> Source unit type of mapping
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_units</code></em> :</span></p></td>
<td> Destination unit type for this map
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_class_lookup_map ()">
<a name="ipatch-unit-class-lookup-map"></a><h3>ipatch_unit_class_lookup_map ()</h3>
<pre class="programlisting"><a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitInfo"
>IpatchUnitInfo</a> * ipatch_unit_class_lookup_map (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> class_type,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units);</pre>
<p>
Lookup a unit class mapping (see <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#ipatch-unit-class-register-map"
><code class="function">ipatch_unit_class_register_map()</code></a>).</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>class_type</code></em> :</span></p></td>
<td> Class type (see <a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchUnitClassType"
><span class="type">IpatchUnitClassType</span></a>)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_units</code></em> :</span></p></td>
<td> Source unit type of mapping to lookup
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Pointer to destination unit info structure, or <code class="literal">NULL</code> if not found.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_conversion_register ()">
<a name="ipatch-unit-conversion-register"></a><h3>ipatch_unit_conversion_register ()</h3>
<pre class="programlisting">void ipatch_unit_conversion_register (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> dest_units,
<a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchValueTransform"
>IpatchValueTransform</a> func);</pre>
<p>
Register a parameter unit conversion function.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_units</code></em> :</span></p></td>
<td> Source unit type
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_units</code></em> :</span></p></td>
<td> Destination unit type
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td>
<td> Conversion function handler or <code class="literal">NULL</code> for unity conversion (the
value type will be converted but not the actual value, example:
float -> int).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_conversion_lookup ()">
<a name="ipatch-unit-conversion-lookup"></a><h3>ipatch_unit_conversion_lookup ()</h3>
<pre class="programlisting"><a
href="../libinstpatch/libinstpatch-IpatchUnit.html#IpatchValueTransform"
>IpatchValueTransform</a> ipatch_unit_conversion_lookup (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> dest_units,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> *set);</pre>
<p>
Lookup a conversion function by source and destination unit types.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_units</code></em> :</span></p></td>
<td> Source unit type
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_units</code></em> :</span></p></td>
<td> Destination unit type
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>set</code></em> :</span></p></td>
<td> Location to store a boolean value indicating if the conversion is
set, to differentiate between a <code class="literal">NULL</code> conversion function and an invalid
conversion. Can be <code class="literal">NULL</code> in which case this parameter is ignored.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Conversion function pointer or <code class="literal">NULL</code> if a unity conversion or
no matching handlers (use <em class="parameter"><code>set</code></em> to determine which).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_convert ()">
<a name="ipatch-unit-convert"></a><h3>ipatch_unit_convert ()</h3>
<pre class="programlisting"><a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"
>gboolean</a> ipatch_unit_convert (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units,
<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> dest_units,
const <a
href="http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#GValue"
>GValue</a> *src_val,
<a
href="http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#GValue"
>GValue</a> *dest_val);</pre>
<p>
Convert a value from one unit type to another.</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_units</code></em> :</span></p></td>
<td> Source unit type ID
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_units</code></em> :</span></p></td>
<td> Destination unit type ID
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_val</code></em> :</span></p></td>
<td> Source value (type should be compatible with the source unit's
value type)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dest_val</code></em> :</span></p></td>
<td> Destination value (value should be initialized to a type that is
compatible with the destination unit's value type)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <code class="literal">TRUE</code> if value was successfully converted, <code class="literal">FALSE</code>
otherwise (the only reasons for failure are invalid function
parameters, no conversion function for the given unit types, or
incompatible GValue types in conversion, therefore the return value
can be safely ignored if the caller is sure the parameters and
types are OK).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="ipatch_unit_user_class_convert ()">
<a name="ipatch-unit-user-class-convert"></a><h3>ipatch_unit_user_class_convert ()</h3>
<pre class="programlisting">double ipatch_unit_user_class_convert (<a
href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint16"
>guint16</a> src_units,
const <a
href="http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#GValue"
>GValue</a> *src_val);</pre>
<p>
Converts a value to "user" units. User units are unit types that
are adequate for human consumption. The <span class="type">IPATCH_UNIT_CLASS_USER</span>
map is used to lookup the corresponding user type to convert to.
Not all unit types have an associated user type or the <em class="parameter"><code>src_units</code></em>
type can itself be a user type; in either of these cases the
<em class="parameter"><code>src_val</code></em> is converted as is (possibly converted from another value
type to double).</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_units</code></em> :</span></p></td>
<td> Source unit type ID
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>src_val</code></em> :</span></p></td>
<td> Source value (type should be compatible with the source unit's
value type)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The value converted to user units.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.11</div>
</body>
</html>
|