int DumpProperties(const wxClassInfo *info, wxString& infostr, bool recursive) { const wxPropertyInfo *prop; int pcount; for (prop = info->GetFirstProperty(), pcount = 0; prop; prop = prop->GetNext(), pcount++) { infostr << "\n\n [" << pcount+1 << "] Property: " << prop->GetName(); infostr << DumpPropertyInfo(prop, 4); } if (pcount == 0) infostr << "\n None"; if (recursive) { const wxClassInfo **parent = info->GetParents(); wxString str; for (int i=0; parent[i] != NULL; i++) { int ppcount = DumpProperties(parent[i], str, recursive); if (ppcount) { pcount += ppcount; infostr << "\n\n " << parent[i]->GetClassName() << " PARENT'S PROPERTIES:"; infostr << str; } } } return pcount; }
void DumpData(BaseEngine *engine, bool fullDump) { Out(UTF8_BOM); Out("<?xml version=\"1.0\"?>\n"); Out("<EngineDump>\n"); DumpProperties(engine); DumpToc(engine); for (int i = 1; i <= engine->PageCount(); i++) DumpPageContent(engine, i, fullDump); if (fullDump) DumpThumbnail(engine); Out("</EngineDump>\n"); }
wxString DumpClassInfo(const wxClassInfo *info, bool recursive) { wxString infostr; if (!info) return wxEmptyString; // basic stuff: infostr << "\n BASIC RTTI INFO ABOUT " << info->GetClassName(); infostr << "\n ================================================="; infostr << "\n Base class #1: " << DumpStr(info->GetBaseClassName1()); infostr << "\n Base class #2: " << DumpStr(info->GetBaseClassName2()); infostr << "\n Include file: " << DumpStr(info->GetIncludeName()); infostr << "\n Size: " << info->GetSize(); infostr << "\n Dynamic: " << (info->IsDynamic() ? "true" : "false"); // advanced stuff: infostr << "\n\n\n ADVANCED RTTI INFO ABOUT " << info->GetClassName(); infostr << "\n =================================================\n"; infostr << "\n PROPERTIES"; infostr << "\n -----------------------------------------"; int pcount = DumpProperties(info, infostr, recursive); infostr << "\n\n HANDLERS"; infostr << "\n -----------------------------------------"; int hcount = DumpHandlers(info, infostr, recursive); if (pcount+hcount == 0) infostr << "\n\n no advanced info\n"; else { infostr << "\n\n Total count of properties: " << pcount; infostr << "\n Total count of handlers: " << hcount << "\n"; } return infostr; }
/*---------------------------------------------------------------------- | main +---------------------------------------------------------------------*/ int main(int argc, char** argv) { ATX_Properties* properties; ATX_PropertyListener* listener0; ATX_PropertyListenerHandle listener0_handle = NULL; ATX_PropertyListener* listener1; ATX_PropertyListenerHandle listener1_handle = NULL; ATX_PropertyListener* listener2; ATX_PropertyListenerHandle listener2_handle = NULL; unsigned int i; unsigned int j; ATX_Result result; ATX_COMPILER_UNUSED(argc); ATX_COMPILER_UNUSED(argv); ATX_Debug("PropertiesTest -- Start\n"); Listener_Create("Listener 0", &listener0); Listener_Create("Listener 1", &listener1); Listener_Create("Listener 2", &listener2); result = ATX_Properties_Create(&properties); Properties[2].value.fp = 0.123456789f; j = 0; for (i=0; i<10000; i++) { DumpProperties(properties); if (rand()&0x4) { ATX_Debug("** setting property '%s' [%d]\n", Properties[j].name, j); result = ATX_Properties_SetProperty(properties, Properties[j].name, Properties[j].type, &Properties[j].value); ATX_Debug("(%d)\n", result); } else { ATX_Debug("&& unsetting property '%s' [%d]\n", Properties[j].name, j); result = ATX_Properties_UnsetProperty(properties, Properties[j].name); ATX_Debug("(%d)\n", result); } j++; if (j >= sizeof(Properties)/sizeof(Properties[0])) { j = 0; } if (rand()%7 == 0) { int l = rand()%3; ATX_PropertyListener* listener; ATX_PropertyListenerHandle* listener_handle; if (l == 0) { listener = listener0; listener_handle = &listener0_handle; } else if (l == 1) { listener = listener1; listener_handle = &listener1_handle; } else { listener = listener2; listener_handle = &listener2_handle; } if (*listener_handle) { result = ATX_Properties_RemoveListener(properties, *listener_handle); ATX_Debug("## removed listener %d [%d]\n", l, result); } result = ATX_Properties_AddListener(properties, Properties[j].name, listener, listener_handle); ATX_Debug("## added listener %d on %s [%d]\n", l, Properties[j].name, result); } ATX_Debug("++++++++++++++++++++++++++++++++++++++++++++\n"); } ATX_DESTROY_OBJECT(properties); ATX_DESTROY_OBJECT(listener0); ATX_DESTROY_OBJECT(listener1); ATX_DESTROY_OBJECT(listener2); ATX_Debug("PropertiesTest -- End\n"); return 0; }
STDAPI CPropertyMonitorTextService::OnEndEdit(ITfContext *pContext, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord) { DumpProperties(pContext); return S_OK; }