Documentation

Functions

All the public Functions in EtoileFoundation

Functions

Default

NSDictionary * ETGetOptionsDictionary(char* optString, int argc, char** argv)
Copyright (C) 2008 David Chisnall Date: June 2008 License: Modified BSD (see COPYING)

Generate an NSDictionary from the specified command-line options.

optString is a C string containing getopt-compatible options. argc and argv are the same as those passed into main(). The returned dictionary contains NSNumbers representing the Bool values YES and NO for options that are present or absent, and NSStrings containing optional parameters for those that contain them.

Non-option arguments are collected into an array which can be retrieved from the returned dictionary by passing an empty string as key.

Consider the invocation:

NSDictionary * opts = ETGetOptionsDictionary("bf:", argc, argv);

When the app is invoked with -b -f foo, this will return the dictionary: {b = 1; f = foo; "" = ();} When the app is invoked with -f "bar wibble" bla bli, it will return the following: {b = 0; f = "bar wibble"; "" = (bla, bli);}

Invalid options will cause an InvalidOption exception to be thrown.

    int ETCArrayAdd(ETCArray array, void* object)

    Adds object at the end of array, allocating more space if needed.

      int ETCArrayAddAtIndex(ETCArray array, void* object, unsigned int anIndex)

      Adds object to array at anIndex, replacing the existing value at that index.

        int ETCArrayAppendArray(ETCArray array, ETCArray otherArray)

        Appends the contents of otherArray to array.

          unsigned int ETCArrayCount(ETCArray array)

          Returns the number of objects in the array.

            void ETCArrayFree(ETCArray array)

            Destroy the array.

              int ETCArrayIndexOfObjectIdenticalTo(ETCArray array, void* object)

              Returns the index of the specified value.

                ETCArray ETCArrayNew()

                Creates a new array with some default initial capacity.

                  ETCArray ETCArrayNewWithInitialSize(unsigned int initialSize)

                  Creates a new array with a specified initial capacity.

                    void* ETCArrayObjectAtIndex(ETCArray array, unsigned int anIndex)

                    Returns the value at the specified index.

                      int ETCArrayRemoveAllObjects(ETCArray array, int freeObjects)

                      Removes all objects from the array, giving an empty array.

                        int ETCArrayRemoveLastObject(ETCArray array)

                        Removes the last object from an array.

                          int ETCArrayRemoveObjectAtIndex(ETCArray array, unsigned int anIndex)

                          Removes the object at the specified index. All subsequent objects will moved up the array by one element.

                            int ETCArraySwap(ETCArray array, unsigned int index1, unsigned int index2)

                            Swap the values at two indexes.

                              BOOL ETGetInstanceVariableValueForKey(id object, id* value, NSString * key)

                              Returns the value into the object instance variable by looking it up with the Key Value Coding semantics based on the key, and returns YES on success.

                              For a key equal to 'variable', Key Value Coding search pattern to access instance variables happens in the order below:

                              • _variable
                              • _isVariable
                              • variable
                              • isVariable

                              Valid values are all the supported Key Value Coding types such as id, float or NSRect boxed in a NSValue etc.

                              If no matching instance variable is found, returns NO. Which means that either the key is invalid or the declared ivar type is not supported by Key Value Coding.

                              This function won't invoke -[NSObject valueForUndefinedKey:] .

                              To implement these extra Key Value Coding behaviors, check whether NO is returned (to call -valueForUndefinedKey:).

                                BOOL ETSetInstanceVariableValueForKey(id object, id value, NSString * key)

                                Sets the value into the object instance variable by looking it up with the Key Value Coding semantics based on the key, and returns YES on success.

                                For a key equal to 'variable', Key Value Coding search pattern to access instance variables happens in the order below:

                                • _variable
                                • _isVariable
                                • variable
                                • isVariable

                                Valid values are all the supported Key Value Coding types such as id, float or NSRect boxed in a NSValue etc.

                                If no matching instance variable is found, returns NO. Which means that either the key is invalid or the declared ivar type is not supported by Key Value Coding.

                                This function won't invoke -[NSObject setValue:forUndefinedKey:] and -[NSObject setNilValueForKey:] .

                                To implement these extra Key Value Coding behaviors, check nil and NSNull value before calling this function (to call -setNilValueForKey:), and check whether NO is returned (to call -setValue:forUndefinedKey:).

                                  void ETDrainAutoreleasePool(void* object)

                                  Cleanup function that releases a lock.

                                    void ETStackAutoRelease(void* object)
                                    Description forthcoming.
                                      void ETUnlockObject(void* object)

                                      Cleanup function that releases a lock.

                                        void pophandler(void* exception)

                                        Function installed as a cleanup function by SET_HANDLER to pop the added exception off the stack when the current lexical scope is exited.