GME
13
|
00001 #include "stdafx.h" 00002 00003 void CreateCoreMetaProject(CComPtr<ICoreMetaProject> &project, bool v2 /*=false*/) 00004 { 00005 ASSERT( project == NULL ); 00006 00007 COMTHROW( project.CoCreateInstance(L"Mga.CoreMetaProject") ); 00008 00009 COMTHROW( project->put_Token(PutInBstr("MgaProject")) ); 00010 COMTHROW( project->put_Name(PutInBstr("MgaProject")) ); 00011 00012 GUID guid = {0x028F7444,0x2E51,0x11D3,{0xB3,0x6D,0x00,0x62,0x08,0x2D,0xF8,0x74}}; 00013 COMTHROW( project->put_GUID(PutInVariant(guid)) ); 00014 00015 // ------- Macros 00016 00017 CComObjPtr<ICoreMetaObject> object; 00018 00019 #define CREATE_OBJECT(metaid, token, name) \ 00020 object.Release(); \ 00021 COMTHROW( project->AddObject(metaid, \ 00022 PutInBstr(token), PutInBstr(name), PutOut(object)) ); 00023 00024 #define CREATE_POINTER(metaid, token, name) \ 00025 ASSERT(metaid == ATTRID_FATHER || metaid >= ATTRID_REF_MIN);\ 00026 COMTHROW( object->AddAttribute((metaid), \ 00027 PutInBstr(token), PutInBstr(name), VALTYPE_POINTER, NULL) ); 00028 00029 #define CREATE_COLLECTION(metaid, token, name) \ 00030 COMTHROW( object->AddAttribute((metaid) + ATTRID_COLLECTION, \ 00031 PutInBstr(token), PutInBstr(name), VALTYPE_COLLECTION, NULL) ); 00032 00033 #define CREATE_ATTRIBUTE(metaid, token, name, valtype) \ 00034 ASSERT(metaid < ATTRID_REF_MIN);\ 00035 COMTHROW( object->AddAttribute((metaid), \ 00036 PutInBstr(token), PutInBstr(name), valtype, NULL) ); 00037 00038 #define CLSID_PUSH(clsid) \ 00039 { CComVariant id; CopyTo(clsid, id); COMTHROW( object->AddClassID(id) ); } 00040 00045 00046 #define COMMON_DEF \ 00047 CREATE_ATTRIBUTE(ATTRID_LOCK, "ObjLock", "Object Lock", VALTYPE_LOCK); 00048 00049 //ROOT 00050 CREATE_OBJECT(DTID_ROOT, "Root", "Template For RootObject"); 00051 COMMON_DEF 00052 CREATE_COLLECTION(ATTRID_FATHER, "DummyFather", "Dummy Father"); 00053 CREATE_POINTER(ATTRID_FATHER, "DummyChildren", "Dummy Children"); 00054 00055 CREATE_ATTRIBUTE(ATTRID_NAME, "Name", "Project Name", VALTYPE_STRING); 00056 CREATE_ATTRIBUTE(ATTRID_CDATE, "CDate", "Create Date", VALTYPE_DATE); 00057 CREATE_ATTRIBUTE(ATTRID_MDATE, "MDate", "Modification Date", VALTYPE_DATE); 00058 CREATE_ATTRIBUTE(ATTRID_CREATOR, "Author", "Created by", VALTYPE_STRING); 00059 CREATE_ATTRIBUTE(ATTRID_GUID, "GUID", "GUID", VALTYPE_BINARY); 00060 CREATE_ATTRIBUTE(ATTRID_VERSION, "Version", "Version", VALTYPE_STRING); 00061 CREATE_ATTRIBUTE(ATTRID_PARGUID, "ParadigmGUID", "Paradigm GUID", VALTYPE_BINARY); 00062 CREATE_ATTRIBUTE(ATTRID_PARVERSION, "ParadigmVersion", "Paradigm Version", VALTYPE_STRING); 00063 CREATE_ATTRIBUTE(ATTRID_PARADIGM, "ExtParadigm", "External Paradigm",VALTYPE_STRING); 00064 CREATE_ATTRIBUTE(ATTRID_EXTDATA, "Comment", "Project Comments", VALTYPE_STRING); 00065 CREATE_ATTRIBUTE(ATTRID_MGAVERSION, "MGA_Version", "MGA Version Code", VALTYPE_LONG); 00066 CREATE_COLLECTION(ATTRID_PARENT, "Children", "Child Objects"); 00067 //CONSTRAINT 00068 CREATE_OBJECT(DTID_CONSTRAINT, "Constraint", "Template For Constraint"); 00069 COMMON_DEF 00070 00071 CREATE_ATTRIBUTE(ATTRID_NAME, "Name", "Constraint Name", VALTYPE_STRING); 00072 CREATE_ATTRIBUTE(ATTRID_CONSTROCL, "ConstraintOCL", "Constraint Text",VALTYPE_STRING); 00073 CREATE_ATTRIBUTE(ATTRID_CONSTRPRIORITY, "ConstrPriority", "Constraint Priority",VALTYPE_STRING); 00074 CREATE_POINTER(ATTRID_CONSTROWNER, "ConstraintOf", "Owner Kind"); 00075 00076 // Old REGNODE format. Upgraded to new format in CoreBinFile 00077 //REGNODE 00078 // CREATE_OBJECT(DTID_REGNODE, "RegNode", "Template For Registry Node"); 00079 // COMMON_DEF 00080 // 00081 // CREATE_ATTRIBUTE(ATTRID_NAME, "Name", "RegNode Name", VALTYPE_STRING); 00082 // CREATE_ATTRIBUTE(ATTRID_REGFLAGS, "RegistryFlags", "Registry Flags", VALTYPE_LONG); 00083 // CREATE_POINTER(ATTRID_REGNOWNER, "RegNodeOf", "Parent Object/Regnode"); 00084 // CREATE_COLLECTION(ATTRID_REGNOWNER, "RegNodes", "Registry Nodes"); 00085 // CREATE_ATTRIBUTE(ATTRID_REGNODEVALUE, "RegNodeValue", "RegNode Value",VALTYPE_STRING); 00086 // CREATE_POINTER(ATTRID_XREF, "FCOref", "Referenced FCO"); 00087 00091 00092 #define GUID_ATTRS_DEFS \ 00093 { CREATE_ATTRIBUTE(ATTRID_GUID1, "GUID1", "FCO GUID1", VALTYPE_LONG);\ 00094 CREATE_ATTRIBUTE(ATTRID_GUID2, "GUID2", "FCO GUID2", VALTYPE_LONG);\ 00095 CREATE_ATTRIBUTE(ATTRID_GUID3, "GUID3", "FCO GUID3", VALTYPE_LONG);\ 00096 CREATE_ATTRIBUTE(ATTRID_GUID4, "GUID4", "FCO GUID4", VALTYPE_LONG);} 00097 00098 #define STATUS_ATTR_DEF CREATE_ATTRIBUTE(ATTRID_FILESTATUS, "fstate", "Multiuser File Status", VALTYPE_LONG); 00099 00100 //FOLDER 00101 CREATE_OBJECT(DTID_FOLDER, "Folder", "Template For Folder"); 00102 COMMON_DEF 00103 00104 CREATE_ATTRIBUTE(ATTRID_CDATE, "CDate", "Create Date", VALTYPE_DATE); 00105 CREATE_ATTRIBUTE(ATTRID_MDATE, "MDate", "Modification Date", VALTYPE_DATE); 00106 CREATE_ATTRIBUTE(ATTRID_NAME, "Name", "Folder Name", VALTYPE_STRING); 00107 CREATE_ATTRIBUTE(ATTRID_META, "Meta", "Meta Identifier",VALTYPE_METAREF); 00108 CREATE_ATTRIBUTE(ATTRID_LASTRELID, "LastRelID", "Last Child RelID", VALTYPE_LONG); 00109 CREATE_ATTRIBUTE(ATTRID_RELID, "RelID", "RelID", VALTYPE_LONG); 00110 CREATE_POINTER(ATTRID_PARENT, "Parent", "Parent Object"); 00111 CREATE_COLLECTION(ATTRID_PARENT, "Children", "Child Objects"); 00112 CREATE_COLLECTION(ATTRID_CONSTROWNER, "Constraints", "Constraints"); 00113 //CREATE_COLLECTION(ATTRID_REGNOWNER, "RegNodes", "Registry Nodes"); 00114 CREATE_ATTRIBUTE(ATTRID_REGNODE, "RegNodes", "Registry Nodes", VALTYPE_DICT); 00115 CREATE_ATTRIBUTE(ATTRID_PERMISSIONS, "Permissions", "Permissions", VALTYPE_LONG); 00116 00117 if( v2) GUID_ATTRS_DEFS; 00118 if( v2) STATUS_ATTR_DEF; 00119 CLSID_PUSH( __uuidof(MgaO) ); 00120 00121 //FCO 00122 #define FCO_DEF \ 00123 COMMON_DEF\ 00124 CREATE_ATTRIBUTE(ATTRID_NAME, "Name", "FCO Name", VALTYPE_STRING);\ 00125 CREATE_ATTRIBUTE(ATTRID_RELID, "RelID", "RelID", VALTYPE_LONG);\ 00126 CREATE_ATTRIBUTE(ATTRID_META, "Meta", "Meta Identifier",VALTYPE_METAREF);\ 00127 CREATE_ATTRIBUTE(ATTRID_ROLEMETA, "RoleMeta", "Role Meta Identifier",VALTYPE_METAREF);\ 00128 CREATE_POINTER(ATTRID_FCOPARENT, "Parent", "Parent Object");\ 00129 CREATE_COLLECTION(ATTRID_CONSTROWNER, "Constraints", "Constraints");\ 00130 CREATE_ATTRIBUTE(ATTRID_REGNODE, "RegNodes", "Registry Nodes", VALTYPE_DICT); \ 00131 CREATE_COLLECTION(ATTRID_REFERENCE, "References", "Referenced by");\ 00132 CREATE_COLLECTION(ATTRID_XREF, "XReferences", "Cross refs");\ 00133 CREATE_COLLECTION(ATTRID_ATTRPARENT,"Attributes", "Attributes");\ 00134 CREATE_POINTER(ATTRID_DERIVED, "BaseType", "BaseType");\ 00135 CREATE_COLLECTION(ATTRID_DERIVED, "SubTypes", "SubTypes/Instances"); \ 00136 CREATE_ATTRIBUTE(ATTRID_PERMISSIONS, "Permissions", "Permissions", VALTYPE_LONG); 00137 00138 //MODEL 00139 CREATE_OBJECT(DTID_MODEL, "Model", "Template For Model"); 00140 FCO_DEF 00141 00142 CREATE_ATTRIBUTE(ATTRID_CDATE, "CDate", "Create Date", VALTYPE_DATE); 00143 CREATE_ATTRIBUTE(ATTRID_MDATE, "MDate", "Modification Date", VALTYPE_DATE); 00144 CREATE_COLLECTION(ATTRID_PARENT, "Children", "Child Objects"); 00145 CREATE_ATTRIBUTE(ATTRID_LASTRELID, "LastRelID", "Last Child RelID", VALTYPE_LONG); 00146 00147 if( v2) GUID_ATTRS_DEFS; 00148 if( v2) STATUS_ATTR_DEF; 00149 00150 CLSID_PUSH( __uuidof(MgaO) ); 00151 00152 //ATOM 00153 CREATE_OBJECT(DTID_ATOM, "Atom", "Template For Atom"); 00154 FCO_DEF 00155 00156 if( v2) GUID_ATTRS_DEFS; 00157 CLSID_PUSH( __uuidof(MgaO) ); 00158 00159 //REFERENCE 00160 CREATE_OBJECT(DTID_REFERENCE, "Reference", "Template For Reference"); 00161 FCO_DEF 00162 00163 CREATE_POINTER(ATTRID_REFERENCE, "Refers", "Referenced FCO"); 00164 CREATE_COLLECTION(ATTRID_SEGREF, "Segments", "Connection Segments"); 00165 CREATE_POINTER(ATTRID_MASTEROBJ, "MasterObj", "Master Object"); 00166 CREATE_COLLECTION(ATTRID_MASTEROBJ, "MasterOf", "Master Of Objects"); 00167 CREATE_ATTRIBUTE(ATTRID_REFASPECT, "RefAspect", "Ref Aspect", VALTYPE_METAREF); 00168 00169 if( v2) GUID_ATTRS_DEFS; 00170 CLSID_PUSH( __uuidof(MgaO) ); 00171 00172 //SET 00173 CREATE_OBJECT(DTID_SET, "Set", "Template For Set"); 00174 FCO_DEF 00175 00176 00177 CREATE_COLLECTION(ATTRID_SETMEMBER, "Members", "Set Members"); 00178 00179 if( v2) GUID_ATTRS_DEFS; 00180 CLSID_PUSH( __uuidof(MgaO) ); 00181 00182 00183 //SETNODE 00184 CREATE_OBJECT(DTID_SETNODE, "SetNode", "Template For Set Member"); 00185 COMMON_DEF 00186 00187 CREATE_POINTER(ATTRID_SETMEMBER, "SetOwner", "Owner Set"); 00188 CREATE_POINTER(ATTRID_XREF, "FCOref", "Member FCO"); 00189 CREATE_POINTER(ATTRID_MASTEROBJ, "MasterObj", "Master Object"); 00190 CREATE_COLLECTION(ATTRID_MASTEROBJ, "MasterOf", "Master Of Objects"); 00191 00192 00193 //CONNECTION 00194 CREATE_OBJECT(DTID_CONNECTION, "Connection", "Template For Connection"); 00195 FCO_DEF 00196 00197 CREATE_COLLECTION(ATTRID_CONNROLE, "ConnRoles", "ConnRoles"); 00198 00199 if( v2) GUID_ATTRS_DEFS; 00200 CLSID_PUSH( __uuidof(MgaO) ); 00201 00202 //CONNECTION ROLE 00203 CREATE_OBJECT(DTID_CONNROLE, "ConnRole", "Template for Connection Role"); 00204 COMMON_DEF 00205 00206 CREATE_ATTRIBUTE(ATTRID_NAME, "Name", "Connrole Name",VALTYPE_STRING); 00207 CREATE_POINTER(ATTRID_XREF, "FCOref", "Connected FCO"); 00208 CREATE_POINTER(ATTRID_CONNROLE, "CRoleParent", "Owner of ConnRole"); 00209 CREATE_COLLECTION(ATTRID_CONNSEG, "ConnSegments", "Connection Segments"); 00210 CREATE_POINTER(ATTRID_MASTEROBJ, "MasterObj", "Master Object"); 00211 CREATE_COLLECTION(ATTRID_MASTEROBJ, "MasterOf", "Master Of Objects"); 00212 00213 //CONNECTION ROLE SEGMENT 00214 CREATE_OBJECT(DTID_CONNROLESEG, "ConnRoleSeg", "Template for ConnRole Segment"); 00215 COMMON_DEF 00216 00217 CREATE_ATTRIBUTE(ATTRID_SEGORDNUM, "SegOrdNum", "Segment Order 1,2,3 ", VALTYPE_LONG); 00218 CREATE_POINTER(ATTRID_CONNSEG, "ConnSRole", "Owner Connection Role"); 00219 CREATE_POINTER(ATTRID_SEGREF, "ReferenceObj", "Reference Involved"); 00220 00221 00222 // ATTRIBUTE 00223 #define ATTR_DEF \ 00224 COMMON_DEF\ 00225 CREATE_ATTRIBUTE(ATTRID_META, "Meta", "Meta Identifier",VALTYPE_METAREF);\ 00226 CREATE_POINTER(ATTRID_ATTRPARENT,"Owner", "Owner FCO"); 00227 00228 //STRATTR 00229 CREATE_OBJECT(DTID_STRATTR, "StrAttr", "String Attribute"); 00230 ATTR_DEF 00231 CREATE_ATTRIBUTE(ATTRID_STRATTR, "StrValue", "String Value",VALTYPE_STRING); 00232 00233 //INTATTR 00234 CREATE_OBJECT(DTID_INTATTR, "IntAttr", "LongInt Attribute"); 00235 ATTR_DEF 00236 CREATE_ATTRIBUTE(ATTRID_INTATTR, "IntValue", "LongInt Value",VALTYPE_LONG); 00237 00238 //FLOATATTR 00239 CREATE_OBJECT(DTID_FLOATATTR, "FloatAttr", "Float Attribute"); 00240 ATTR_DEF 00241 CREATE_ATTRIBUTE(ATTRID_FLOATATTR, "FloatValue", "Float Value",VALTYPE_REAL); 00242 00243 //BOOLATTR 00244 CREATE_OBJECT(DTID_BOOLATTR, "BoolAttr", "Bool Attribute"); 00245 ATTR_DEF 00246 CREATE_ATTRIBUTE(ATTRID_BOOLATTR, "BoolValue", "Bool Value",VALTYPE_LONG); 00247 00248 //REFATTR 00249 CREATE_OBJECT(DTID_REFATTR, "RefAttr", "Reference Attribute"); 00250 ATTR_DEF 00251 CREATE_POINTER(ATTRID_XREF, "FCOref", "Referenced FCO"); 00252 00253 } 00254 00255