2007-07-12 00:52:51 -07:00
|
|
|
/*
|
|
|
|
* moocobject.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
2007-09-23 09:47:28 -07:00
|
|
|
* License version 2.1 as published by the Free Software Foundation.
|
2007-07-12 00:52:51 -07:00
|
|
|
*
|
|
|
|
* See COPYING file that comes with this distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MOO_COBJECT_H
|
|
|
|
#define MOO_COBJECT_H
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
2007-08-07 21:48:00 -07:00
|
|
|
#ifdef MOO_OBJC_USE_FOUNDATION
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#else
|
2007-07-12 00:52:51 -07:00
|
|
|
#import <objc/Object.h>
|
|
|
|
#endif
|
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
G_BEGIN_DECLS
|
2007-07-12 00:52:51 -07:00
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
#define MOO_UNUSED_VAR(var) ((void)var)
|
2007-07-12 00:52:51 -07:00
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
#ifndef MOO_OBJC_USE_FOUNDATION
|
|
|
|
|
|
|
|
/* stripped down NSObject protocol, to make it possible to substitute
|
|
|
|
* MooCObject with NSObject when it's available */
|
|
|
|
@protocol MooCObject
|
|
|
|
- (Class) class;
|
|
|
|
- (Class) superclass;
|
|
|
|
- (BOOL) isKindOfClass: (Class)aClass;
|
|
|
|
- (id) performSelector: (SEL)aSelector;
|
|
|
|
- (BOOL) respondsToSelector: (SEL)aSelector;
|
2007-07-12 00:52:51 -07:00
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
- (id) retain;
|
2007-07-12 00:52:51 -07:00
|
|
|
- (void) release;
|
2007-08-07 21:48:00 -07:00
|
|
|
- (id) autorelease;
|
2007-07-12 00:52:51 -07:00
|
|
|
- (guint) retainCount;
|
|
|
|
- (void) dealloc;
|
|
|
|
@end
|
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
@interface MooCObject : Object <MooCObject>
|
2007-07-12 00:52:51 -07:00
|
|
|
{
|
|
|
|
@private
|
2007-08-07 21:48:00 -07:00
|
|
|
guint retainCount;
|
2007-07-12 00:52:51 -07:00
|
|
|
}
|
2007-08-07 21:48:00 -07:00
|
|
|
@end
|
2007-07-12 00:52:51 -07:00
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
#else // MOO_OBJC_USE_FOUNDATION
|
2007-07-12 00:52:51 -07:00
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
#define MooCObject NSObject
|
2007-07-12 00:52:51 -07:00
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
#endif // MOO_OBJC_USE_FOUNDATION
|
2007-07-12 00:52:51 -07:00
|
|
|
|
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
void moo_init_objc_api (void);
|
|
|
|
|
|
|
|
void moo_objc_push_autorelease_pool (void);
|
|
|
|
void moo_objc_pop_autorelease_pool (void);
|
2007-07-12 00:52:51 -07:00
|
|
|
|
|
|
|
|
2007-11-03 10:48:58 -07:00
|
|
|
gulong moo_objc_signal_connect (gpointer instance,
|
|
|
|
const char *signal,
|
|
|
|
MooCObject *target,
|
|
|
|
SEL sel);
|
|
|
|
|
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
#ifdef CSTR
|
|
|
|
#warning "CSTR defined"
|
|
|
|
#endif
|
|
|
|
#undef CSTR
|
|
|
|
typedef const char *CSTR;
|
|
|
|
|
2007-07-12 00:52:51 -07:00
|
|
|
|
2007-08-07 21:48:00 -07:00
|
|
|
G_END_DECLS
|
2007-07-12 00:52:51 -07:00
|
|
|
|
|
|
|
#endif /* MOO_COBJECT_H */
|
|
|
|
/* -*- objc -*- */
|