Tidyups etc

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17380 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2003-07-28 10:53:18 +00:00
parent 4a92c831b2
commit 02aace51b0
8 changed files with 79 additions and 5 deletions

View file

@ -1,3 +1,12 @@
2003-07-28 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSFFCALLInvocation.m: Make exception text more meaningful
* Source/GSFFIInvocation.m: ditto
* Source/Additions/GSXML.m: Add a couple of convenience methods to
test node type.
* Source/Additions/GSMime.m: Add convenience method for putting
a new header in a document.
2003-07-27 Gregory John Casamento <greg_casamento@yahoo.com> &
Alexander Malmberg <alexander@malmberg.org>

View file

@ -124,6 +124,9 @@
- (NSArray*) headersNamed: (NSString*)name;
- (NSString*) makeBoundary;
- (GSMimeHeader*) makeContentID;
- (GSMimeHeader*) makeHeader: (NSString*)name
value: (NSString*)value
parameters: (NSDictionary*)parameters;
- (GSMimeHeader*) makeMessageID;
- (NSMutableData*) rawMimeData;
- (NSMutableData*) rawMimeData: (BOOL)isOuter;

View file

@ -119,6 +119,8 @@
- (GSXMLAttribute*) firstAttribute;
- (GSXMLNode*) firstChild;
- (GSXMLNode*) firstChildElement;
- (BOOL) isElement;
- (BOOL) isText;
- (void*) lib;
- (GSXMLAttribute*) makeAttributeWithName: (NSString*)name
value: (NSString*)value;

View file

@ -3776,6 +3776,26 @@ static NSCharacterSet *tokenSet = nil;
return hdr;
}
/**
* Convenience method to create a new header and add it to the receiver
* replacing any existing header of the same name.<br />
* Returns the newly created header.<br />
* See [GSMimeHeader-initWithName:value:parameters:] and -setHeader: methods.
*/
- (GSMimeHeader*) makeHeader: (NSString*)name
value: (NSString*)value
parameters: (NSDictionary*)parameters
{
GSMimeHeader *hdr;
hdr = [[GSMimeHeader alloc] initWithName: name
value: value
parameters: parameters];
[self setHeader: hdr];
RELEASE(hdr);
return hdr;
}
/**
* Create new message ID header, set it as the message ID of the document
* and return it.<br />

View file

@ -1124,6 +1124,20 @@ static NSMapTable *nodeNames = 0;
return nil;
}
/**
* Convenience method, equivalent to calling -type and comparing it
* with the result of passing "XML_ELEMENT_NODE" to
* +typeFromDescription: (but faster).
*/
- (BOOL) isElement
{
if ((int)((xmlNodePtr)(lib))->type == XML_ELEMENT_NODE)
{
return YES;
}
return NO;
}
- (BOOL) isEqual: (id)other
{
if ([other isKindOfClass: [self class]] == YES
@ -1137,6 +1151,20 @@ static NSMapTable *nodeNames = 0;
}
}
/**
* Convenience method, equivalent to calling -type and comparing it
* with the result of passing "XML_TEXT_NODE" to
* +typeFromDescription: (but faster).
*/
- (BOOL) isText
{
if ((int)((xmlNodePtr)(lib))->type == XML_TEXT_NODE)
{
return YES;
}
return NO;
}
/**
* Returns a pointer to the raw libxml data used by this document.<br />
* Only for use by libxml experts!

View file

@ -860,8 +860,14 @@ GSInvocationCallback (void *callback_data, va_alist args)
sig = [NSMethodSignature signatureWithObjCTypes: sel_get_type(selector)];
}
NSCAssert1(sig, @"No signature for selector %@",
NSStringFromSelector(selector));
if (sig == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"%s(%s) does not recognize %s",
object_get_class_name(obj),
GSObjCIsInstance(obj) ? "instance" : "class",
selector ? sel_get_name(selector) : "(null)"];
}
invocation = [[GSFFCallInvocation alloc] initWithMethodSignature: sig];
AUTORELEASE(invocation);

View file

@ -475,8 +475,14 @@ GSFFIInvocationCallback(ffi_cif *cif, void *retp, void **args, void *user)
sig = [NSMethodSignature signatureWithObjCTypes: sel_get_type(selector)];
}
NSCAssert1(sig, @"No signature for selector %@",
NSStringFromSelector(selector));
if (sig == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"%s(%s) does not recognize %s",
object_get_class_name(obj),
GSObjCIsInstance(obj) ? "instance" : "class",
selector ? sel_get_name(selector) : "(null)"];
}
invocation = [[GSFFIInvocation alloc] initWithCallback: cif
returnp: retp

View file

@ -224,7 +224,7 @@ printf("Calling proxy\n");
printf("ERROR ... expecting 6 and got %d\n", i);
printf("Testing NS_INVOCATION ... ");
inv = NS_MESSAGE([Target class], loopInt: 7);
inv = NS_INVOCATION([Target class], loopInt: 7);
[inv setTarget: t];
[inv invoke];
[inv getReturnValue: &i];