Differences From Artifact [698abcee0b]:
- File
src/OFObject.h
— part of check-in
[96e0a91a06]
at
2022-09-24 15:32:52
on branch trunk
— Do not document exceptions that are obvious
Otherwise every second method would need to have
OFInvalidArgumentException documented. (user: js, size: 40734) [annotate] [blame] [check-ins using] [more...]
To Artifact [f6921949eb]:
- File src/OFObject.h — part of check-in [26ddd2e4e4] at 2024-01-02 17:17:25 on branch trunk — Update copyright (user: js, size: 43115) [annotate] [blame] [check-ins using] [more...]
1 | 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 | - + - - - - + | /* |
| ︙ | |||
59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 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 | + + + + + + + + + + + |
OFOrderedAscending = -1,
/** Both objects are equal */
OFOrderedSame = 0,
/** The left object is bigger than the right */
OFOrderedDescending = 1
} OFComparisonResult;
/**
* @brief A function to compare two objects.
*
* @param left The left object
* @param right The right object
* @param context Context passed along for comparing
* @return The order of the objects
*/
typedef OFComparisonResult (*OFCompareFunction)(id _Nonnull left,
id _Nonnull right, void *_Nullable context);
#ifdef OF_HAVE_BLOCKS
/**
* @brief A comparator to compare two objects.
*
* @param left The left object
* @param right The right object
* @return The order of the objects
|
| ︙ | |||
91 92 93 94 95 96 97 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | - + | } OFByteOrder; /** * @struct OFRange OFObject.h ObjFW/OFObject.h * * @brief A range. */ |
| ︙ | |||
140 141 142 143 144 145 146 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | - + - + | * @brief A time interval in seconds. */ typedef double OFTimeInterval; /** * @struct OFPoint OFObject.h ObjFW/OFObject.h * |
| ︙ | |||
188 189 190 191 192 193 194 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | - + | } /** * @struct OFSize OFObject.h ObjFW/OFObject.h * * @brief A size. */ |
| ︙ | |||
234 235 236 237 238 239 240 | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | - + | } /** * @struct OFRect OFObject.h ObjFW/OFObject.h * * @brief A rectangle. */ |
| ︙ | |||
277 278 279 280 281 282 283 284 285 286 287 288 289 290 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
{
if (!OFEqualPoints(rect1.origin, rect2.origin))
return false;
if (!OFEqualSizes(rect1.size, rect2.size))
return false;
return true;
}
/**
* @struct OFVector3D OFObject.h ObjFW/OFObject.h
*
* @brief A vector in 3D space.
*/
typedef struct OF_BOXABLE OFVector3D {
/** The x coordinate of the vector */
float x;
/** The y coordinate of the vector */
float y;
/** The z coordinate of the vector */
float z;
} OFVector3D;
/**
* @brief Creates a new OFVector3D.
*
* @param x The x coordinate of the vector
* @param y The x coordinate of the vector
* @param z The z coordinate of the vector
* @return An OFVector3D with the specified coordinates
*/
static OF_INLINE OFVector3D OF_CONST_FUNC
OFMakeVector3D(float x, float y, float z)
{
OFVector3D vector = { x, y, z };
return vector;
}
/**
* @brief Returns whether the two vectors are equal.
*
* @param vector1 The first vector for the comparison
* @param vector2 The second vectors for the comparison
* @return Whether the two vectors are equal
*/
static OF_INLINE bool
OFEqualVectors3D(OFVector3D vector1, OFVector3D vector2)
{
if (vector1.x != vector2.x)
return false;
if (vector1.y != vector2.y)
return false;
if (vector1.z != vector2.z)
return false;
return true;
}
/**
* @struct OFVector4D OFObject.h ObjFW/OFObject.h
*
* @brief A vector in 4D space.
*/
typedef struct OF_ALIGN(16) OF_BOXABLE OFVector4D {
/** The x coordinate of the vector */
float x;
/** The y coordinate of the vector */
float y;
/** The z coordinate of the vector */
float z;
/** The w coordinate of the vector */
float w;
} OFVector4D;
/**
* @brief Creates a new OFVector4D.
*
* @param x The x coordinate of the vector
* @param y The x coordinate of the vector
* @param z The z coordinate of the vector
* @param w The w coordinate of the vector
* @return An OFVector4D with the specified coordinates
*/
static OF_INLINE OFVector4D OF_CONST_FUNC
OFMakeVector4D(float x, float y, float z, float w)
{
OFVector4D vector = { x, y, z, w };
return vector;
}
/**
* @brief Returns whether the two vectors are equal.
*
* @param vector1 The first vector for the comparison
* @param vector2 The second vectors for the comparison
* @return Whether the two vectors are equal
*/
static OF_INLINE bool
OFEqualVectors4D(OFVector4D vector1, OFVector4D vector2)
{
if (vector1.x != vector2.x)
return false;
if (vector1.y != vector2.y)
return false;
if (vector1.z != vector2.z)
return false;
if (vector1.w != vector2.w)
return false;
return true;
}
/**
* @brief Adds the specified byte to the hash.
*
* @param hash A pointer to a hash to add the byte to
|
| ︙ | |||
332 333 334 335 336 337 338 | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | - | tmp += tmp << 15; *hash = tmp; } static const size_t OFNotFound = SIZE_MAX; |
| ︙ | |||
555 556 557 558 559 560 561 | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | - - - + - + - + - - + + - + - + - + - + - + | /** * @brief Retain a weak reference to this object. * * @return Whether a weak reference to this object has been retained */ - (bool)retainWeakReference; @end |
| ︙ | |||
655 656 657 658 659 660 661 | 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | - - - - - - - | * @return The allocated object * @throw OFAllocFailedException There was not enough memory to allocate the * object * @throw OFInitializationFailedException The instance could not be constructed */ + (instancetype)alloc; |
| ︙ | |||
940 941 942 943 944 945 946 | 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | - + | - (void)performSelector: (SEL)selector withObject: (nullable id)object1 withObject: (nullable id)object2 withObject: (nullable id)object3 withObject: (nullable id)object4 afterDelay: (OFTimeInterval)delay; |
| ︙ | |||
1198 1199 1200 1201 1202 1203 1204 | 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 | - + | - (void)performSelector: (SEL)selector onThread: (OFThread *)thread withObject: (nullable id)object1 withObject: (nullable id)object2 withObject: (nullable id)object3 withObject: (nullable id)object4 afterDelay: (OFTimeInterval)delay; |
| ︙ | |||
1224 1225 1226 1227 1228 1229 1230 | 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 | - - - - | * returns! * * @param selector The selector not understood by the receiver * @throw OFNotImplementedException */ - (void)doesNotRecognizeSelector: (SEL)selector OF_NO_RETURN; @end |
| ︙ | |||
1280 1281 1282 1283 1284 1285 1286 | 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 | - | * @brief Compares the object to another object. * * @param object An object to compare the object to * @return The result of the comparison */ - (OFComparisonResult)compare: (id <OFComparing>)object; @end |
| ︙ | |||
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 | + + + + + + + - - - - - - - - + - - - + - - - - |
extern void *_Nullable objc_destructInstance(id _Nullable object);
# endif
#endif
extern id OFAllocObject(Class class_, size_t extraSize, size_t extraAlignment,
void *_Nullable *_Nullable extra);
extern void OF_NO_RETURN_FUNC OFMethodNotFound(id self, SEL _cmd);
/**
* @brief Initializes the specified hash.
*
* @param hash A pointer to the hash to initialize
*/
extern void OFHashInit(unsigned long *_Nonnull hash);
/**
* @brief Returns 16 bit or non-cryptographical randomness.
*
* @return 16 bit or non-cryptographical randomness
*/
extern uint16_t OFRandom16(void);
/**
* @brief Returns 32 bit or non-cryptographical randomness.
*
* @return 32 bit or non-cryptographical randomness
*/
extern uint32_t OFRandom32(void);
/**
* @brief Returns 64 bit or non-cryptographical randomness.
*
* @return 64 bit or non-cryptographical randomness
*/
extern uint64_t OFRandom64(void);
|