src/Card.c
[NalaBridge.git] / src / COO.h~
blobde4f420264879e5fdd24e783f674da17bf029800
1 /***************************************************************************
2  *   Copyright (C) 2008 by NalaGinrut   *
3  *   suimualatsuki@163.com   *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20 #ifndef COO_H
21 #define COO_H
23 #include <sys/types.h>
24 #include "COO_EXCEPTION.h"
25 //×¢Ò⣬ÀàÀïÃæʵ¼ÊûÓй¹Ô캯ÊýºÍÎö¹¹º¯Êý£¬
26 //ÎÒÔÚNewClass¹Ø¼üº¯ÊýÖÐͨ¹ýÖ´ÐÐÀàÐÍͬÃûº¯ÊýÀ´Ä£ÄâÕâÖÖÌØÐÔ£»
27 #define C_Class         struct
28 #define C_Interface     struct
30 #define TRUE    1
31 #define FALSE   0
33 #define OK      1
34 #define ERROR   0
36 #define YES     1
37 #define NO      0
39 #define Init    0
41 #define SetData(attribute,value)        do{                     \
42                                         attribute=value;        \
43                                         }while(0);
44 #define SetFunc(interface,func)         SetData(interface,func);
46 #define InitInterface(class,interface,name)     do{                             \
47                                                 class->interface=name;          \
48                                                 }while(0);
50 #define NewClass(type,class)    ({                      \
51                                 type(&class);           \
52                                 class;                  \
53                                 });
55 #define DeleteClass(class)                              \
56                                 do{                     \
57                                 class->DestoryClass();  \
58                                 }while(0);
60 #define NewAtrib(type,var)                              \
61                                 do{                     \
62                                 (attribute) var;        \
63                                 (type *) var->value;    \
64                                 var->get=attrib_get;    \
65                                 var->set=attrib_set;    \
66                                 }while(0);
68 #define IsEqu(x,y)      (x)==(y)
69 #define NoEqu(x,y)      (x)!=(y)
70 #define IsTrue(x)       (x)==(TRUE)
71 #define NoTrue(x)       (x)==(FALSE)
77 static void atrrib_get();
78 static void attrib_get();
80 //ÊôÐÔµÄʵÏÖ£»
81 typedef struct Attribute
82   {
83     void *value;
84     void (*get)();
85     void (*set)();
86   }
87 *attribute;
89 static void attrib_get()
91         
94 static void attrib_set()
96 //C_Class type class;
100 #endif // END OF COO_H;