IOS 바 텀 데이터 구조

3331 단어
클래스 데이터 구조
Class (포인터)
typedef struct objc_class *Class;

/*
                   ,          .                ,           .  ,         .     "char* const"                  "super_class"
*/
struct objc_class {
  struct objc_class*  class_pointer;    /*        . */
  struct objc_class*  super_class;      /*        .   NSObject   NULL.*/
  const char*         name;             /*     . */
  long                version;          /*   . */
  unsigned long       info;             /*     .            . */
  long                instance_size;    /*      .               */
#ifdef _WIN64
  long pad;
#endif
  struct objc_ivar_list* ivars;         /*                 . NULL        .        . */
  struct objc_method_list*  methods;    /*            . */
  struct sarray *    dtable;            /*          . */
  struct objc_class* subclass_list;     /*      */
  struct objc_class* sibling_class;
  struct objc_protocol_list *protocols; /*          */
  void* gc_object_type;
};

방법 (포인터)
typedef struct objc_method *Method;

/*                             .
                        ,               .        ,            */
struct objc_method
{
  SEL         method_name;  /*            .            `char*`,        ,            SEL    */
  const char* method_types; /*          .             .                 .*/
  IMP         method_imp;   /*          . */
};```

## Ivar(  )

```objc
typedef struct objc_ivar *Ivar;

/*                                 */
struct objc_ivar
{
  const char* ivar_name;  /*         . */
  const char* ivar_type;  /*        .       . */
  int        ivar_offset; /*              */
};```

##Category(  )

```objc
typedef struct objc_category *Category;

/*                  .                    ,        */
struct objc_category
{
  const char*   category_name;                /*    .           */
  const char*   class_name;                   /*    */
  struct objc_method_list  *instance_methods; /*            . NULL        . */
  struct objc_method_list *class_methods;     /*           . NULL       . */
  struct objc_protocol_list *protocols;       /*         */
};

objc_property_t
typedef struct objc_property *objc_property_t;

IMP
id (*IMP)(id, SEL, ...)

SEL
typedef struct objc_selector *SEL;

struct objc_selector
{
  void *sel_id;
  const char *sel_types;
};

objc_method_list
struct objc_method_list
{
  struct objc_method_list*  method_next; /*                    */
  int            method_count;            /*            */
  struct objc_method method_list[1];      /*         */
};

objc_cache
struct objc_cache
{
    unsigned int mask;
    unsigned int occupied;
    Method buckets[1];
};

objc_protocol_list
struct objc_protocol_list
{
  struct objc_protocol_list *next;
  size_t count;
  struct objc_protocol *list[1];
};


2. 실례 적 인 데이터 구조
id
typedef struct objc_object *id;```

## objc_object

```objc
struct objc_object
{
  //            .        ,         .
  Class isa;
};```

## objc_super
```objc
struct objc_super
{
  id    self;        /*         */
  Class super_class; /*         */
};

좋은 웹페이지 즐겨찾기