Skip to main content

The DocSets Class Reference

A class that generates docset files. More...

Declaration

class DocSets { ... }

Included Headers

#include <src/docsets.h>

Base class

classIndexIntf

Abstract interface for index generators. More...

Public Constructors Index

DocSets ()

Public Destructor Index

~DocSets ()

Public Member Functions Index

voidinitialize ()
voidfinalize ()
voidincContentsDepth ()
voiddecContentsDepth ()
voidaddContentsItem (bool isDir, const QCString &name, const QCString &ref, const QCString &file, const QCString &anchor, bool separateIndex, bool addToNavIndex, const Definition *def, const QCString &nameAsHtml)
voidaddIndexItem (const Definition *context, const MemberDef *md, const QCString &sectionAnchor, const QCString &title)
voidaddIndexFile (const QCString &name)
voidaddImageFile (const QCString &)
voidaddStyleSheetFile (const QCString &)

Private Member Functions Index

voidwriteToken (TextStream &t, const Definition *d, const QCString &type, const QCString &lang, const QCString &scope=QCString(), const QCString &anchor=QCString(), const QCString &decl=QCString())

Private Member Attributes Index

std::unique_ptr< Private >p

Description

A class that generates docset files.

These files can be used to create context help for use within Apple's Xcode 3.0 development environment

Definition at line 35 of file docsets.h.

Public Constructors

DocSets()

DocSets::DocSets ()

Declaration at line 38 of file docsets.h, definition at line 44 of file docsets.cpp.

44DocSets::DocSets() : p(std::make_unique<Private>()) {}

Reference p.

Referenced by ~DocSets.

Public Destructor

~DocSets()

DocSets::~DocSets ()

Definition at line 39 of file docsets.h.

Reference DocSets.

Public Member Functions

addContentsItem()

void DocSets::addContentsItem (bool isDir, const QCString & name, const QCString & ref, const QCString & file, const QCString & anchor, bool separateIndex, bool addToNavIndex, const Definition * def, const QCString & nameAsHtml)
virtual

Declaration at line 46 of file docsets.h, definition at line 225 of file docsets.cpp.

226 const QCString &name,
227 const QCString &ref,
228 const QCString &file,
229 const QCString &anchor,
230 bool /* separateIndex */,
231 bool /* addToNavIndex */,
232 const Definition * /*def*/,
233 const QCString & /* nameAsHtml */)
234{
235 (void)isDir;
236 //printf("DocSets::addContentsItem(%s) depth=%zu\n",name,p->indentStack.size());
237 if (ref==nullptr)
238 {
239 if (!p->indentStack.top())
240 {
241 p->nts << p->indent() << " </Node>\n";
242 }
243 p->indentStack.top()=false;
244 p->nts << p->indent() << " <Node>\n";
245 p->nts << p->indent() << " <Name>" << convertToXML(name) << "</Name>\n";
246 if (!file.isEmpty() && file[0]=='^') // URL marker
247 {
248 p->nts << p->indent() << " <URL>" << convertToXML(&file[1])
249 << "</URL>\n";
250 }
251 else // relative file
252 {
253 p->nts << p->indent() << " <Path>";
254 if (!file.isEmpty() && file[0]=='!') // user specified file
255 {
256 p->nts << convertToXML(&file[1]);
257 }
258 else if (!file.isEmpty()) // doxygen generated file
259 {
260 QCString fn = file;
262 p->nts << fn;
263 }
264 p->nts << "</Path>\n";
265 if (!file.isEmpty() && !anchor.isEmpty())
266 {
267 p->nts << p->indent() << " <Anchor>" << anchor << "</Anchor>\n";
268 }
269 }
270 }
271}

References addHtmlExtensionIfMissing, convertToXML, QCString::isEmpty and p.

addImageFile()

void DocSets::addImageFile (const QCString &)
inline virtual

Definition at line 59 of file docsets.h.

59 void addImageFile(const QCString &) {}

addIndexFile()

void DocSets::addIndexFile (const QCString & name)
virtual

Declaration at line 58 of file docsets.h, definition at line 511 of file docsets.cpp.

512{
513 (void)name;
514}

addIndexItem()

void DocSets::addIndexItem (const Definition * context, const MemberDef * md, const QCString & sectionAnchor, const QCString & title)
virtual

Declaration at line 56 of file docsets.h, definition at line 273 of file docsets.cpp.

