oc语言基础整理
objc.h----------------
typedef struct objc_class *Class;
struct objc_object {
Class isa OBJC_ISA_AVAILABILITY;
};
typedef struct objc_object *id;
#if !OBJC_OLD_DISPATCH_PROTOTYPES
typedef void (*IMP)(void /* id, SEL, ... */ );
#else
typedef id (*IMP)(id, SEL, ...);
#endif
/// Type to represent a boolean value.
#if (TARGET_OS_IPHONE && __LP64__) || TARGET_OS_WATCH
#define OBJC_BOOL_IS_BOOL 1
typedef bool BOOL;
#else
#define OBJC_BOOL_IS_CHAR 1
typedef signed char BOOL;
runtime.h------------------
/// An opaque type that represents a method in a class definition.
typedef struct objc_method *Method;
/// An opaque type that represents an instance variable.
typedef struct objc_ivar *Ivar;
/// An opaque type that represents a category.
typedef struct objc_category *Category;
/// An opaque type that represents an Objective-C declared property.
typedef struct objc_property *objc_property_t;
struct objc_class {
Class isa OBJC_ISA_AVAILABILITY;
#if !__OBJC2__
Class super_class OBJC2_UNAVAILABLE;
const char *name OBJC2_UNAVAILABLE;
long version OBJC2_UNAVAILABLE;
long info OBJC2_UNAVAILABLE;
long instance_size OBJC2_UNAVAILABLE;
struct objc_ivar_list *ivars OBJC2_UNAVAILABLE;
struct objc_method_list **methodLists OBJC2_UNAVAILABLE;
struct objc_cache *cache OBJC2_UNAVAILABLE;
struct objc_protocol_list *protocols OBJC2_UNAVAILABLE;
#endif
} OBJC2_UNAVAILABLE;
/* Use `Class` instead of `struct objc_class *` */
struct objc_method {
SEL method_name OBJC2_UNAVAILABLE;
char *method_types OBJC2_UNAVAILABLE;
IMP method_imp OBJC2_UNAVAILABLE;
}
struct objc_category {
char *category_name OBJC2_UNAVAILABLE;
char *class_name OBJC2_UNAVAILABLE;
struct objc_method_list *instance_methods OBJC2_UNAVAILABLE;
struct objc_method_list *class_methods OBJC2_UNAVAILABLE;
struct objc_protocol_list *protocols OBJC2_UNAVAILABLE;
} OBJC2_UNAVAILABLE;
struct objc_ivar {
char *ivar_name OBJC2_UNAVAILABLE;
char *ivar_type OBJC2_UNAVAILABLE;
int ivar_offset OBJC2_UNAVAILABLE;
#ifdef __LP64__
int space OBJC2_UNAVAILABLE;
#endif
}
OBJC_EXPORT void (*_error)(id, const char *, va_list) OBJC2_UNAVAILABLE;
Object.h-----------------
@interface Object
{
Class isa; /* A pointer to the instance's class structure */
}
NSObject.h-----------------
@interface NSObject <NSObject> {
Class isa OBJC_ISA_AVAILABILITY;
}
objc-sync.h----------------
/**
* Begin synchronizing on 'obj'.
* Allocates recursive pthread_mutex associated with 'obj' if needed.
*
* @param obj The object to begin synchronizing on.
*
* @return OBJC_SYNC_SUCCESS once lock is acquired.
*/
OBJC_EXPORT int objc_sync_enter(id obj)
__OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0);
/**
* End synchronizing on 'obj'.
*
* @param obj The objet to end synchronizing on.
*
* @return OBJC_SYNC_SUCCESS or OBJC_SYNC_NOT_OWNING_THREAD_ERROR
*/
OBJC_EXPORT int objc_sync_exit(id obj)
__OSX_AVAILABLE_STARTING(__MAC_10_3, __IPHONE_2_0);
// The wait/notify functions have never worked correctly and no longer exist.
OBJC_EXPORT int objc_sync_wait(id obj, long long milliSecondsMaxWait)
UNAVAILABLE_ATTRIBUTE;
OBJC_EXPORT int objc_sync_notify(id obj)
UNAVAILABLE_ATTRIBUTE;
OBJC_EXPORT int objc_sync_notifyAll(id obj)
UNAVAILABLE_ATTRIBUTE;
集合类--------------
DEFINED AS: A common class
HEADER FILES: objc/List.h
DEPRECATED_ATTRIBUTE
@interface List : Object
{
@public
id *dataPtr DEPRECATED_ATTRIBUTE; /* data of the List object */
unsigned numElements DEPRECATED_ATTRIBUTE; /* Actual number of elements */
unsigned maxElements DEPRECATED_ATTRIBUTE; /* Total allocated elements */
}
- (id)makeObjectsPerform:(SEL)aSelector DEPRECATED_ATTRIBUTE;
- (id)makeObjectsPerform:(SEL)aSelector with:anObject DEPRECATED_ATTRIBUTE;
/*************************************************************************
* Hash tables of arbitrary data
*************************************************************************/
/* This module allows hashing of arbitrary data. Such data must be pointers or integers, and client is responsible for allocating/deallocating this data. A deallocation call-back is provided.
The objective C class HashTable is preferred when dealing with (key, values) associations because it is easier to use in that situation.
As well-behaved scalable data structures, hash tables double in size when they start becoming full, thus guaranteeing both average constant time access and linear size. */
typedef struct {
uintptr_t (*hash)(const void *info, const void *data);
int (*isEqual)(const void *info, const void *data1, const void *data2);
void (*free)(const void *info, void *data);
int style; /* reserved for future expansion; currently 0 */
} NXHashTablePrototype;
NSObjCRuntime.h----------------
#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
objc-exception.h---------------
typedef struct {
int version;
void (*throw_exc)(id); // version 0
void (*try_enter)(void *); // version 0
void (*try_exit)(void *); // version 0
id (*extract)(void *); // version 0
int (*match)(Class, id); // version 0
} objc_exception_functions_t;
objc-load.h-----------------
OBJC_EXPORT long objc_loadModules (
char *modlist[],
void *errStream,
void (*class_callback) (Class, Category),
/*headerType*/ struct mach_header **hdr_addr,
char *debug_file
) OBJC2_UNAVAILABLE;
OBJC_EXPORT int objc_loadModule (
char * moduleName,
void (*class_callback) (Class, Category),
int * errorCode
) OBJC2_UNAVAILABLE;
OBJC_EXPORT long objc_unloadModules(
void *errorStream, /* input (optional) */
void (*unloadCallback)(Class, Category) /* input (optional) */
)
message.h---------------
/// Specifies the superclass of an instance.
struct objc_super {
/// Specifies an instance of a class.
__unsafe_unretained id receiver;
/// Specifies the particular superclass of the instance to message.
#if !defined(__cplusplus) && !__OBJC2__
/* For compatibility with old objc-runtime.h header */
__unsafe_unretained Class class;
#else
__unsafe_unretained Class super_class;
#endif
/* super_class is the first class to search */
};
* These functions must be cast to an appropriate function pointer type
* before being called.
*/
#if !OBJC_OLD_DISPATCH_PROTOTYPES
OBJC_EXPORT void objc_msgSend(void /* id self, SEL op, ... */ )
__OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
OBJC_EXPORT void objc_msgSendSuper(void /* struct objc_super *super, SEL op, ... */ )
__OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
#else
oc语言基础整理的更多相关文章
- OC语言基础知识
OC语言基础知识 一.面向对象 OC语言是面向对象的,c语言是面向过程的,面向对象和面向过程只是解决问题的两种思考方式,面向过程关注的是解决问题涉及的步骤,面向对象关注的是设计能够实现解决问题所需功能 ...
- 李洪强iOS开发之OC语言基础知识
OC语言基础知识 一.面向对象 OC语言是面向对象的,c语言是面向过程的,面向对象和面向过程只是解决问题的两种思考方式,面向过程关注的是解决问题涉及的步骤,面向对象关注的是设计能够实现解决问题所需功能 ...
- 黑马程序员——OC语言基础语法 面向对象的思想
Java培训.Android培训.iOS培训..Net培训.期待与您交流! (以下内容是对黑马苹果入学视频的个人知识点总结)(一)基础语法 1)关键字 @interface.@implementati ...
- OC语言基础之代码的封装
1.封装的注意点 1: // 成员变量尽量不要用@public 2: // @public 3: int age; 1: //@public 2: // 只读(readonly):只允许外界访问我的n ...
- OC语言基础之NSArray
0.数组的分类 NSArray :不可变数组 NSMutableArray : 可变数组 1: // @[] 只创建不可变数组NSArray 2: /* 错误写法 3: NSMutableArray ...
- OC语言基础之NSString
1.字符串的创建 1: NSString *s1 = @"jack"; 2: 3: //NSString *s2 = [[NSString alloc] initWithStrin ...
- OC语言基础之利用property优化封装
1.property功能用法 1: // @property:可以自动生成某个成员变量的setter和getter声明 2: @property int age;//可以直接免去变量的声明 3: // ...
- OC语言基础之函数与方法
方法 1.对象方法都是以减号 - 2.对象方法的声明必须写在@interface和@end之间 对象方法的实现必须写在@implementation和@end之间 3.对象方法只能由对象来调用 ...
- OC语言基础之NSDictionary
1.NSDictionary字典的创建 1: // key value 2: // key -==> value 3: NSDictionary *dict = [NSDictionary di ...
随机推荐
- Java8 使用 stream().sorted()对List集合进行排序
集合对像定义 集合对象以学生类(StudentInfo)为例,有学生的基本信息,包括:姓名,性别,年龄,身高,生日几项. 使用stream().sorted()进行排序,需要该类实现 Comparab ...
- (PHP)redis Hash(哈希)操作
/** * * Hash操作 * 哈希操作 * 可理解为数据库操作 * */ //为user表中的字段赋值.成功返回1,失败返回0.若user表不存在会先创建表再赋值,若字段已存在会覆盖旧值. $re ...
- Spark内核概述
提交Spark程序的机器一般一定和Spark集群在同样的网络环境中(Driver频繁和Executors通信),且其配置和普通的Worker一致 1. Driver: 具有main方法的,初始化 Sp ...
- Solr 6.7学习笔记(02)-- 配置文件 managed-schema (schema.xml)(2)
接上篇 2. <dynamicField> 为满足前辍或后辍的一些字段提供统一的定义.如<dynamicField name="*_s" index=&qu ...
- 洛谷P1164 小A点菜(01背包求方案数)
P1164 小A点菜 题目背景 uim神犇拿到了uoi的ra(镭牌)后,立刻拉着基友小A到了一家……餐馆,很低端的那种. uim指着墙上的价目表(太低级了没有菜单),说:“随便点”. 题目描述 不过u ...
- java中pojo对象首字母大写导致无法赋值问题
命名规范(文末附有java命名规范)中指出,属性变量命名应采用驼峰命名的方式,即首字母小写,其他单词首字母大写: 但有时候我们对接三方的接口时,想要封装实体类来接受,但是发现接收到的参数的变量首字母是 ...
- 笔记-迎难而上之Java基础进阶1
Collection集合 数组的长度是固定的,集合的长度是可变的 数组中存储的是同一类型的元素,可以存储基本数据类型值.集合存储的都是对象.而且对象的类型可以不一致. 集合框架 import java ...
- 「模拟赛20180306」回忆树 memory LCA+KMP+AC自动机+树状数组
题目描述 回忆树是一棵树,树边上有小写字母. 一次回忆是这样的:你想起过往,触及心底--唔,不对,我们要说题目. 这题中我们认为回忆是这样的:给定 \(2\) 个点 \(u,v\) (\(u\) 可能 ...
- HDU2066-一个人的旅行
题目链接:点击打开链接 Problem Description 虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子, ...
- CPU死锁
https://blog.csdn.net/sunny05296/article/details/82858071 最近碰到了Centos7.2上终端打印soft lockup CPU死锁,系统无响应 ...