Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -30,5 +30,23 @@ else \ ${DELETE_FAILED}; \ fi \ fi \ done + +tarball: + V=$$(fgrep VERSION= objfw-config.in | sed 's/VERSION="\(.*\)"/\1/'); \ + V2=$$(fgrep AC_INIT configure.ac | \ + sed 's/AC_INIT([^,]*,\([^,]*\),.*/\1/' | sed 's/ //'); \ + if test x"$$V" != x"$$V2"; then \ + echo "objfw-config.h.in and configure.ac version mismatch!"; \ + exit 1; \ + fi; \ + echo "Generating tarball for version $$V..."; \ + rm -f objfw-$$V.tar.gz; \ + rm -fr objfw-$$V; \ + hg archive objfw-$$V; \ + cp configure config.h.in objfw-$$V; \ + cd objfw-$$V && rm -f .hg_archival.txt .hgignore .hgtags && cd ..; \ + tar cf objfw-$$V.tar objfw-$$V; \ + gzip -9 objfw-$$V.tar; \ + rm -fr objfw-$$V Index: generators/TableGenerator.h ================================================================== --- generators/TableGenerator.h +++ generators/TableGenerator.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: generators/TableGenerator.m ================================================================== --- generators/TableGenerator.m +++ generators/TableGenerator.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: generators/copyright.h ================================================================== --- generators/copyright.h +++ generators/copyright.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -11,11 +11,11 @@ #import "OFString.h" #define COPYRIGHT \ @"/*\n" \ - @" * Copyright (c) 2008 - 2009\n" \ + @" * Copyright (c) 2008 - 2010\n" \ @" * Jonathan Schleifer \n" \ @" *\n" \ @" * All rights reserved.\n" \ @" *\n" \ @" * This file is part of ObjFW. It may be distributed under the terms " \ Index: generators/main.m ================================================================== --- generators/main.m +++ generators/main.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -16,11 +16,11 @@ @class OFDataArray; @class OFString; /** - * The OFArray class is a class for storing objects in an array. + * \brief A class for storing objects in an array. */ @interface OFArray: OFObject { OFDataArray *array; } @@ -147,10 +147,11 @@ * \return An OFEnumerator to enumarate through the array's objects */ - (OFEnumerator*)enumerator; @end +/// \cond internal @interface OFArrayEnumerator: OFEnumerator { OFDataArray *array; size_t count; unsigned long mutations; @@ -159,7 +160,8 @@ } - initWithDataArray: (OFDataArray*)data mutationsPointer: (unsigned long*)mutations_ptr; @end +/// \endcond #import "OFMutableArray.h" Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -225,10 +225,12 @@ size_t i, count = [array count]; IMP append; if (count == 0) return @""; + if (count == 1) + return [objs[0] retain]; str = [OFMutableString string]; append = [str methodForSelector: @selector(appendString:)]; for (i = 0; i < count - 1; i++) { @@ -321,10 +323,11 @@ [super dealloc]; } @end +/// \cond internal @implementation OFArrayEnumerator - initWithDataArray: (OFDataArray*)array_ mutationsPointer: (unsigned long*)mutations_ptr_; { self = [super init]; @@ -356,5 +359,6 @@ pos = 0; return self; } @end +/// \endcond Index: src/OFAutoreleasePool.h ================================================================== --- src/OFAutoreleasePool.h +++ src/OFAutoreleasePool.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -12,10 +12,12 @@ #import "OFObject.h" @class OFMutableArray; /** + * \brief A pool that keeps track of objects to release. + * * The OFAutoreleasePool class is a class that keeps track of objects that will * be released when the autorelease pool is released. * * Every thread has its own stack of autorelease pools. */ Index: src/OFAutoreleasePool.m ================================================================== --- src/OFAutoreleasePool.m +++ src/OFAutoreleasePool.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFConstString.h ================================================================== --- src/OFConstString.h +++ src/OFConstString.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -14,9 +14,9 @@ #ifdef OF_APPLE_RUNTIME extern void *_OFConstStringClassReference; #endif /** - * A class for storing constant strings using the @"" literal. + * \brief A class for storing constant strings using the \@"" literal. */ @interface OFConstString: OFString {} @end Index: src/OFConstString.m ================================================================== --- src/OFConstString.m +++ src/OFConstString.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFDataArray.h ================================================================== --- src/OFDataArray.h +++ src/OFDataArray.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -10,11 +10,11 @@ */ #import "OFObject.h" /** - * The OFDataArray class is a class for storing arbitrary data in an array. + * \brief A class for storing arbitrary data in an array. * * If you plan to store large hunks of data, you should consider using * OFBigDataArray, which allocates the memory in pages rather than in bytes. */ @interface OFDataArray: OFObject @@ -141,14 +141,16 @@ - removeNItems: (size_t)nitems atIndex: (size_t)index; @end /** + * \brief A class for storing arbitrary big data in an array. + * * The OFBigDataArray class is a class for storing arbitrary data in an array * and is designed to store large hunks of data. Therefore, it allocates * memory in pages rather than a chunk of memory for each item. */ @interface OFBigDataArray: OFDataArray { size_t size; } @end Index: src/OFDataArray.m ================================================================== --- src/OFDataArray.m +++ src/OFDataArray.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -14,19 +14,21 @@ #import "OFObject.h" #import "OFEnumerator.h" @class OFArray; +/// \cond internal struct of_dictionary_bucket { OFObject *key; OFObject *object; uint32_t hash; }; +/// \endcond /** - * The OFDictionary class is a class for using hash tables. + * \brief A class for storing objects in a hash table. */ @interface OFDictionary: OFObject { struct of_dictionary_bucket *data; @@ -155,10 +157,11 @@ * \return An OFEnumerator to enumerate through the dictionary's keys */ - (OFEnumerator*)keyEnumerator; @end +/// \cond internal @interface OFDictionaryEnumerator: OFEnumerator { struct of_dictionary_bucket *data; size_t size; unsigned long mutations; @@ -174,7 +177,8 @@ @interface OFDictionaryObjectEnumerator: OFDictionaryEnumerator @end @interface OFDictionaryKeyEnumerator: OFDictionaryEnumerator @end +/// \endcond #import "OFMutableDictionary.h" Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -583,10 +583,11 @@ return hash; } @end +/// \cond internal @implementation OFDictionaryEnumerator - initWithData: (struct of_dictionary_bucket*)data_ size: (size_t)size_ mutationsPointer: (unsigned long*)mutations_ptr_ { @@ -638,5 +639,6 @@ return data[pos++].key; else return nil; } @end +/// \endcond Index: src/OFEnumerator.h ================================================================== --- src/OFEnumerator.h +++ src/OFEnumerator.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -10,11 +10,11 @@ */ #import "OFObject.h" /** - * The OFEnumerator class provides methods to enumerate through collections. + * \brief A class which provides methods to enumerate through collections. */ @interface OFEnumerator: OFObject {} /** * \return The next object */ @@ -33,22 +33,31 @@ * We need this bad check to see if we already imported Cocoa, which defines * this as well. */ #define of_fast_enumeration_state_t NSFastEnumerationState #ifndef NSINTEGER_DEFINED +/** + * \brief State information for fast enumerations. + */ typedef struct __of_fast_enumeration_state { + /// Arbitrary state information for the enumeration unsigned long state; + /// Pointer to a C array of objects to return id *itemsPtr; + /// Arbitrary state information to detect mutations unsigned long *mutationsPtr; + /// Additional arbitrary state information unsigned long extra[5]; } of_fast_enumeration_state_t; #endif /** + * \brief A protocol for fast enumeration. + * * The OFFastEnumeration protocol needs to be implemented by all classes * supporting fast enumeration. */ @protocol OFFastEnumeration - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count; @end Index: src/OFEnumerator.m ================================================================== --- src/OFEnumerator.m +++ src/OFEnumerator.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFExceptions.h ================================================================== --- src/OFExceptions.h +++ src/OFExceptions.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -14,11 +14,11 @@ #import "OFObject.h" @class OFString; /** - * An exception indicating an object could not be allocated. + * \brief An exception indicating an object could not be allocated. * * This exception is preallocated, as if there's no memory, no exception can * be allocated of course. That's why you shouldn't and even can't deallocate * it. * @@ -39,11 +39,14 @@ */ - (OFString*)string; @end /** - * The OFException class is the base class for all exceptions in ObjFW. + * \brief The base class for all exceptions in ObjFW + * + * The OFException class is the base class for all exceptions in ObjFW, except + * the OFAllocFailedException. * * IMPORTANT: Exceptions do NOT use OFAutoreleasePools and can't be autoreleased * either! You have to make sure to dealloc the exception in your \@catch block! */ @interface OFException: OFObject @@ -78,11 +81,11 @@ */ - (OFString*)string; @end /** - * An OFException indicating there is not enough memory available. + * \brief An exception indicating there is not enough memory available. */ @interface OFOutOfMemoryException: OFException { size_t req_size; } @@ -110,17 +113,18 @@ */ - (size_t)requestedSize; @end /** - * An OFException indicating that a mutation was detected while enumerating. + * \brief An exception indicating that a mutation was detected while + * enumerating. */ @interface OFEnumerationMutationException: OFException {} @end /** - * An OFException indicating the given memory is not part of the object. + * \brief An exception indicating the given memory is not part of the object. */ @interface OFMemoryNotPartOfObjectException: OFException { void *pointer; } @@ -148,11 +152,12 @@ */ - (void*)pointer; @end /** - * An OFException indicating that a method or part of it is not implemented. + * \brief An exception indicating that a method or part of it is not + * implemented. */ @interface OFNotImplementedException: OFException { SEL selector; } @@ -175,17 +180,17 @@ - initWithClass: (Class)class_ selector: (SEL)selector; @end /** - * An OFException indicating the given value is out of range. + * \brief An exception indicating the given value is out of range. */ @interface OFOutOfRangeException: OFException {} @end /** - * An OFException indicating that the argument is invalid for this method. + * \brief An exception indicating that the argument is invalid for this method. */ @interface OFInvalidArgumentException: OFException { SEL selector; } @@ -208,35 +213,36 @@ - initWithClass: (Class)class_ selector: (SEL)selector; @end /** - * An OFException indicating that the encoding is invalid for this object. + * \brief An exception indicating that the encoding is invalid for this object. */ @interface OFInvalidEncodingException: OFException {} @end /** - * An OFException indicating that the format is invalid. + * \brief An exception indicating that the format is invalid. */ @interface OFInvalidFormatException: OFException {} @end /** - * An OFException indicating that a parser encountered malformed or invalid XML. + * \brief An exception indicating that a parser encountered malformed or + * invalid XML. */ @interface OFMalformedXMLException: OFException {} @end /** - * An OFException indicating that initializing something failed. + * \brief An exception indicating that initializing something failed. */ @interface OFInitializationFailedException: OFException {} @end /** - * An OFException indicating the file couldn't be opened. + * \brief An exception indicating the file couldn't be opened. */ @interface OFOpenFileFailedException: OFException { OFString *path; OFString *mode; @@ -280,11 +286,11 @@ */ - (OFString*)mode; @end /** - * An OFException indicating a read or write to the file failed. + * \brief An exception indicating a read or write to the file failed. */ @interface OFReadOrWriteFailedException: OFException { size_t req_size; int err; @@ -318,23 +324,23 @@ */ - (size_t)requestedSize; @end /** - * An OFException indicating a read on the file failed. + * \brief An exception indicating a read on a file failed. */ @interface OFReadFailedException: OFReadOrWriteFailedException {} @end /** - * An OFException indicating a write to the file failed. + * \brief An exception indicating a write to a file failed. */ @interface OFWriteFailedException: OFReadOrWriteFailedException {} @end /** - * An OFException indicating that changing the mode of the file failed. + * \brief An exception indicating that changing the mode of a file failed. */ @interface OFChangeFileModeFailedException: OFException { OFString *path; mode_t mode; @@ -379,11 +385,11 @@ - (mode_t)mode; @end #ifndef _WIN32 /** - * An OFException indicating that changing the owner of the file failed. + * \brief An exception indicating that changing the owner of a file failed. */ @interface OFChangeFileOwnerFailedException: OFException { OFString *path; uid_t owner; @@ -438,11 +444,11 @@ - (gid_t)group; @end #endif /** - * An OFException indicating that renaming a file failed. + * \brief An exception indicating that renaming a file failed. */ @interface OFRenameFileFailedException: OFException { OFString *from; OFString *to; @@ -486,11 +492,11 @@ */ - (OFString*)to; @end /** - * An OFException indicating that deleting a file failed. + * \brief An exception indicating that deleting a file failed. */ @interface OFDeleteFileFailedException: OFException { OFString *path; int err; @@ -525,11 +531,11 @@ - (OFString*)path; @end #ifndef _WIN32 /** - * An OFException indicating that creating a link failed. + * \brief An exception indicating that creating a link failed. */ @interface OFLinkFailedException: OFException { OFString *src; OFString *dest; @@ -573,11 +579,11 @@ */ - (OFString*)destination; @end /** - * An OFException indicating that creating a symlink failed. + * \brief An exception indicating that creating a symlink failed. */ @interface OFSymlinkFailedException: OFException { OFString *src; OFString *dest; @@ -622,30 +628,30 @@ - (OFString*)destination; @end #endif /** - * An OFException indicating that setting an option failed. + * \brief An exception indicating that setting an option failed. */ @interface OFSetOptionFailedException: OFException {} @end /** - * An OFException indicating a socket is not connected or bound. + * \brief An exception indicating a socket is not connected or bound. */ @interface OFNotConnectedException: OFException {} @end /** - * An OFException indicating an attempt to connect or bind an already connected - * or bound socket. + * \brief An exception indicating an attempt to connect or bind an already + * connected or bound socket. */ @interface OFAlreadyConnectedException: OFException {} @end /** - * An OFException indicating the translation of an address failed. + * \brief An exception indicating the translation of an address failed. */ @interface OFAddressTranslationFailedException: OFException { OFString *node; OFString *service; @@ -689,11 +695,11 @@ */ - (OFString*)service; @end /** - * An OFException indicating that the connection could not be established. + * \brief An exception indicating that the connection could not be established. */ @interface OFConnectionFailedException: OFException { OFString *node; OFString *service; @@ -737,11 +743,11 @@ */ - (OFString*)service; @end /** - * An OFException indicating that binding the socket failed. + * \brief An exception indicating that binding the socket failed. */ @interface OFBindFailedException: OFException { OFString *node; OFString *service; @@ -795,11 +801,11 @@ */ - (int)family; @end /** - * An OFException indicating that listening on the socket failed. + * \brief An exception indicating that listening on the socket failed. */ @interface OFListenFailedException: OFException { int backlog; int err; @@ -833,11 +839,11 @@ */ - (int)backLog; @end /** - * An OFException indicating that accepting a connection failed. + * \brief An exception indicating that accepting a connection failed. */ @interface OFAcceptFailedException: OFException { int err; } @@ -847,27 +853,27 @@ */ - (int)errNo; @end /** - * An OFException indicating that joining the thread failed. + * \brief An exception indicating that joining the thread failed. */ @interface OFThreadJoinFailedException: OFException {} @end /** - * An OFException indicating that locking a mutex failed. + * \brief An exception indicating that locking a mutex failed. */ @interface OFMutexLockFailedException: OFException {} @end /** - * An OFException indicating that unlocking a mutex failed. + * \brief An exception indicating that unlocking a mutex failed. */ @interface OFMutexUnlockFailedException: OFException {} @end /** - * An OFException indicating that the hash has already been calculated. + * \brief An exception indicating that the hash has already been calculated. */ @interface OFHashAlreadyCalculatedException: OFException {} @end Index: src/OFExceptions.m ================================================================== --- src/OFExceptions.m +++ src/OFExceptions.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -16,11 +16,11 @@ #import "OFStream.h" @class OFString; /** - * The OFFile class provides functions to read, write and manipulate files. + * \brief A class which provides functions to read, write and manipulate files. */ @interface OFFile: OFStream { FILE *fp; BOOL close; @@ -126,14 +126,11 @@ * It is not closed when the OFFile object is deallocated! */ - initWithFilePointer: (FILE*)fp; @end -@interface OFFileSingleton: OFFile -@end - /// An OFFile object for stdin extern OFFile *of_stdin; /// An OFFile object for stdout extern OFFile *of_stdout; /// An OFFile object for stderr extern OFFile *of_stderr; Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -27,10 +27,15 @@ #endif OFFile *of_stdin = nil; OFFile *of_stdout = nil; OFFile *of_stderr = nil; + +/// \cond internal +@interface OFFileSingleton: OFFile +@end +/// \endcond @implementation OFFile + (void)load { if (self != [OFFile class]) @@ -222,10 +227,11 @@ return self; } @end +/// \cond internal @implementation OFFileSingleton - initWithPath: (OFString*)path mode: (OFString*)mode { @throw [OFNotImplementedException newWithClass: isa @@ -256,5 +262,6 @@ @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; [super dealloc]; /* Get rid of stupid warning */ } @end +/// \endcond Index: src/OFHashes.h ================================================================== --- src/OFHashes.h +++ src/OFHashes.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -16,11 +16,11 @@ #define OF_SHA1_DIGEST_SIZE 20 extern int _OFHashing_reference; /** - * The OFMD5Hash class provides functions to create an MD5 hash. + * \brief A class which provides functions to create an MD5 hash. */ @interface OFMD5Hash: OFObject { uint32_t buf[4]; uint32_t bits[2]; @@ -49,11 +49,11 @@ */ - (uint8_t*)digest; @end /** - * The OFSHA1Hash class provides functions to create an SHA1 hash. + * \brief A class which provides functions to create an SHA1 hash. */ @interface OFSHA1Hash: OFObject { uint32_t state[5]; uint64_t count; Index: src/OFHashes.m ================================================================== --- src/OFHashes.m +++ src/OFHashes.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -279,14 +279,16 @@ w = OF_ROL(w, 30); #define R4(v, w, x, y, z, i) \ z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + OF_ROL(v, 5); \ w = OF_ROL(w, 30); +/// \cond internal typedef union { char c[64]; uint32_t l[16]; } sha1_c64l16_t; +/// \endcond static inline void sha1_transform(uint32_t state[5], const char buffer[64]) { uint32_t a, b, c, d, e; Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -10,25 +10,26 @@ */ #import "OFObject.h" /** + * \brief A list object. + * * A struct that contains a pointer to the next list object, the previous list * object and the object. */ -typedef struct __of_list_object -{ +typedef struct __of_list_object { /// A pointer to the next list object in the list struct __of_list_object *next; /// A pointer to the previous list object in the list struct __of_list_object *prev; /// The object for the list object id object; } of_list_object_t; /** - * The OFList class provides easy to use double-linked lists. + * \brief A class which provides easy to use double-linked lists. */ @interface OFList: OFObject { of_list_object_t *first; of_list_object_t *last; Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFMacros.h ================================================================== --- src/OFMacros.h +++ src/OFMacros.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFMutableArray.h ================================================================== --- src/OFMutableArray.h +++ src/OFMutableArray.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -10,12 +10,11 @@ */ #import "OFArray.h" /** - * The OFMutableArray class is a class for storing, adding and removing objects - * in an array. + * \brief A class for storing, adding and removing objects in an array. */ @interface OFMutableArray: OFArray { unsigned long mutations; } Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFMutableDictionary.h ================================================================== --- src/OFMutableDictionary.h +++ src/OFMutableDictionary.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -10,11 +10,11 @@ */ #import "OFDictionary.h" /** - * The OFMutableDictionary class is a class for using mutable hash tables. + * \brief A class for using mutable hash tables. */ @interface OFMutableDictionary: OFDictionary { unsigned long mutations; } Index: src/OFMutableDictionary.m ================================================================== --- src/OFMutableDictionary.m +++ src/OFMutableDictionary.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFMutableString.h ================================================================== --- src/OFMutableString.h +++ src/OFMutableString.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -13,11 +13,11 @@ #include #import "OFString.h" /** - * A class for storing and modifying strings. + * \brief A class for storing and modifying strings. */ @interface OFMutableString: OFString {} /** * Sets the OFString to the specified UTF-8 encoded C string. * Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -39,12 +39,11 @@ OF_NUMBER_FLOAT, OF_NUMBER_DOUBLE, }; /** - * The OFNumber class provides a way to store a number in an object and to - * manipulate it. + * \brief provides a way to store a number in an object and to manipulate it. */ @interface OFNumber: OFObject { union { char char_; @@ -536,42 +535,38 @@ * \return The OFNumber as a double */ - (double)asDouble; /** - * Adds the specified OFNumber to the OFNumber. - * * \param num The OFNumber to add + * \return The OFNumber added with the specified OFNumber */ - add: (OFNumber*)num; /** - * Subtracts the specified OFNumber from the OFNumber. - * * \param num The OFNumber to substract + * \return The OFNumber subtracted by the specified OFNumber */ - subtract: (OFNumber*)num; /** - * Multiplies the OFNumber with the specified OFNumber. - * * \param num The OFNumber to multiply with + * \return The OFNumber multiplied with the specified OFNumber */ - multiplyWith: (OFNumber*)num; /** - * Divides the OFNumber by the specified OFNumber. - * * \param num The OFNumber to divide by + * \return The OFNumber devided by the specified OFNumber */ - divideBy: (OFNumber*)num; /** - * Increases the OFNumber by 1. + * \return The OFNumber increased by one. */ - increase; /** - * Decreases the OFNumber by 1. + * \return The OFNumber decreased by one. */ - decrease; @end Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -11,10 +11,11 @@ #include "config.h" #import "OFNumber.h" #import "OFExceptions.h" +#import "OFMacros.h" #define RETURN_AS(t) \ switch (type) { \ case OF_NUMBER_CHAR: \ return (t)value.char_; \ @@ -65,161 +66,137 @@ case OF_NUMBER_DOUBLE: \ return (t)value.double_; \ default: \ @throw [OFInvalidFormatException newWithClass: isa]; \ } -#define CALCULATE(o) \ - switch (type) { \ +#define CALCULATE(o, n) \ + switch (type) { \ case OF_NUMBER_CHAR: \ - value.char_ o; \ - break; \ + return [OFNumber numberWithChar: \ + value.char_ o [n asChar]]; \ case OF_NUMBER_SHORT: \ - value.short_ o; \ - break; \ + return [OFNumber numberWithShort: \ + value.short_ o [n asShort]]; \ case OF_NUMBER_INT: \ - value.int_ o; \ - break; \ + return [OFNumber numberWithInt: \ + value.int_ o [n asInt]]; \ case OF_NUMBER_LONG: \ - value.long_ o; \ - break; \ + return [OFNumber numberWithLong: \ + value.long_ o [n asLong]]; \ case OF_NUMBER_UCHAR: \ - value.uchar o; \ - break; \ + return [OFNumber numberWithUChar: \ + value.uchar o [n asUChar]]; \ case OF_NUMBER_USHORT: \ - value.ushort o; \ - break; \ + return [OFNumber numberWithUShort: \ + value.ushort o [n asUShort]]; \ case OF_NUMBER_UINT: \ - value.uint o; \ - break; \ + return [OFNumber numberWithUInt: \ + value.uint o [n asUInt]]; \ case OF_NUMBER_ULONG: \ - value.ulong o; \ - break; \ + return [OFNumber numberWithULong: \ + value.ulong o [n asULong]]; \ case OF_NUMBER_INT8: \ - value.int8 o; \ - break; \ + return [OFNumber numberWithInt8: \ + value.int8 o [n asInt8]]; \ case OF_NUMBER_INT16: \ - value.int16 o; \ - break; \ + return [OFNumber numberWithInt16: \ + value.int16 o [n asInt16]]; \ case OF_NUMBER_INT32: \ - value.int32 o; \ - break; \ + return [OFNumber numberWithInt32: \ + value.int32 o [n asInt32]]; \ case OF_NUMBER_INT64: \ - value.int64 o; \ - break; \ + return [OFNumber numberWithInt64: \ + value.int64 o [n asInt64]]; \ case OF_NUMBER_UINT8: \ - value.uint8 o; \ - break; \ + return [OFNumber numberWithUInt8: \ + value.uint8 o [n asUInt8]]; \ case OF_NUMBER_UINT16: \ - value.uint16 o; \ - break; \ + return [OFNumber numberWithUInt16: \ + value.uint16 o [n asUInt16]]; \ case OF_NUMBER_UINT32: \ - value.uint32 o; \ - break; \ + return [OFNumber numberWithUInt32: \ + value.uint32 o [n asUInt32]]; \ case OF_NUMBER_UINT64: \ - value.uint64 o; \ - break; \ + return [OFNumber numberWithUInt64: \ + value.uint64 o [n asUInt64]]; \ case OF_NUMBER_SIZE: \ - value.size o; \ - break; \ + return [OFNumber numberWithSize: \ + value.size o [n asSize]]; \ case OF_NUMBER_SSIZE: \ - value.ssize o; \ - break; \ + return [OFNumber numberWithSSize: \ + value.ssize o [n asSSize]]; \ case OF_NUMBER_INTMAX: \ - value.intmax o; \ - break; \ + return [OFNumber numberWithIntMax: \ + value.intmax o [n asIntMax]]; \ case OF_NUMBER_UINTMAX: \ - value.uintmax o; \ - break; \ + return [OFNumber numberWithUIntMax: \ + value.uintmax o [n asUIntMax]]; \ case OF_NUMBER_PTRDIFF: \ - value.ptrdiff o; \ - break; \ + return [OFNumber numberWithPtrDiff: \ + value.ptrdiff o [n asPtrDiff]]; \ case OF_NUMBER_INTPTR: \ - value.intptr o; \ - break; \ + return [OFNumber numberWithIntPtr: \ + value.intptr o [n asIntPtr]]; \ case OF_NUMBER_FLOAT: \ - value.float_ o; \ - break; \ + return [OFNumber numberWithFloat: \ + value.float_ o [n asFloat]]; \ case OF_NUMBER_DOUBLE: \ - value.double_ o; \ - break; \ + return [OFNumber numberWithDouble: \ + value.double_ o [n asDouble]]; \ default: \ @throw [OFInvalidFormatException newWithClass: isa]; \ } -#define CALCULATE2(o, n) \ - switch ([n type]) { \ +#define CALCULATE2(o) \ + switch (type) { \ case OF_NUMBER_CHAR: \ - value.char_ o [n asChar]; \ - break; \ + return [OFNumber numberWithChar: value.char_ o]; \ case OF_NUMBER_SHORT: \ - value.short_ o [n asShort]; \ - break; \ + return [OFNumber numberWithShort: value.short_ o]; \ case OF_NUMBER_INT: \ - value.int_ o [n asInt]; \ - break; \ + return [OFNumber numberWithInt: value.int_ o]; \ case OF_NUMBER_LONG: \ - value.long_ o [n asLong]; \ - break; \ + return [OFNumber numberWithLong: value.long_ o]; \ case OF_NUMBER_UCHAR: \ - value.uchar o [n asUChar]; \ - break; \ + return [OFNumber numberWithUChar: value.uchar o]; \ case OF_NUMBER_USHORT: \ - value.ushort o [n asUShort]; \ - break; \ + return [OFNumber numberWithUShort: value.ushort o]; \ case OF_NUMBER_UINT: \ - value.uint o [n asUInt]; \ - break; \ + return [OFNumber numberWithUInt: value.uint o]; \ case OF_NUMBER_ULONG: \ - value.ulong o [n asULong]; \ - break; \ + return [OFNumber numberWithULong: value.ulong o]; \ case OF_NUMBER_INT8: \ - value.int8 o [n asInt8]; \ - break; \ + return [OFNumber numberWithInt8: value.int8 o]; \ case OF_NUMBER_INT16: \ - value.int16 o [n asInt16]; \ - break; \ + return [OFNumber numberWithInt16: value.int16 o]; \ case OF_NUMBER_INT32: \ - value.int32 o [n asInt32]; \ - break; \ + return [OFNumber numberWithInt32: value.int32 o]; \ case OF_NUMBER_INT64: \ - value.int64 o [n asInt64]; \ - break; \ + return [OFNumber numberWithInt64: value.int64 o]; \ case OF_NUMBER_UINT8: \ - value.uint8 o [n asUInt8]; \ - break; \ + return [OFNumber numberWithUInt8: value.uint8 o]; \ case OF_NUMBER_UINT16: \ - value.uint16 o [n asUInt16]; \ - break; \ + return [OFNumber numberWithUInt16: value.uint16 o]; \ case OF_NUMBER_UINT32: \ - value.uint32 o [n asUInt32]; \ - break; \ + return [OFNumber numberWithUInt32: value.uint32 o]; \ case OF_NUMBER_UINT64: \ - value.uint64 o [n asUInt64]; \ - break; \ + return [OFNumber numberWithUInt64: value.uint64 o]; \ case OF_NUMBER_SIZE: \ - value.size o [n asSize]; \ - break; \ + return [OFNumber numberWithSize: value.size o]; \ case OF_NUMBER_SSIZE: \ - value.ssize o [n asSSize]; \ - break; \ + return [OFNumber numberWithSSize: value.ssize o]; \ case OF_NUMBER_INTMAX: \ - value.intmax o [n asIntMax]; \ - break; \ + return [OFNumber numberWithIntMax: value.intmax o]; \ case OF_NUMBER_UINTMAX: \ - value.uintmax o [n asUIntMax]; \ - break; \ + return [OFNumber numberWithUIntMax: value.uintmax o]; \ case OF_NUMBER_PTRDIFF: \ - value.ptrdiff o [n asPtrDiff]; \ - break; \ + return [OFNumber numberWithPtrDiff: value.ptrdiff o]; \ case OF_NUMBER_INTPTR: \ - value.intptr o [n asIntPtr]; \ - break; \ + return [OFNumber numberWithIntPtr: value.intptr o]; \ case OF_NUMBER_FLOAT: \ - value.float_ o [n asFloat]; \ - break; \ + return [OFNumber numberWithFloat: value.float_ o]; \ case OF_NUMBER_DOUBLE: \ - value.double_ o [n asDouble]; \ - break; \ + return [OFNumber numberWithDouble: value.double_ o]; \ default: \ @throw [OFInvalidFormatException newWithClass: isa]; \ } @implementation OFNumber @@ -756,44 +733,58 @@ } } - (uint32_t)hash { - return [self asUInt32]; + uint32_t hash; + size_t i; + + switch (type) { + case OF_NUMBER_FLOAT: + OF_HASH_INIT(hash); + for (i = 0; i < sizeof(float); i++) + OF_HASH_ADD(hash, ((char*)&value.float_)[i]); + OF_HASH_FINALIZE(hash); + + return hash; + case OF_NUMBER_DOUBLE: + OF_HASH_INIT(hash); + for (i = 0; i < sizeof(double); i++) + OF_HASH_ADD(hash, ((char*)&value.double_)[i]); + OF_HASH_FINALIZE(hash); + + return hash; + default: + return [self asUInt32]; + } } - add: (OFNumber*)num { - CALCULATE2(+=, num) - return self; + CALCULATE(+, num) } - subtract: (OFNumber*)num { - CALCULATE2(-=, num) - return self; + CALCULATE(-, num) } - multiplyWith: (OFNumber*)num { - CALCULATE2(*=, num) - return self; + CALCULATE(*, num) } - divideBy: (OFNumber*)num { - CALCULATE2(/=, num) - return self; + CALCULATE(/, num) } - increase { - CALCULATE(++) - return self; + CALCULATE2(+ 1) } - decrease { - CALCULATE(--) - return self; + CALCULATE2(- 1) } @end Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -15,11 +15,11 @@ #include #import /** - * A result of a comparison. + * \brief A result of a comparison. */ typedef enum { /// The left object is smaller than the right OF_ORDERED_ASCENDING = -1, /// Both objects are equal @@ -27,11 +27,11 @@ /// The left object is bigger than the right OF_ORDERED_DESCENDING = 1 } of_comparison_result_t; /** - * The OFObject class is the base class for all other classes inside ObjFW. + * \brief The root class for all other classes inside ObjFW. */ @interface OFObject { /// The class of the object Class isa; @@ -289,24 +289,26 @@ */ - (void)dealloc; @end /** - * Objects implementing this protocol can be copied. + * \brief A protocol for creation of copies. */ @protocol OFCopying /** * \return A copy of the object */ - (id)copy; @end /** + * \brief A protocol for creation of mutable copies. + * * This protocol is implemented by objects that can be mutable and immutable * and allows returning a mutable copy. */ @protocol OFMutableCopying /** * \return A copy of the object */ - (id)mutableCopy; @end Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -34,18 +34,20 @@ # import "atomic.h" #else # import "threading.h" #endif +/// \cond internal struct pre_ivar { void **memchunks; size_t memchunks_size; int32_t retain_count; /* int32_t because atomic ops use int32_t */ #ifndef OF_ATOMIC_OPS of_spinlock_t retain_spinlock; #endif }; +/// \endcond /* Hopefully no arch needs more than 16 bytes padding */ #define PRE_IVAR_ALIGN ((sizeof(struct pre_ivar) + 15) & ~15) #define PRE_IVAR ((struct pre_ivar*)((char*)self - PRE_IVAR_ALIGN)) Index: src/OFPlugin.h ================================================================== --- src/OFPlugin.h +++ src/OFPlugin.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -14,16 +14,16 @@ @class OFString; #ifndef _WIN32 typedef void* of_plugin_handle_t; #else -#include +# include typedef HMODULE of_plugin_handle_t; #endif /** - * The OFPlugin class provides a system for loading plugins at runtime. + * \brief Provides a system for loading plugins at runtime. */ @interface OFPlugin: OFObject { of_plugin_handle_t handle; } Index: src/OFPlugin.m ================================================================== --- src/OFPlugin.m +++ src/OFPlugin.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFSocket.h ================================================================== --- src/OFSocket.h +++ src/OFSocket.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -15,11 +15,11 @@ # define _WIN32_WINNT 0x0501 # include #endif /** - * The OFTCPSocket class provides functions to create and use sockets. + * \brief A class which provides functions to create and use sockets. */ @interface OFSocket: OFStream { #ifndef _WIN32 int sock; Index: src/OFSocket.m ================================================================== --- src/OFSocket.m +++ src/OFSocket.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -12,11 +12,11 @@ #import "OFObject.h" @class OFString; /** - * The OFStream class provides a base class for different types of streams. + * \brief A base class for different types of streams. */ @interface OFStream: OFObject { char *cache; size_t cache_len; Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -30,11 +30,11 @@ extern size_t of_string_index_to_position(const char*, size_t, size_t); @class OFArray; /** - * A class for managing strings. + * \brief A class for handling strings. */ @interface OFString: OFObject { char *string; unsigned int length; Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -22,11 +22,11 @@ #endif @class OFString; /** - * The OFTCPSocket class provides functions to create and use sockets. + * \brief A class which provides functions to create and use TCP sockets. */ @interface OFTCPSocket: OFSocket { struct sockaddr *saddr; socklen_t saddr_len; Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -13,11 +13,11 @@ #import "OFList.h" #import "threading.h" /** - * A Thread Local Storage key. + * \brief A class for Thread Local Storage keys. */ @interface OFTLSKey: OFObject { @public of_tlskey_t key; @@ -50,21 +50,20 @@ */ - initWithDestructor: (void(*)(id))destructor; @end /** - * The OFThread class provides portable threads. + * \brief A class which provides portable threads. * * To use it, you should create a new class derived from it and reimplement * main. */ @interface OFThread: OFObject { id object; of_thread_t thread; BOOL running; - @public id retval; } /** @@ -116,11 +115,11 @@ */ - join; @end /** - * A class for creating mutual exclusions. + * \brief A class for creating mutual exclusions. */ @interface OFMutex: OFObject { of_mutex_t mutex; } Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFURLEncoding.h ================================================================== --- src/OFURLEncoding.h +++ src/OFURLEncoding.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -12,12 +12,11 @@ #import "OFString.h" extern int _OFURLEncoding_reference; /** - * The OFString (OFURLEncoding) category provides an easy way to encode and - * decode strings for URLs. + * \brief A category which provides URL encoding and decoding. */ @interface OFString (OFURLEncoding) /** * Encodes a string for use in a URL. * Index: src/OFURLEncoding.m ================================================================== --- src/OFURLEncoding.m +++ src/OFURLEncoding.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFXMLElement.h ================================================================== --- src/OFXMLElement.h +++ src/OFXMLElement.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -12,16 +12,15 @@ #import "OFString.h" extern int _OFXMLElement_reference; /** - * The OFString (OFXMLEscaping) category provides an easy way to escape strings - * for use in an XML document. + * \brief A category to escape strings for use in an XML document. */ @interface OFString (OFXMLEscaping) /** * Escapes a string for use in an XML document. * * \return A new autoreleased string */ - stringByXMLEscaping; @end Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/OFXMLParser.h ================================================================== --- src/OFXMLParser.h +++ src/OFXMLParser.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -12,12 +12,12 @@ #import "OFString.h" extern int _OFXMLParser_reference; /** - * A protocol that needs to be implemented by delegates for - * stringByXMLUnescapingWithHandler:. + * \brief A protocol that needs to be implemented by delegates for + * stringByXMLUnescapingWithHandler:. */ @protocol OFXMLUnescapingDelegate /** * This callback is called when an unknown entity was found while trying to * unescape XML. The callback is supposed to return a substitution for the @@ -29,12 +29,11 @@ */ - (OFString*)foundUnknownEntityNamed: (OFString*)entity; @end /** - * The OFString (OFXMLUnescaping) category provides methods to unescape XML in - * strings. + * \brief A category for unescaping XML in strings. */ @interface OFString (OFXMLUnescaping) /** * Unescapes XML in the string. */ Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/ObjFW.h ================================================================== --- src/ObjFW.h +++ src/ObjFW.h @@ -1,8 +1,8 @@ /* - * Copyright (c) 2008 - 2009 - * Jonathan Schleifer "js@webkeks.org" + * Copyright (c) 2008 - 2010 + * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in Index: src/asprintf.h ================================================================== --- src/asprintf.h +++ src/asprintf.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -10,10 +10,10 @@ */ #import "objfw-defs.h" #ifndef OF_HAVE_ASPRINTF -#include +# include extern int asprintf(char**, const char*, ...); extern int vasprintf(char**, const char*, va_list); #endif Index: src/asprintf.m ================================================================== --- src/asprintf.m +++ src/asprintf.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/atomic.h ================================================================== --- src/atomic.h +++ src/atomic.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/iso_8859_15.m ================================================================== --- src/iso_8859_15.m +++ src/iso_8859_15.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/objc_properties.m ================================================================== --- src/objc_properties.m +++ src/objc_properties.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/objc_sync.m ================================================================== --- src/objc_sync.m +++ src/objc_sync.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -17,17 +17,19 @@ #import #import "threading.h" +/// \cond internal struct locks_s { id obj; size_t count; size_t recursion; of_thread_t thread; of_mutex_t mutex; }; +/// \endcond static of_mutex_t mutex; static struct locks_s *locks = NULL; static size_t num_locks = 0; Index: src/threading.h ================================================================== --- src/threading.h +++ src/threading.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/unicode.h ================================================================== --- src/unicode.h +++ src/unicode.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/unicode.m ================================================================== --- src/unicode.m +++ src/unicode.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: src/windows_1252.m ================================================================== --- src/windows_1252.m +++ src/windows_1252.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: tests/Makefile ================================================================== --- tests/Makefile +++ tests/Makefile @@ -6,10 +6,11 @@ SRCS = OFArray.m \ OFDataArray.m \ OFDictionary.m \ OFHashes.m \ OFList.m \ + OFNumber.m \ OFObject.m \ ${OFPLUGIN_M} \ OFString.m \ OFTCPSocket.m \ ${OFTHREAD_M} \ Index: tests/OFArray.m ================================================================== --- tests/OFArray.m +++ tests/OFArray.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -116,13 +116,15 @@ OFOutOfRangeException, [a[0] objectAtIndex: [a[0] count]]) EXPECT_EXCEPTION(@"Detect out of range in -[removeNItems:]", OFOutOfRangeException, [m[0] removeNObjects: [m[0] count] + 1]) - a[1] = [OFArray arrayWithObjects: @"foo", @"bar", @"baz", nil]; TEST(@"-[componentsJoinedByString:]", - [[a[1] componentsJoinedByString: @" "] isEqual: @"foo bar baz"]) + (a[1] = [OFArray arrayWithObjects: @"foo", @"bar", @"baz", nil]) && + [[a[1] componentsJoinedByString: @" "] isEqual: @"foo bar baz"] && + (a[1] = [OFArray arrayWithObject: @"foo"]) && + [[a[1] componentsJoinedByString: @" "] isEqual: @"foo"]) m[0] = [[a[0] mutableCopy] autorelease]; ok = YES; i = 0; Index: tests/OFDataArray.m ================================================================== --- tests/OFDataArray.m +++ tests/OFDataArray.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: tests/OFDictionary.m ================================================================== --- tests/OFDictionary.m +++ tests/OFDictionary.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: tests/OFHashes.m ================================================================== --- tests/OFHashes.m +++ tests/OFHashes.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: tests/OFList.m ================================================================== --- tests/OFList.m +++ tests/OFList.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the ADDED tests/OFNumber.m Index: tests/OFNumber.m ================================================================== --- tests/OFNumber.m +++ tests/OFNumber.m @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2008 - 2010 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. 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. + */ + +#include "config.h" + +#import "OFNumber.h" +#import "OFAutoreleasePool.h" + +#import "main.h" + +static OFString *module = @"OFNumber"; + +void +number_tests() +{ + OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; + OFNumber *num; + + TEST(@"+[numberWithIntMax:]", + (num = [OFNumber numberWithIntMax: 123456789])) + + TEST(@"-[isEqual:]", + [num isEqual: [OFNumber numberWithUInt32: 123456789]]) + + TEST(@"-[hash]", [num hash] == 123456789) + + TEST(@"-[asDouble]", [num asDouble] == 123456789.L) + + TEST(@"-[decrease]", + [[num decrease] isEqual: [OFNumber numberWithInt32: 123456788]]) + + TEST(@"-[divideBy:]", + [[num divideBy: [OFNumber numberWithInt: 2]] asInt] == 61728394) + + [pool drain]; +} Index: tests/OFObject.m ================================================================== --- tests/OFObject.m +++ tests/OFObject.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: tests/OFPlugin.m ================================================================== --- tests/OFPlugin.m +++ tests/OFPlugin.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: tests/OFString.m ================================================================== --- tests/OFString.m +++ tests/OFString.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: tests/OFTCPSocket.m ================================================================== --- tests/OFTCPSocket.m +++ tests/OFTCPSocket.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: tests/OFThread.m ================================================================== --- tests/OFThread.m +++ tests/OFThread.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: tests/main.h ================================================================== --- tests/main.h +++ tests/main.h @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the Index: tests/main.m ================================================================== --- tests/main.m +++ tests/main.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the @@ -22,10 +22,11 @@ extern void array_tests(); extern void dataarray_tests(); extern void dictionary_tests(); extern void hashes_tests(); extern void list_tests(); +extern void number_tests(); extern void object_tests(); #ifdef OF_PLUGINS extern void plugin_tests(); #endif #ifdef OF_HAVE_PROPERTIES @@ -105,10 +106,11 @@ string_tests(); dataarray_tests(); array_tests(); dictionary_tests(); list_tests(); + number_tests(); tcpsocket_tests(); #ifdef OF_THREADS thread_tests(); #endif #ifdef OF_PLUGINS Index: tests/properties.m ================================================================== --- tests/properties.m +++ tests/properties.m @@ -1,7 +1,7 @@ /* - * Copyright (c) 2008 - 2009 + * Copyright (c) 2008 - 2010 * Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the