273void DocSets::addIndexItem(const Definition *context,const MemberDef *md,
274 const QCString &,const QCString &)
275{
276 if (md==nullptr && context==nullptr) return;
277
278 const FileDef *fd = nullptr;
279 const ClassDef *cd = nullptr;
280 const NamespaceDef *nd = nullptr;
281
282 if (md)
283 {
284 fd = md->getFileDef();
285 cd = md->getClassDef();
286 nd = md->getNamespaceDef();
287 if (!md->isLinkable()) return; // internal symbol
288 }
289
290 QCString scope;
291 QCString type;
292 QCString decl;
293
294 // determine language
295 QCString lang;
296 SrcLangExt langExt = SrcLangExt::Cpp;
297 if (md)
298 {
299 langExt = md->getLanguage();
300 }
301 else if (context)
302 {
303 langExt = context->getLanguage();
304 }
305 switch (langExt)
306 {
307 case SrcLangExt::Cpp:
308 case SrcLangExt::ObjC:
309 {
310 if (md && (md->isObjCMethod() || md->isObjCProperty()))
311 lang="occ"; // Objective C/C++
312 else if (fd && fd->name().lower().endsWith(".c"))
313 lang="c"; // Plain C
314 else if (cd==nullptr && nd==nullptr)
315 lang="c"; // Plain C symbol outside any class or namespace
316 else
317 lang="cpp"; // C++
318 }
319 break;
320 case SrcLangExt::IDL: lang="idl"; break; // IDL
321 case SrcLangExt::CSharp: lang="csharp"; break; // C#
322 case SrcLangExt::PHP: lang="php"; break; // PHP4/5
323 case SrcLangExt::D: lang="d"; break; // D
324 case SrcLangExt::Java: lang="java"; break; // Java
325 case SrcLangExt::JS: lang="javascript"; break; // JavaScript
326 case SrcLangExt::Python: lang="python"; break; // Python
327 case SrcLangExt::Fortran: lang="fortran"; break; // Fortran
328 case SrcLangExt::VHDL: lang="vhdl"; break; // VHDL
329 case SrcLangExt::XML: lang="xml"; break; // DBUS XML
330 case SrcLangExt::SQL: lang="sql"; break; // Sql
331 case SrcLangExt::Markdown:lang="markdown"; break; // Markdown
332 case SrcLangExt::Slice: lang="slice"; break; // Slice
333 case SrcLangExt::Lex: lang="lex"; break; // Lex
334 case SrcLangExt::Unknown: lang="unknown"; break; // should not happen!
335 }
336
337 if (context && md)
338 {
339 switch (md->memberType())
340 {
342 type="macro"; break;
344 if (cd && (cd->compoundType()==ClassDef::Interface ||
346 {
347 if (md->isStatic())
348 type="clm"; // class member
349 else
350 type="instm"; // instance member
351 }
352 else if (cd && cd->compoundType()==ClassDef::Protocol)
353 {
354 if (md->isStatic())
355 type="intfcm"; // interface class member
356 else
357 type="intfm"; // interface member
358 }
359 else
360 type="func";
361 break;
363 type="data"; break;
365 type="tdef"; break;
367 type="enum"; break;
369 type="econst"; break;
370 //case MemberDef::Prototype:
371 // type="prototype"; break;
373 type="signal"; break;
375 type="slot"; break;
377 type="ffunc"; break;
379 type="dcop"; break;
381 if (cd && cd->compoundType()==ClassDef::Protocol)
382 type="intfp"; // interface property
383 else
384 type="instp"; // instance property
385 break;
387 type="event"; break;
389 type="ifc"; break;
391 type="svc"; break;
393 type="sequence"; break;
395 type="dictionary"; break;
396 }
397 scope = md->getScopeString();
398 fd = md->getFileDef();
399 if (fd)
400 {
401 decl = fd->name();
402 }
403 writeToken(p->tts,md,type,lang,scope,md->anchor(),decl);
404 }
405 else if (context && context->isLinkable())
406 {
407 if (fd==nullptr && context->definitionType()==Definition::TypeFile)
408 {
409 fd = toFileDef(context);
410 }
411 if (cd==nullptr && context->definitionType()==Definition::TypeClass)
412 {
413 cd = toClassDef(context);
414 }
415 if (nd==nullptr && context->definitionType()==Definition::TypeNamespace)
416 {
417 nd = toNamespaceDef(context);
418 }
419 if (fd)
420 {
421 type="file";
422 }
423 else if (cd)
424 {
425 scope = cd->qualifiedName();
426 if (cd->isTemplate())
427 {
428 type="tmplt";
429 }
430 else if (cd->compoundType()==ClassDef::Protocol)
431 {
432 type="intf";
433 if (scope.endsWith("-p")) scope=scope.left(scope.length()-2);
434 }
435 else if (cd->compoundType()==ClassDef::Interface)
436 {
437 type="cl";
438 }
439 else if (cd->compoundType()==ClassDef::Category)
440 {
441 type="cat";
442 }
443 else
444 {
445 type = "cl";
446 }
447 const IncludeInfo *ii = cd->includeInfo();
448 if (ii)
449 {
450 decl=ii->includeName;
451 }
452 }
453 else if (nd)
454 {
455 scope = nd->name();
456 type = "ns";
457 }
458 if (p->scopes.find(context->getOutputFileBase().str())==p->scopes.end())
459 {
460 writeToken(p->tts,context,type,lang,scope,QCString(),decl);
461 p->scopes.insert(context->getOutputFileBase().str());
462 }
463 }
464}

References Definition::anchor, ClassDef::Category, ClassDef::Class, ClassDef::compoundType, DCOP, Define, Definition::definitionType, Dictionary, QCString::endsWith, Enumeration, EnumValue, Event, Friend, Function, MemberDef::getClassDef, MemberDef::getFileDef, Definition::getLanguage, MemberDef::getNamespaceDef, Definition::getOutputFileBase, MemberDef::getScopeString, ClassDef::includeInfo, IncludeInfo::includeName, ClassDef::Interface, Interface, Definition::isLinkable, MemberDef::isObjCMethod, MemberDef::isObjCProperty, MemberDef::isStatic, ClassDef::isTemplate, QCString::left, QCString::length, QCString::lower, MemberDef::memberType, Definition::name, p, Property, ClassDef::Protocol, Definition::qualifiedName, Sequence, Service, Signal, Slot, QCString::str, toClassDef, toFileDef, toNamespaceDef, Definition::TypeClass, Typedef, Definition::TypeFile, Definition::TypeNamespace, Variable and writeToken.

addStyleSheetFile()

void DocSets::addStyleSheetFile (const QCString &)
inline virtual

Definition at line 60 of file docsets.h.

60 void addStyleSheetFile(const QCString &) {}

decContentsDepth()

void DocSets::decContentsDepth ()
virtual

Declaration at line 45 of file docsets.h, definition at line 214 of file docsets.cpp.

215{
216 if (!p->indentStack.top())
217 {
218 p->nts << p->indent() << " </Node>\n";
219 }
220 p->nts << p->indent() << "</Subnodes>\n";
221 p->indentStack.pop();
222 //printf("DocSets::decContentsDepth() depth=%zu\n",p->indentStack.size());
223}

Reference p.

finalize()

void DocSets::finalize ()
virtual

Declaration at line 43 of file docsets.h, definition at line 181 of file docsets.cpp.

182{
183 if (!p->indentStack.top())
184 {
185 p->nts << p->indent() << " </Node>\n";
186 }
187 p->indentStack.pop();
188 p->nts << " </Subnodes>\n";
189 p->nts << " </Node>\n";
190 p->nts << " </TOC>\n";
191 p->nts << "</DocSetNodes>\n";
192 p->nts.flush();
193 p->ntf.close();
194
195 p->tts << "</Tokens>\n";
196 p->tts.flush();
197 p->ttf.close();
198}

Reference p.

incContentsDepth()

void DocSets::incContentsDepth ()
virtual

Declaration at line 44 of file docsets.h, definition at line 207 of file docsets.cpp.

208{
209 //printf("DocSets::incContentsDepth() depth=%zu\n",p->indentStack.size());
210 p->nts << p->indent() << "<Subnodes>\n";
211 p->indentStack.push(true);
212}

Reference p.

initialize()

void DocSets::initialize ()
virtual

Declaration at line 42 of file docsets.h, definition at line 47 of file docsets.cpp.

48{
49 // -- get config options
50 QCString projectName = Config_getString(PROJECT_NAME);
51 if (projectName.isEmpty()) projectName="root";
52 QCString bundleId = Config_getString(DOCSET_BUNDLE_ID);
53 if (bundleId.isEmpty()) bundleId="org.doxygen.Project";
54 QCString feedName = Config_getString(DOCSET_FEEDNAME);
55 if (feedName.isEmpty()) feedName="FeedName";
56 QCString feedURL = Config_getString(DOCSET_FEEDURL);
57 if (feedURL.isEmpty()) feedURL="FeedUrl";
58 QCString publisherId = Config_getString(DOCSET_PUBLISHER_ID);
59 if (publisherId.isEmpty()) publisherId="PublisherId";
60 QCString publisherName = Config_getString(DOCSET_PUBLISHER_NAME);
61 if (publisherName.isEmpty()) publisherName="PublisherName";
62 QCString projectNumber = Config_getString(PROJECT_NUMBER);
63 if (projectNumber.isEmpty()) projectNumber="ProjectNumber";
64
65 // -- write Makefile
66 {
67 QCString mfName = Config_getString(HTML_OUTPUT) + "/Makefile";
68 std::ofstream ts = Portable::openOutputStream(mfName);
69 if (!ts.is_open())
70 {
71 term("Could not open file {} for writing\n",mfName);
72 }
73
74 ts << "DOCSET_NAME=" << bundleId << ".docset\n"
75 "DOCSET_CONTENTS=$(DOCSET_NAME)/Contents\n"
76 "DOCSET_RESOURCES=$(DOCSET_CONTENTS)/Resources\n"
77 "DOCSET_DOCUMENTS=$(DOCSET_RESOURCES)/Documents\n"
78 "DESTDIR=~/Library/Developer/Shared/Documentation/DocSets\n"
79 "XCODE_INSTALL=\"$(shell xcode-select -print-path)\"\n"
80 "\n"
81 "all: docset\n"
82 "\n"
83 "docset:\n"
84 "\tmkdir -p $(DOCSET_DOCUMENTS)\n"
85 "\tcp Nodes.xml $(DOCSET_RESOURCES)\n"
86 "\tcp Tokens.xml $(DOCSET_RESOURCES)\n"
87 "\tcp Info.plist $(DOCSET_CONTENTS)\n"
88 "\ttar --exclude $(DOCSET_NAME) \\\n"
89 "\t --exclude Nodes.xml \\\n"
90 "\t --exclude Tokens.xml \\\n"
91 "\t --exclude Info.plist \\\n"
92 "\t --exclude Makefile -c -f - . \\\n"
93 "\t | (cd $(DOCSET_DOCUMENTS); tar xvf -)\n"
94 "\t$(XCODE_INSTALL)/usr/bin/docsetutil index $(DOCSET_NAME)\n"
95 "\trm -f $(DOCSET_DOCUMENTS)/Nodes.xml\n"
96 "\trm -f $(DOCSET_DOCUMENTS)/Info.plist\n"
97 "\trm -f $(DOCSET_DOCUMENTS)/Makefile\n"
98 "\trm -f $(DOCSET_RESOURCES)/Nodes.xml\n"
99 "\trm -f $(DOCSET_RESOURCES)/Tokens.xml\n"
100 "\n"
101 "clean:\n"
102 "\trm -rf $(DOCSET_NAME)\n"
103 "\n"
104 "install: docset\n"
105 "\tmkdir -p $(DESTDIR)\n"
106 "\tcp -R $(DOCSET_NAME) $(DESTDIR)\n"
107 "\n"
108 "uninstall:\n"
109 "\trm -rf $(DESTDIR)/$(DOCSET_NAME)\n"
110 "\n"
111 "always:\n";
112 }
113
114 // -- write Info.plist
115 {
116 QCString plName = Config_getString(HTML_OUTPUT) + "/Info.plist";
117 std::ofstream ts = Portable::openOutputStream(plName);
118 if (!ts.is_open())
119 {
120 term("Could not open file {} for writing\n",plName);
121 }
122
123 ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
124 "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n"
125 "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
126 "<plist version=\"1.0\">\n"
127 "<dict>\n"
128 " <key>CFBundleName</key>\n"
129 " <string>" << projectName << "</string>\n"
130 " <key>CFBundleIdentifier</key>\n"
131 " <string>" << bundleId << "</string>\n"
132 " <key>CFBundleVersion</key>\n"
133 " <string>" << projectNumber << "</string>\n"
134 " <key>DocSetFeedName</key>\n"
135 " <string>" << feedName << "</string>\n"
136 " <key>DocSetFeedUrl</key>\n"
137 " <string>" << feedURL << "</string>\n"
138 " <key>DocSetPublisherIdentifier</key>\n"
139 " <string>" << publisherId << "</string>\n"
140 " <key>DocSetPublisherName</key>\n"
141 " <string>" << publisherName << "</string>\n"
142 // markers for Dash
143 " <key>DashDocSetFamily</key>\n"
144 " <string>doxy</string>\n"
145 " <key>DocSetPlatformFamily</key>\n"
146 " <string>doxygen</string>\n"
147 "</dict>\n"
148 "</plist>\n";
149 }
150
151 // -- start Nodes.xml
152 QCString notes = Config_getString(HTML_OUTPUT) + "/Nodes.xml";
153 p->ntf = Portable::openOutputStream(notes);
154 if (!p->ntf.is_open())
155 {
156 term("Could not open file {} for writing\n",notes);
157 }
158 p->nts.setStream(&p->ntf);
159 //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index";
160 QCString indexName="index";
161 p->nts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
162 p->nts << "<DocSetNodes version=\"1.0\">\n";
163 p->nts << " <TOC>\n";
164 p->nts << " <Node>\n";
165 p->nts << " <Name>Root</Name>\n";
166 p->nts << " <Path>" << indexName << Doxygen::htmlFileExtension << "</Path>\n";
167 p->nts << " <Subnodes>\n";
168 p->indentStack.push(true);
169
170 QCString tokens = Config_getString(HTML_OUTPUT) + "/Tokens.xml";
171 p->ttf = Portable::openOutputStream(tokens);
172 if (!p->ttf.is_open())
173 {
174 term("Could not open file {} for writing\n",tokens);
175 }
176 p->tts.setStream(&p->ttf);
177 p->tts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
178 p->tts << "<Tokens version=\"1.0\">\n";
179}

References Config_getString, Doxygen::htmlFileExtension, QCString::isEmpty, Portable::openOutputStream, p and term.

Private Member Functions

writeToken()

void DocSets::writeToken (TextStream & t, const Definition * d, const QCString & type, const QCString & lang, const QCString & scope=QCString(), const QCString & anchor=QCString(), const QCString & decl=QCString())

Declaration at line 63 of file docsets.h, definition at line 466 of file docsets.cpp.

467 const Definition *d,
468 const QCString &type,
469 const QCString &lang,
470 const QCString &scope,
471 const QCString &anchor,
472 const QCString &decl)
473{
474 t << " <Token>\n";
475 t << " <TokenIdentifier>\n";
476 QCString name = d->name();
477 if (name.endsWith("-p")) name=name.left(name.length()-2);
478 t << " <Name>" << convertToXML(name) << "</Name>\n";
479 if (!lang.isEmpty())
480 {
481 t << " <APILanguage>" << lang << "</APILanguage>\n";
482 }
483 if (!type.isEmpty())
484 {
485 t << " <Type>" << type << "</Type>\n";
486 }
487 if (!scope.isEmpty())
488 {
489 t << " <Scope>" << convertToXML(scope) << "</Scope>\n";
490 }
491 t << " </TokenIdentifier>\n";
494 t << " <Path>" << fn << "</Path>\n";
495 if (!anchor.isEmpty())
496 {
497 t << " <Anchor>" << anchor << "</Anchor>\n";
498 }
500 if (!tooltip.isEmpty())
501 {
502 t << " <Abstract>" << convertToXML(tooltip) << "</Abstract>\n";
503 }
504 if (!decl.isEmpty())
505 {
506 t << " <DeclaredIn>" << convertToXML(decl) << "</DeclaredIn>\n";
507 }
508 t << " </Token>\n";
509}

References addHtmlExtensionIfMissing, Definition::briefDescriptionAsTooltip, convertToXML, QCString::endsWith, Definition::getOutputFileBase, QCString::isEmpty, QCString::left, QCString::length and Definition::name.

Referenced by addIndexItem.

Private Member Attributes

p

std::unique_ptr<Private> DocSets::p

Definition at line 68 of file docsets.h.

68 std::unique_ptr<Private> p;

Referenced by addContentsItem, addIndexItem, decContentsDepth, DocSets, finalize, incContentsDepth and initialize.


The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus by Doxygen 1.14.0.