// Doc type void RegisterDocType( LPCTSTR pDocType, LPCTSTR pIconFileName, LPCTSTR pOpenCommand) { KRegistryKey DocKey(HKEY_CLASSES_ROOT, pDocType); DocKey.Create(KEY_WRITE, 0, true); // Icon { KRegistryKey Key(DocKey, TEXT("DefaultIcon")); Key.Create(KEY_WRITE, 0, true); Key.WriteString(TEXT(""), pIconFileName); } // Open command { KRegistryKey Key(DocKey, TEXT("shell\\open\\command")); Key.Create(KEY_WRITE, 0, true); Key.WriteString(TEXT(""), pOpenCommand); } }
DocSet DocDir::Select(const DocQuery& query) { DocSet r; CppBase base; int i; for(i = 0; i < doc_base.GetCount(); i++) { String nameing = doc_base.GetKey(i); CppNamespace& mm = doc_base[i]; for(int i = 0; i < mm.GetCount(); i++) { String nesting = mm.GetKey(i); CppNest& nn = mm[i]; for(int i = 0; i < nn.GetCount(); i++) { CppItem& q = nn[i]; String item = nn.GetKey(i); if((query.name.IsEmpty() || query.name == q.name) && (query.text.IsEmpty() || Contains(item, query.text)) && (query.package.IsEmpty() || q.package.CompareNoCase(query.package) == 0) && (query.header.IsEmpty() || q.file.CompareNoCase(query.header) == 0)) { String pk; const Entry *e = Find(DocKey(nameing, nesting, item, query.lang), pk); int st = e ? e->type : UNDOCUMENTED; if((query.undocumented || e) && (st != IGNORED || query.ignored)) { DocItem& a = r.GetAdd(nameing).GetAdd(nesting).GetAdd(item); a.cppitem = &q; a.item = item; a.status = st; a.package = e ? pk : q.package; } } } } } for(i = 0; i < dir.GetCount(); i++) { ArrayMap<DocKey, Entry>& pk = dir[i]; String package = dir.GetKey(i); for(int j = 0; j < pk.GetCount(); j++) { const DocKey& k = pk.GetKey(j); if(k.lang == query.lang && query.name.IsEmpty() && (query.text.IsEmpty() || Contains(k.item, query.text)) && (query.package.IsEmpty() || package.CompareNoCase(query.package) == 0) && query.header.IsEmpty() && !Contains(r, k)) { DocItem& a = r.GetAdd(k.nameing).GetAdd(k.nesting).GetAdd(k.item); a.cppitem = NULL; a.item = k.item; int st = pk[j].type; a.status = st == NORMAL ? OBSOLETE : st == LINK ? OBSOLETELINK : st; a.package = package; } } } return r; }
bool DocDir::LoadDir(const String& package) { ArrayMap<DocKey, Entry>& p = dir.GetAdd(package); p.Clear(); LoadLinks(package); FileIn in(DocFile(package, "dir.h")); int q = 0; String d[3]; while(!in.IsEof()) { String l = in.GetLine(); if(memcmp(l, "#include ", 9) == 0) { const char *b = strchr(l, '/'); if(!b) return false; const char *e = strchr(b + 1, '\"'); if(!e) return false; String fn = String(b + 1, e); e = strchr(e, '/'); if(!e || e[1] != '/') return false; e += 2; int type = NORMAL; if(*e == '*') { type = EXTERNAL; e++; } Entry& w = p.GetAdd(DocKey(d[2], d[1], d[0], LNGFromText(e))); w.text = fn; w.type = type; q = 0; } if(l[0] == '/' && l[1] == '/') { if(q >= 3) return false; d[q] = l.Mid(2); q++; } } return true; }
int DocDir::GetStatus(const String& nameing, const String& nesting, const String& item, int lang) { return GetStatus(DocKey(nameing, nesting, item, lang)); }
void UnregisterDocType(LPCTSTR pDocType) { KRegistryKey DocKey(HKEY_CLASSES_ROOT, pDocType); DocKey.Delete(true, true); }