| 1 |
<html><head> |
|---|
| 2 |
<META http-equiv="content-type" content="text/html; charset=utf-8"> |
|---|
| 3 |
<title>tango.scrapple.util.uuid.Uuid</title> |
|---|
| 4 |
</head><body> |
|---|
| 5 |
<h1>tango.scrapple.util.uuid.Uuid</h1> |
|---|
| 6 |
<!-- Generated by Ddoc from Uuid.d --> |
|---|
| 7 |
<b>License:</b><br> |
|---|
| 8 |
BSD style: |
|---|
| 9 |
|
|---|
| 10 |
<br><br> |
|---|
| 11 |
<b>Authors:</b><br> |
|---|
| 12 |
Max Samukha |
|---|
| 13 |
<br><br> |
|---|
| 14 |
|
|---|
| 15 |
This module defines a 128-bit Universally Unique Identifier structure |
|---|
| 16 |
conforming to Proposed Stardard RFC-4122. |
|---|
| 17 |
|
|---|
| 18 |
<br><br> |
|---|
| 19 |
<b>Examples:</b><br> |
|---|
| 20 |
<pre class="d_code"><u>Uuid</u> uuid = <font color=red>"24bb3c5e-988b-4833-9d9a-77bf84b3284c"</font>; |
|---|
| 21 |
|
|---|
| 22 |
<font color=blue>auto</font> uuid2 = <u>Uuid</u>(<font color=red>"24bb3c5e-988b-4833-9d9a-77bf84b3284c"</font>); |
|---|
| 23 |
|
|---|
| 24 |
<font color=blue>char</font>[<u>Uuid</u>.StringLength] buf; |
|---|
| 25 |
uuid.toString(buf); |
|---|
| 26 |
|
|---|
| 27 |
Stdout(uuid).newline; |
|---|
| 28 |
|
|---|
| 29 |
<font color=green>// Convert to an array of bytes for sending over a network |
|---|
| 30 |
</font><font color=blue>ubyte</font>[<u>Uuid</u>.StringLength] ubytes; |
|---|
| 31 |
uuid.toOctets(ubytes); |
|---|
| 32 |
</pre> |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
<br><br> |
|---|
| 36 |
|
|---|
| 37 |
<dl><dt><big>enum <u>UuidVariant</u>; |
|---|
| 38 |
</big></dt> |
|---|
| 39 |
<dd>The UUID variants. The UUID variant determines the layout of the UUID. |
|---|
| 40 |
<br><br> |
|---|
| 41 |
|
|---|
| 42 |
<dl><dt><big><u>Ncs</u></big></dt> |
|---|
| 43 |
<dd>Reserved, NCS backward compatibility. |
|---|
| 44 |
<br><br> |
|---|
| 45 |
|
|---|
| 46 |
</dd> |
|---|
| 47 |
<dt><big><u>Standard</u></big></dt> |
|---|
| 48 |
<dd>The UUID is compatible with RFC-4122. |
|---|
| 49 |
<br><br> |
|---|
| 50 |
|
|---|
| 51 |
</dd> |
|---|
| 52 |
<dt><big><u>Microsoft</u></big></dt> |
|---|
| 53 |
<dd>Reserved, Microsoft backward compatibility. |
|---|
| 54 |
<br><br> |
|---|
| 55 |
|
|---|
| 56 |
</dd> |
|---|
| 57 |
<dt><big><u>Future</u></big></dt> |
|---|
| 58 |
<dd>Reserved for future definition. |
|---|
| 59 |
<br><br> |
|---|
| 60 |
|
|---|
| 61 |
</dd> |
|---|
| 62 |
</dl> |
|---|
| 63 |
</dd> |
|---|
| 64 |
<dt><big>enum <u>UuidVersion</u>; |
|---|
| 65 |
</big></dt> |
|---|
| 66 |
<dd>Versions of a standard UUID. |
|---|
| 67 |
<br><br> |
|---|
| 68 |
|
|---|
| 69 |
<dl><dt><big><u>TimeBased</u></big></dt> |
|---|
| 70 |
<dd>The time-based version. |
|---|
| 71 |
<br><br> |
|---|
| 72 |
|
|---|
| 73 |
</dd> |
|---|
| 74 |
<dt><big><u>Dce</u></big></dt> |
|---|
| 75 |
<dd>The DCE security version, with embedded POSIX UIDs. |
|---|
| 76 |
<br><br> |
|---|
| 77 |
|
|---|
| 78 |
</dd> |
|---|
| 79 |
<dt><big><u>NameBasedMd5</u></big></dt> |
|---|
| 80 |
<dd>The name-based version that uses MD5 hashing. |
|---|
| 81 |
<br><br> |
|---|
| 82 |
|
|---|
| 83 |
</dd> |
|---|
| 84 |
<dt><big><u>Random</u></big></dt> |
|---|
| 85 |
<dd>The randomly or pseudo-randomly generated version. |
|---|
| 86 |
<br><br> |
|---|
| 87 |
|
|---|
| 88 |
</dd> |
|---|
| 89 |
<dt><big><u>NameBasedSha1</u></big></dt> |
|---|
| 90 |
<dd>The name-based version specified that uses SHA1 hashing. |
|---|
| 91 |
<br><br> |
|---|
| 92 |
|
|---|
| 93 |
</dd> |
|---|
| 94 |
</dl> |
|---|
| 95 |
</dd> |
|---|
| 96 |
<dt><big>struct <u>Uuid</u>; |
|---|
| 97 |
</big></dt> |
|---|
| 98 |
<dd>The UUID structure. |
|---|
| 99 |
<br><br> |
|---|
| 100 |
|
|---|
| 101 |
<dl><dt><big>uint <u>timeLow</u>; |
|---|
| 102 |
</big></dt> |
|---|
| 103 |
<dd>The low field of the timestamp. |
|---|
| 104 |
<br><br> |
|---|
| 105 |
|
|---|
| 106 |
</dd> |
|---|
| 107 |
<dt><big>ushort <u>timeMid</u>; |
|---|
| 108 |
</big></dt> |
|---|
| 109 |
<dd>The middle field of the timestamp. |
|---|
| 110 |
<br><br> |
|---|
| 111 |
|
|---|
| 112 |
</dd> |
|---|
| 113 |
<dt><big>ushort <u>versionTimeHigh</u>; |
|---|
| 114 |
</big></dt> |
|---|
| 115 |
<dd>The high field of the timestamp multiplexed with the version number. |
|---|
| 116 |
<br><br> |
|---|
| 117 |
|
|---|
| 118 |
</dd> |
|---|
| 119 |
<dt><big>ubyte <u>variantClockSeqHigh</u>; |
|---|
| 120 |
</big></dt> |
|---|
| 121 |
<dd>The high field of the clock sequence multiplexed with the variant. |
|---|
| 122 |
<br><br> |
|---|
| 123 |
|
|---|
| 124 |
</dd> |
|---|
| 125 |
<dt><big>ubyte <u>clockSeqLow</u>; |
|---|
| 126 |
</big></dt> |
|---|
| 127 |
<dd>The low field of the clock sequence. |
|---|
| 128 |
<br><br> |
|---|
| 129 |
|
|---|
| 130 |
</dd> |
|---|
| 131 |
<dt><big>ubyte[6u] <u>node</u>; |
|---|
| 132 |
</big></dt> |
|---|
| 133 |
<dd>The spatially unique <u>node</u> identifier. |
|---|
| 134 |
<br><br> |
|---|
| 135 |
|
|---|
| 136 |
</dd> |
|---|
| 137 |
<dt><big><u>StringLength</u></big></dt> |
|---|
| 138 |
<dd>The length of the string representation of a UUID (36 characters). |
|---|
| 139 |
|
|---|
| 140 |
<br><br> |
|---|
| 141 |
|
|---|
| 142 |
</dd> |
|---|
| 143 |
<dt><big>void <u>swap</u>(); |
|---|
| 144 |
</big></dt> |
|---|
| 145 |
<dd>Changes the byte order of the UUID fields. |
|---|
| 146 |
|
|---|
| 147 |
<br><br> |
|---|
| 148 |
|
|---|
| 149 |
</dd> |
|---|
| 150 |
<dt><big>UuidVariant <u>variant</u>(); |
|---|
| 151 |
</big></dt> |
|---|
| 152 |
<dd>Gets the UUID variant. |
|---|
| 153 |
|
|---|
| 154 |
<br><br> |
|---|
| 155 |
|
|---|
| 156 |
</dd> |
|---|
| 157 |
<dt><big>UuidVariant <u>variant</u>(UuidVariant <i>v</i>); |
|---|
| 158 |
</big></dt> |
|---|
| 159 |
<dd>Sets the UUID variant. |
|---|
| 160 |
<br><br> |
|---|
| 161 |
<b>Params:</b><br> |
|---|
| 162 |
<table><tr><td>UuidVariant <i>v</i></td> |
|---|
| 163 |
<td>UUID variant.</td></tr> |
|---|
| 164 |
</table><br> |
|---|
| 165 |
|
|---|
| 166 |
</dd> |
|---|
| 167 |
<dt><big>UuidVersion <u>ver</u>(); |
|---|
| 168 |
</big></dt> |
|---|
| 169 |
<dd>Gets the UUID version. |
|---|
| 170 |
|
|---|
| 171 |
<br><br> |
|---|
| 172 |
|
|---|
| 173 |
</dd> |
|---|
| 174 |
<dt><big>UuidVersion <u>ver</u>(UuidVersion <i>v</i>); |
|---|
| 175 |
</big></dt> |
|---|
| 176 |
<dd>Sets the UUID version. |
|---|
| 177 |
<br><br> |
|---|
| 178 |
<b>Params:</b><br> |
|---|
| 179 |
<table><tr><td>UuidVersion <i>v</i></td> |
|---|
| 180 |
<td>UUID version.</td></tr> |
|---|
| 181 |
</table><br> |
|---|
| 182 |
|
|---|
| 183 |
</dd> |
|---|
| 184 |
<dt><big>char[] <u>toString</u>(); |
|---|
| 185 |
</big></dt> |
|---|
| 186 |
<dd>Gets the string representation of this UUID. |
|---|
| 187 |
|
|---|
| 188 |
<br><br> |
|---|
| 189 |
|
|---|
| 190 |
</dd> |
|---|
| 191 |
<dt><big>char[] <u>toString</u>(char[] <i>buf</i>); |
|---|
| 192 |
</big></dt> |
|---|
| 193 |
<dd>Fills <i>buf</i> with the string representation of this UUID. If the length of <i>buf</i> is zero, |
|---|
| 194 |
allocates a new buffer. |
|---|
| 195 |
<br><br> |
|---|
| 196 |
<b>Returns:</b><br> |
|---|
| 197 |
The UUID string. |
|---|
| 198 |
|
|---|
| 199 |
<br><br> |
|---|
| 200 |
<b>Params:</b><br> |
|---|
| 201 |
<table><tr><td>char[] <i>buf</i></td> |
|---|
| 202 |
<td>Buffer to recieve the UUID string.</td></tr> |
|---|
| 203 |
</table><br> |
|---|
| 204 |
<b>Throws:</b><br> |
|---|
| 205 |
IllegalArgumentException if the length of the buffer is not zero and |
|---|
| 206 |
is less than 36 characters. |
|---|
| 207 |
|
|---|
| 208 |
<br><br> |
|---|
| 209 |
|
|---|
| 210 |
</dd> |
|---|
| 211 |
<dt><big>char[] <u>toUrn</u>(char[] <i>buf</i> = null); |
|---|
| 212 |
</big></dt> |
|---|
| 213 |
<dd>Gets the URN representation of this UUID. |
|---|
| 214 |
<br><br> |
|---|
| 215 |
<b>Params:</b><br> |
|---|
| 216 |
<table><tr><td>char[] <i>buf</i></td> |
|---|
| 217 |
<td>Buffer to receive the result. If the length of <i>buf</i> is zero, |
|---|
| 218 |
a new buffer is dynamically allocated.</td></tr> |
|---|
| 219 |
</table><br> |
|---|
| 220 |
<b>Returns:</b><br> |
|---|
| 221 |
Reference to the buffer. |
|---|
| 222 |
|
|---|
| 223 |
<br><br> |
|---|
| 224 |
<b>Throws:</b><br> |
|---|
| 225 |
IllegalArgumentException if the length of the supplied buffer is not zero and |
|---|
| 226 |
not big enough for the URN (45 chars). |
|---|
| 227 |
|
|---|
| 228 |
<br><br> |
|---|
| 229 |
|
|---|
| 230 |
</dd> |
|---|
| 231 |
<dt><big>ubyte[] <u>toOctets</u>(ubyte[] <i>octets</i> = null); |
|---|
| 232 |
</big></dt> |
|---|
| 233 |
<dd>Fills the supplied buffer with the UUID octets arranged in network order. A new array is |
|---|
| 234 |
created if the length of the buffer is zero. |
|---|
| 235 |
<br><br> |
|---|
| 236 |
<b>Params:</b><br> |
|---|
| 237 |
<table><tr><td>ubyte[] <i>octets</i></td> |
|---|
| 238 |
<td>Buffer to recieve the result,</td></tr> |
|---|
| 239 |
</table><br> |
|---|
| 240 |
<b>Returns:</b><br> |
|---|
| 241 |
Reference to the array. |
|---|
| 242 |
|
|---|
| 243 |
<br><br> |
|---|
| 244 |
<b>Throws:</b><br> |
|---|
| 245 |
IllegalArgumentException if the length of the supplied array is not zero and not big enough |
|---|
| 246 |
for the UUID octets (16 bytes). |
|---|
| 247 |
|
|---|
| 248 |
<br><br> |
|---|
| 249 |
|
|---|
| 250 |
</dd> |
|---|
| 251 |
<dt><big>Uuid <u>opAssign</u>(char[] <i>str</i>); |
|---|
| 252 |
</big></dt> |
|---|
| 253 |
<dd>Parses the UUID string and assigns the result to this UUID. |
|---|
| 254 |
<br><br> |
|---|
| 255 |
<b>Params:</b><br> |
|---|
| 256 |
<table><tr><td>char[] <i>str</i></td> |
|---|
| 257 |
<td>UUID string.</td></tr> |
|---|
| 258 |
</table><br> |
|---|
| 259 |
<b>Examples:</b><br> |
|---|
| 260 |
<pre class="d_code">Uuid uuid; |
|---|
| 261 |
uuid = <font color=red>"24bb3c5e-988b-4833-9d9a-77bf84b3284c"</font>; |
|---|
| 262 |
</pre> |
|---|
| 263 |
|
|---|
| 264 |
<br><br> |
|---|
| 265 |
|
|---|
| 266 |
</dd> |
|---|
| 267 |
<dt><big>Uuid <u>opAssign</u>(ubyte[] <i>octets</i>); |
|---|
| 268 |
</big></dt> |
|---|
| 269 |
<dd>Assigns the UUID octets arranged in network byte order to this UUID . |
|---|
| 270 |
<br><br> |
|---|
| 271 |
<b>Params:</b><br> |
|---|
| 272 |
<table><tr><td>ubyte[] <i>octets</i></td> |
|---|
| 273 |
<td>UUID octets in network byte order.</td></tr> |
|---|
| 274 |
</table><br> |
|---|
| 275 |
|
|---|
| 276 |
</dd> |
|---|
| 277 |
<dt><big>static Uuid <u>opCall</u>(uint <i>timeLow</i>, ushort <i>timeMid</i>, ushort <i>versionTimeHigh</i>, ubyte <i>variantClockSeqHigh</i>, ubyte <i>clockSeqLow</i>, ubyte[6u] <i>node</i>); |
|---|
| 278 |
</big></dt> |
|---|
| 279 |
<dd>Creates a UUID from UUID field values. |
|---|
| 280 |
|
|---|
| 281 |
<br><br> |
|---|
| 282 |
|
|---|
| 283 |
</dd> |
|---|
| 284 |
<dt><big>static Uuid <u>opCall</u>(char[] <i>str</i>); |
|---|
| 285 |
</big></dt> |
|---|
| 286 |
<dd>Creates a new UUID from the supplied string. |
|---|
| 287 |
<br><br> |
|---|
| 288 |
<b>Throws:</b><br> |
|---|
| 289 |
IllegalArgumentException if the input string is not a valid |
|---|
| 290 |
UUID string. |
|---|
| 291 |
|
|---|
| 292 |
<br><br> |
|---|
| 293 |
|
|---|
| 294 |
</dd> |
|---|
| 295 |
<dt><big>static Uuid <u>opCall</u>(ubyte[] <i>octets</i>); |
|---|
| 296 |
</big></dt> |
|---|
| 297 |
<dd>Creates a UUID from octets arranged in network byte order. |
|---|
| 298 |
This is the reverse of toOctets(). |
|---|
| 299 |
<br><br> |
|---|
| 300 |
<b>Params:</b><br> |
|---|
| 301 |
<table><tr><td>ubyte[] <i>octets</i></td> |
|---|
| 302 |
<td>UUID octets in network byte order.</td></tr> |
|---|
| 303 |
</table><br> |
|---|
| 304 |
<b>Throws:</b><br> |
|---|
| 305 |
IllegalArgumentException if the length of <i>octets</i> is less than 16 bytes. |
|---|
| 306 |
|
|---|
| 307 |
<br><br> |
|---|
| 308 |
|
|---|
| 309 |
</dd> |
|---|
| 310 |
<dt><big>int <u>toHash</u>(); |
|---|
| 311 |
</big></dt> |
|---|
| 312 |
<dd>Returns the hash code of this UUID. |
|---|
| 313 |
|
|---|
| 314 |
<br><br> |
|---|
| 315 |
|
|---|
| 316 |
</dd> |
|---|
| 317 |
<dt><big>int <u>opCmp</u>(Uuid <i>uuid</i>); |
|---|
| 318 |
</big></dt> |
|---|
| 319 |
<dd>Compares this UUID with <i>uuid</i>. |
|---|
| 320 |
|
|---|
| 321 |
<br><br> |
|---|
| 322 |
|
|---|
| 323 |
</dd> |
|---|
| 324 |
<dt><big>bool <u>isNil</u>(); |
|---|
| 325 |
</big></dt> |
|---|
| 326 |
<dd>Returns <b>true</b> if all UUID fields are equal to zero. |
|---|
| 327 |
|
|---|
| 328 |
<br><br> |
|---|
| 329 |
|
|---|
| 330 |
</dd> |
|---|
| 331 |
</dl> |
|---|
| 332 |
</dd> |
|---|
| 333 |
</dl> |
|---|
| 334 |
|
|---|
| 335 |
<hr><small>Page generated by <a href="http://www.digitalmars.com/d/1.0/ddoc.html">Ddoc</a>. Copyright (c) 2008 Max Samukha. All rights reserved |
|---|
| 336 |
|
|---|
| 337 |
</small> |
|---|
| 338 |
</body></html> |
|---|