Overview
Comment: | Get rid of OFComparable and make it part of OFObject. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d9308adc2b0a3e40be28b2f0905b1303 |
User & Date: | js on 2009-02-15 16:40:43 |
Other Links: | manifest | tags |
Context
2009-02-27
| ||
11:17 | Add - hash for OFArray and OFString, main implementation in OFMacros. check-in: ffd26c8238 user: js tags: trunk | |
2009-02-15
| ||
16:40 | Get rid of OFComparable and make it part of OFObject. check-in: d9308adc2b user: js tags: trunk | |
2009-02-14
| ||
20:15 | Add intmax_t and uintmax_t to OFNumber. check-in: db131a629c user: js tags: trunk | |
Changes
Modified src/Makefile from [7edab9c3de] to [97d6293a2a].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - | OFString.m \ OFTCPSocket.m \ OFXMLFactory.m \ ${ASPRINTF} INCLUDESTMP = ${SRCS:.c=.h} INCLUDES = ${INCLUDESTMP:.m=.h} \ |
︙ |
Modified src/OFArray.h from [0a9cee9129] to [9a5683be2a].
1 2 3 4 5 6 7 8 9 10 11 12 | 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 | - - + | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFObject.h" |
︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 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 | + + + + + + + + + + + + + + + + | - (size_t)itemsize; /** * \return All elements of the OFArray */ - (void*)data; /** * Clones the OFArray, creating a new one. * * \return A new autoreleased copy of the OFArray */ - (id)copy; /** * Compares the OFArray to another object. * * \param obj An object to compare with * \return An integer which is the result of the comparison, see for example * strcmp */ - (int)compare: (id)obj; /** * Returns a specific item of the OFArray. * * \param item The number of the item to return * \return The specified item of the OFArray */ - (void*)item: (size_t)item; |
︙ | |||
95 96 97 98 99 100 101 | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | - - - - - - - | /** * Removes a specified amount of the last items from the OFArray. * * \param nitems The number of items to remove */ - removeNItems: (size_t)nitems; |
Deleted src/OFComparable.h version [3f1a71329b].
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
Modified src/OFNumber.m from [5e2a173a69] to [9764239f2d].
︙ | |||
572 573 574 575 576 577 578 579 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | RETURN_AS(double) } - (long double)asLongDouble { RETURN_AS(long double) } - (BOOL)isEqual: (id)obj { if (![obj isKindOf: [OFNumber class]]) return NO; switch (type) { case OF_NUMBER_CHAR: case OF_NUMBER_SHORT: case OF_NUMBER_INT: case OF_NUMBER_LONG: case OF_NUMBER_INT8: case OF_NUMBER_INT16: case OF_NUMBER_INT32: case OF_NUMBER_INT64: case OF_NUMBER_INTMAX: case OF_NUMBER_PTRDIFF: return ([obj asIntMax] == [self asIntMax] ? YES : NO); case OF_NUMBER_SSIZE: case OF_NUMBER_UCHAR: case OF_NUMBER_USHORT: case OF_NUMBER_UINT: case OF_NUMBER_ULONG: case OF_NUMBER_UINT8: case OF_NUMBER_UINT16: case OF_NUMBER_UINT32: case OF_NUMBER_UINT64: case OF_NUMBER_SIZE: case OF_NUMBER_UINTMAX: case OF_NUMBER_INTPTR: return ([obj asUIntMax] == [self asUIntMax] ? YES : NO); case OF_NUMBER_FLOAT: case OF_NUMBER_DOUBLE: case OF_NUMBER_LONG_DOUBLE: return ([obj asLongDouble] == [self asLongDouble] ? YES : NO); default: @throw [OFInvalidArgumentException newWithClass: [self class] andSelector: _cmd]; } } @end |
Modified src/OFObject.h from [2370690927] to [25e68717c7].
︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + | - autorelease; /** * \return The retain count */ - (size_t)retainCount; /** * Frees the object and also frees all memory allocated via its memory pool. */ - free; /** * Compare two objects. * Classes containing data (like strings, arrays, lists etc.) should reimplement * this! * * \param obj The object which is tested for equality * \return A boolean whether the object is equal to the other object */ - (BOOL)isEqual: (id)obj; /** * Calculate a hash for the object. * Classes containing data (like strings, arrays, lists etc.) should reimplement * this! * * \return A 24 bit hash for the object */ - (uint32_t)hash; /** * Adds a pointer to the memory pool. * This is useful to add memory allocated by functions such as asprintf to the * pool so it gets freed automatically when the object is freed. * * \param ptr A pointer to add to the memory pool */ |
︙ | |||
105 106 107 108 109 110 111 | 129 130 131 132 133 134 135 136 | - - - - - | /** * Frees allocated memory and removes it from the memory pool. * * \param ptr A pointer to the allocated memory */ - freeMem: (void*)ptr; |
Modified src/OFObject.m from [9d1bddfff6] to [091b00dab8].
︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 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 | + + + + + + + + + + + + | return self; } - (size_t)retainCount { return __retain_count; } - (BOOL)isEqual: (id)obj { /* Classes containing data should reimplement this! */ return (self == obj ? YES : NO); } - (uint32_t)hash { /* Classes containing data should reimplement this! */ return (uint32_t)self & 0xFFFFFF; } - addToMemoryPool: (void*)ptr { void **memchunks; size_t memchunks_size; memchunks_size = __memchunks_size + 1; |
︙ |
Modified src/OFString.h from [eac68d8a40] to [6da443a86b].
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | - - + | * the packaging of this file. */ #include <stdio.h> #include <stdarg.h> #import "OFObject.h" |
︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | + + + + + + + + + | /** * Clones the OFString, creating a new one. * * \return A new autoreleased copy of the OFString */ - (id)copy; /** * Compares the OFString to another object. * * \param obj An object to compare with * \return An integer which is the result of the comparison, see for example * strcmp */ - (int)compare: (id)obj; /** * Sets the OFString to the specified OFString. * * \param str An OFString to set the OFString to. */ - setTo: (const char*)str; |
︙ |