00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016
00017
00025 #include <gobjconfig.h>
00026
00027 #ifndef gobj_lib_model_h
00028 #define gobj_lib_model_h
00029
00030 #include <gobj/types.h>
00031 #include <gobj/context.h>
00032 #include <gobj/id.h>
00033 #include <gobj/view.h>
00034 #include <gobj/nativemgr.h>
00035 #include <gobj/object.h>
00036 #include <gobj/nativetypes.h>
00037
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 #if 0
00042 }
00043 #endif
00044
00045
00055 Gj_Model* Gj_model_new(Gj_Ctx* ctx, char* name, Gj_Id* id, Gj_Model* hardinheritance);
00056
00057
00064 Gj_Model* Gj_model_create(Gj_Ctx* ctx, Gj_Stream* stream);
00065
00066
00073 int Gj_model_write(Gj_Ctx* ctx, Gj_Model* model, Gj_Stream* stream);
00074
00075
00084 int Gj_model_delete(Gj_Ctx* ctx, Gj_Model* ptr);
00085
00086
00095 int Gj_model_register(Gj_Ctx* ctx, Gj_Model* model);
00096
00097
00106 int Gj_model_finish(Gj_Ctx* ctx, Gj_Model* model);
00107
00108
00113 Gj_Bool Gj_model_isRegistered(Gj_Model* model);
00114
00115
00120 Gj_Bool Gj_model_isFinished(Gj_Model* model);
00121
00122
00127 Gj_Bool Gj_model_hasFixedProperties(Gj_Model* model);
00128
00129
00138 Gj_Id* Gj_model_getId(Gj_Ctx* ctx, Gj_Model* model);
00139
00140
00147 char* Gj_model_getName(Gj_Model* model);
00148
00149
00154 void Gj_model_instanceCreated(Gj_Model* model);
00155
00156
00161 void Gj_model_instanceDeleted(Gj_Model* model);
00162
00163
00170 int Gj_model_getPropertyCount(Gj_Ctx* ctx, Gj_Model* model);
00171
00172
00179 int Gj_model_getPropertyNumber(Gj_Ctx* ctx, Gj_Model* model, char* name);
00180
00181
00188 Gj_Id* Gj_model_getPropertyType(Gj_Ctx* ctx, Gj_Model* model, int index);
00189
00190
00199 int Gj_model_getPropertyName(Gj_Ctx* ctx, Gj_Model* model, int index, char** name);
00200
00201
00212 int Gj_model_addProperty(Gj_Ctx* ctx, Gj_Model* model, char* name, Gj_Id* type, Gj_Object* std);
00213
00214
00223 int gj_model_fillProperties(Gj_Ctx* ctx, Gj_Model* model, Gj_Object** list);
00224
00225
00235 int Gj_model_addView(Gj_Ctx* ctx, Gj_Model* model, Gj_View* view);
00236
00237
00244 int Gj_model_deleteViews(Gj_Ctx* ctx, Gj_Model* model);
00245
00246
00251 int Gj_model_inherit(Gj_Ctx* ctx, Gj_Model* model, Gj_Id* id);
00252
00253
00260 int Gj_model_isCompatible(Gj_Ctx* ctx, Gj_Model* model, Gj_Id* type, Gj_Bool* flag);
00261
00262
00269 int Gj_model_setChildType(Gj_Ctx* ctx, Gj_Model* model, Gj_Id* type);
00270
00271
00280 Gj_Id* Gj_model_getChildType(Gj_Ctx* ctx, Gj_Model* model);
00281
00282
00291 int Gj_model_setVaccessfunc(Gj_Ctx* ctx, Gj_Model* model, Gj_Path* vaccessfunc);
00292
00293
00300 int Gj_model_setNativetype(Gj_Ctx* ctx, Gj_Model* model, Gj_Nativetype type);
00301
00302
00307 Gj_Nativetype Gj_model_getNativetype(Gj_Model* model);
00308
00309
00318 Gj_Id* Gj_model_getViewId(Gj_Ctx* ctx, Gj_Model* model, char* name);
00319
00320
00329 Gj_View* Gj_model_getView(Gj_Ctx* ctx, Gj_Model* model, Gj_Id* id);
00330
00331
00340 Gj_View* Gj_model_getConverter(Gj_Ctx* ctx, Gj_Model* model, Gj_Id* type);
00341
00342
00351 Gj_View* Gj_model_nextView(Gj_Model* model, void** ptr);
00352
00353
00354 #ifdef GJ_STDIO
00355 #include <stdio.h>
00362 void Gj_model_dump(Gj_Ctx* ctx, Gj_Model* model, FILE* s, int* indent);
00363 #endif
00364
00365
00372 struct gj_Property_struct;
00373
00374
00381 typedef struct gj_Property_struct {
00382
00383 char* name;
00384
00385 Gj_Id type;
00386
00387 Gj_Object* std;
00388
00389 struct gj_Property_struct* next;
00390
00391 } gj_Property;
00392
00393
00400 struct gj_Inheritance_struct;
00401
00402
00409 typedef struct gj_Inheritance_struct {
00410
00411 Gj_Id id;
00412
00413 struct gj_Inheritance_struct* next;
00414
00415 } gj_Inheritance;
00416
00417
00424 struct Gj_Model_struct {
00425
00426 Gj_Bool fixedProperties;
00427
00428 Gj_Id id;
00429
00430 char* name;
00431
00432 Gj_Bool registered;
00433
00434 Gj_Bool finished;
00435
00436 int instancecount;
00437
00438 gj_Property* properties;
00439
00440 Gj_Id childtype;
00441
00442 gj_Inheritance* inheritances;
00443
00444 Gj_View* views;
00445
00446 Gj_Nativetype nativetype;
00447
00448 Gj_Path* vaccessfuncname;
00449
00450 Gj_Vaccessfunc vaccessfunc;
00451
00452 };
00453
00454
00455 #ifdef __cplusplus
00456 }
00457 #endif
00458
00459 #endif
00460