mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-07-21 00:07:12 +02:00
Update libraries and make it build on windows.
Still gets some warnings because compilers have changed. But should work.
This commit is contained in:
265
vendor/POCO/PocoDoc/src/DocWriter.cpp
vendored
265
vendor/POCO/PocoDoc/src/DocWriter.cpp
vendored
@@ -26,12 +26,19 @@
|
||||
#include "Poco/CppParser/Parameter.h"
|
||||
#include "Poco/CppParser/TypeDef.h"
|
||||
#include "Poco/CppParser/Variable.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Data/SQLite/Connector.h"
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cctype>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using namespace Poco::Data::Keywords;
|
||||
using Poco::Data::Session;
|
||||
using Poco::Data::Statement;
|
||||
using Poco::NumberFormatter;
|
||||
using Poco::Path;
|
||||
using Poco::DateTime;
|
||||
@@ -48,9 +55,11 @@ DocWriter::StringMap DocWriter::_strings;
|
||||
Poco::Logger* DocWriter::_pLogger(0);
|
||||
const std::string DocWriter::RFC_URI("https://www.ietf.org/rfc/rfc");
|
||||
const std::string DocWriter::GITHUB_POCO_URI("https://github.com/pocoproject/poco");
|
||||
const std::string DocWriter::DATABASE_DIR("/dist/");
|
||||
const std::string DocWriter::DATABASE_NAME("docs.db");
|
||||
|
||||
|
||||
DocWriter::DocWriter(const NameSpace::SymbolTable& symbols, const std::string& path, bool prettifyCode, bool noFrames):
|
||||
DocWriter::DocWriter(const NameSpace::SymbolTable& symbols, const std::string& path, bool prettifyCode, bool noFrames, bool searchIndex):
|
||||
_prettifyCode(prettifyCode),
|
||||
_noFrames(noFrames),
|
||||
_htmlMode(false),
|
||||
@@ -60,7 +69,8 @@ DocWriter::DocWriter(const NameSpace::SymbolTable& symbols, const std::string& p
|
||||
_pNameSpace(0),
|
||||
_pendingLine(false),
|
||||
_indent(0),
|
||||
_titleId(0)
|
||||
_titleId(0),
|
||||
_searchIndex(searchIndex)
|
||||
{
|
||||
_pLogger = &Poco::Logger::get("DocWriter");
|
||||
|
||||
@@ -70,6 +80,7 @@ DocWriter::DocWriter(const NameSpace::SymbolTable& symbols, const std::string& p
|
||||
logger().information(std::string("Loading translation strings [") + _language + "]");
|
||||
|
||||
loadStrings(_language);
|
||||
if (_searchIndex) initDatabase();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +89,35 @@ DocWriter::~DocWriter()
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::initDatabase()
|
||||
{
|
||||
Poco::Data::SQLite::Connector::registerConnector();
|
||||
std::string dbPath = _path + DATABASE_DIR + DATABASE_NAME;
|
||||
Session session("SQLite", dbPath);
|
||||
session << "DROP TABLE IF EXISTS docs", now;
|
||||
session << "CREATE VIRTUAL TABLE docs USING fts5( link, content )", now;
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeSearchIndex(std::string link, std::string content)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!content.empty())
|
||||
{
|
||||
Poco::Data::SQLite::Connector::registerConnector();
|
||||
std::string dbPath = _path + DATABASE_DIR + DATABASE_NAME;
|
||||
Session session("SQLite", dbPath);
|
||||
session << "INSERT INTO docs(link, content) VALUES (?, ?)", use(link), use(content), now;
|
||||
}
|
||||
}
|
||||
catch (Poco::Exception& e)
|
||||
{
|
||||
_pLogger->error(e.displayText());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::addPage(const std::string& path)
|
||||
{
|
||||
Page page;
|
||||
@@ -386,6 +426,7 @@ void DocWriter::writeClass(const Struct* pStruct)
|
||||
_pNameSpace = pStruct;
|
||||
std::string path(pathFor(fileNameFor(pStruct)));
|
||||
std::ofstream ostr(path.c_str());
|
||||
std::ostringstream sstr;
|
||||
if (!ostr.good()) throw Poco::CreateFileException(path);
|
||||
std::string header;
|
||||
if (pStruct->isClass())
|
||||
@@ -410,7 +451,7 @@ void DocWriter::writeClass(const Struct* pStruct)
|
||||
logger().notice(std::string("TODO in class documentation for ") + pStruct->fullName());
|
||||
|
||||
writeSubTitle(ostr, tr("Description"));
|
||||
writeDescription(ostr, pStruct->getDocumentation());
|
||||
writeDescription(ostr, pStruct->getDocumentation(), &sstr);
|
||||
}
|
||||
else if (pStruct->isPublic() && !pStruct->isDerived())
|
||||
{
|
||||
@@ -419,23 +460,25 @@ void DocWriter::writeClass(const Struct* pStruct)
|
||||
writeInheritance(ostr, pStruct);
|
||||
writeMethodSummary(ostr, pStruct);
|
||||
writeNestedClasses(ostr, pStruct);
|
||||
writeTypes(ostr, pStruct);
|
||||
writeAliases(ostr, pStruct);
|
||||
writeEnums(ostr, pStruct);
|
||||
writeTypes(ostr, pStruct, &sstr);
|
||||
writeAliases(ostr, pStruct, &sstr);
|
||||
writeEnums(ostr, pStruct, &sstr);
|
||||
writeConstructors(ostr, pStruct);
|
||||
writeDestructor(ostr, pStruct);
|
||||
writeMethods(ostr, pStruct);
|
||||
writeVariables(ostr, pStruct);
|
||||
writeVariables(ostr, pStruct, &sstr);
|
||||
writeCopyright(ostr);
|
||||
endContent(ostr);
|
||||
endBody(ostr);
|
||||
writeFooter(ostr);
|
||||
if (_searchIndex) writeSearchIndex(fileNameFor(pStruct), sstr.str());
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeNameSpace(const NameSpace* pNameSpace)
|
||||
{
|
||||
_pNameSpace = pNameSpace;
|
||||
std::ostringstream sstr;
|
||||
std::string path(pathFor(fileNameFor(pNameSpace)));
|
||||
std::ofstream ostr(path.c_str());
|
||||
if (!ostr.good()) throw Poco::CreateFileException(path);
|
||||
@@ -445,22 +488,23 @@ void DocWriter::writeNameSpace(const NameSpace* pNameSpace)
|
||||
writeNavigationFrame(ostr, "", "");
|
||||
beginContent(ostr);
|
||||
writeSubTitle(ostr, tr("Overview"));
|
||||
writeNameSpacesSummary(ostr, pNameSpace);
|
||||
writeClassesSummary(ostr, pNameSpace);
|
||||
writeTypesSummary(ostr, pNameSpace);
|
||||
writeAliasesSummary(ostr, pNameSpace);
|
||||
writeFunctionsSummary(ostr, pNameSpace);
|
||||
writeNameSpaces(ostr, pNameSpace);
|
||||
writeClasses(ostr, pNameSpace);
|
||||
writeTypes(ostr, pNameSpace);
|
||||
writeAliases(ostr, pNameSpace);
|
||||
writeEnums(ostr, pNameSpace);
|
||||
writeFunctions(ostr, pNameSpace);
|
||||
writeVariables(ostr, pNameSpace);
|
||||
writeNameSpacesSummary(ostr, pNameSpace, &sstr);
|
||||
writeClassesSummary(ostr, pNameSpace, &sstr);
|
||||
writeTypesSummary(ostr, pNameSpace, &sstr);
|
||||
writeAliasesSummary(ostr, pNameSpace, &sstr);
|
||||
writeFunctionsSummary(ostr, pNameSpace, &sstr);
|
||||
writeNameSpaces(ostr, pNameSpace, &sstr);
|
||||
writeClasses(ostr, pNameSpace, &sstr);
|
||||
writeTypes(ostr, pNameSpace, &sstr);
|
||||
writeAliases(ostr, pNameSpace, &sstr);
|
||||
writeEnums(ostr, pNameSpace, &sstr);
|
||||
writeFunctions(ostr, pNameSpace, &sstr);
|
||||
writeVariables(ostr, pNameSpace, &sstr);
|
||||
writeCopyright(ostr);
|
||||
endContent(ostr);
|
||||
endBody(ostr);
|
||||
writeFooter(ostr);
|
||||
if (_searchIndex) writeSearchIndex(fileNameFor(pNameSpace), sstr.str());
|
||||
}
|
||||
|
||||
|
||||
@@ -468,6 +512,7 @@ void DocWriter::writePackage(const std::string& file, const std::string& library
|
||||
{
|
||||
std::string path(pathFor(file));
|
||||
std::ofstream ostr(path.c_str());
|
||||
std::ostringstream sstr;
|
||||
if (!ostr.good()) throw Poco::CreateFileException(path);
|
||||
writeHeader(ostr, tr("Package_Index"), "js/iframeResizer.min.js");
|
||||
writeTitle(ostr, tr("Library") + " " + library, tr("Package") + " " + package);
|
||||
@@ -561,6 +606,7 @@ void DocWriter::writePackage(const std::string& file, const std::string& library
|
||||
endContent(ostr);
|
||||
endBody(ostr);
|
||||
writeFooter(ostr);
|
||||
if (_searchIndex) writeSearchIndex(file, sstr.str());
|
||||
}
|
||||
|
||||
|
||||
@@ -641,6 +687,7 @@ void DocWriter::writeHeader(std::ostream& ostr, const std::string& title, const
|
||||
ostr << "<meta name=\"author\" content=\"" << htmlize(company) << "\"/>" << std::endl;
|
||||
ostr << "<meta name=\"generator\" content=\"" << app.config().getString("PocoDoc.generator", "PocoDoc") << "\"/>" << std::endl;
|
||||
ostr << "<link rel=\"stylesheet\" href=\"css/styles.css\" type=\"text/css\"/>" << std::endl;
|
||||
ostr << "<link rel=\"stylesheet\" href=\"css/header.css\" type=\"text/css\"/>\n";
|
||||
if (_prettifyCode)
|
||||
{
|
||||
ostr << "<link href=\"css/prettify.css\" type=\"text/css\" rel=\"stylesheet\"/>" << std::endl;
|
||||
@@ -705,7 +752,73 @@ void DocWriter::writeCopyright(std::ostream& ostr)
|
||||
}
|
||||
ostr << "</p>\n";
|
||||
}
|
||||
void DocWriter::writeSearchBox(std::ostream& ostr)
|
||||
{
|
||||
ostr << "<div class=\"search-box\" style=\"text-align: center;\">\n";
|
||||
ostr << "<input type=\"text\" id=\"search\" name=\"search\" placeholder=\"Search...\">\n";
|
||||
ostr << "<div id=\"suggestions\"></div>\n";
|
||||
ostr << "</div>\n";
|
||||
|
||||
ostr << "<script type=\"module\">\n";
|
||||
ostr << "import { load } from \"./dist/sql-httpvfs.js\";\n\n";
|
||||
ostr << "let db = null;\n\n";
|
||||
ostr << "async function initDb() {\n";
|
||||
ostr << " db = await load(\"./docs.db\");\n";
|
||||
ostr << "}\n\n";
|
||||
ostr << "async function searchPages(searchTerm) {\n";
|
||||
ostr << " if (!db || !searchTerm) return [];\n\n";
|
||||
ostr << " try {\n";
|
||||
ostr << " const query = `SELECT link, content, snippet(docs, 1, '<b>', '</b>', '...',10) as snippet FROM docs WHERE docs MATCH \"${searchTerm}\" ORDER BY RANK`;\n";
|
||||
ostr << " const results = await db.query(query);\n";
|
||||
ostr << " return results;\n";
|
||||
ostr << " } catch (error) {\n";
|
||||
ostr << " console.error(\"Error searching pages:\", error);\n";
|
||||
ostr << " return [];\n";
|
||||
ostr << " }\n";
|
||||
ostr << "}\n\n";
|
||||
ostr << "function escapeHTML(text) {\n";
|
||||
ostr << " const div = document.createElement('div');\n";
|
||||
ostr << " div.textContent = text;\n";
|
||||
ostr << " return div.innerHTML.replace(/<(\\/)?b>/g, '<$1b>');\n";
|
||||
ostr << "}\n\n";
|
||||
ostr << "document.addEventListener(\"DOMContentLoaded\", () => {\n";
|
||||
ostr << " document\n";
|
||||
ostr << " .getElementById(\"search\")\n";
|
||||
ostr << " .addEventListener(\"keyup\", async (event) => {\n";
|
||||
ostr << " const searchTerm = event.target.value.toLowerCase();\n";
|
||||
ostr << " const suggestionsEl = document.getElementById(\"suggestions\");\n\n";
|
||||
ostr << " if (searchTerm.length < 3) {\n";
|
||||
ostr << " suggestionsEl.style.display = \"none\";\n";
|
||||
ostr << " return;\n";
|
||||
ostr << " }\n\n";
|
||||
ostr << " const searchResults = await searchPages(searchTerm);\n";
|
||||
ostr << " let suggestions = \"\";\n\n";
|
||||
ostr << " if (searchResults.length === 0) {\n";
|
||||
ostr << " suggestions = \"<div>No search results found.</div>\";\n";
|
||||
ostr << " } else {\n";
|
||||
ostr << " for (const page of searchResults) {\n";
|
||||
ostr << " suggestions += `<a href=\"${page.link}\">${escapeHTML(page.snippet)}</a>`;\n";
|
||||
ostr << " }\n";
|
||||
ostr << " }\n\n";
|
||||
ostr << " suggestionsEl.innerHTML = suggestions;\n";
|
||||
ostr << " suggestionsEl.style.display = \"block\";\n";
|
||||
ostr << " });\n\n";
|
||||
ostr << " document.getElementById(\"search\").addEventListener(\"blur\", () => {\n";
|
||||
ostr << " setTimeout(() => {\n";
|
||||
ostr << " document.getElementById(\"suggestions\").style.display = \"none\";\n";
|
||||
ostr << " }, 100);\n";
|
||||
ostr << " });\n\n";
|
||||
ostr << " document.getElementById(\"search\").addEventListener(\"focus\", () => {\n";
|
||||
ostr << " if (document.getElementById(\"suggestions\").children.length > 0) {\n";
|
||||
ostr << " document.getElementById(\"suggestions\").style.display = \"block\";\n";
|
||||
ostr << " }\n";
|
||||
ostr << " });\n";
|
||||
ostr << " });\n\n";
|
||||
ostr << "initDb();\n";
|
||||
ostr << "</script>\n";
|
||||
|
||||
ostr << "\n</div>\n";
|
||||
}
|
||||
|
||||
void DocWriter::writeTitle(std::ostream& ostr, const std::string& category, const std::string& title)
|
||||
{
|
||||
@@ -716,14 +829,14 @@ void DocWriter::writeTitle(std::ostream& ostr, const std::string& category, cons
|
||||
{
|
||||
ostr << "<img src=\"" << headerImage << "\" alt=\"\">\n";
|
||||
}
|
||||
ostr << "<h1 class=\"category\">";
|
||||
|
||||
if (category.empty())
|
||||
ostr << " ";
|
||||
else
|
||||
ostr << htmlize(category);
|
||||
ostr << "</h1>\n";
|
||||
ostr << "<h1 class=\"title\">" << htmlize(title) << "</h1>";
|
||||
ostr << "\n</div>\n";
|
||||
ostr << "<h1 class=\"category\">" << htmlize(category) << "</h1>";
|
||||
|
||||
ostr << "<h1 class=\"title\">" << htmlize(title) << "</h1>";
|
||||
writeSearchBox(ostr);
|
||||
}
|
||||
|
||||
|
||||
@@ -786,6 +899,7 @@ void DocWriter::writeTitle(std::ostream& ostr, const NameSpace* pNameSpace, cons
|
||||
<< "</h1>";
|
||||
}
|
||||
ostr << "\n</div>\n";
|
||||
writeSearchBox(ostr);
|
||||
}
|
||||
|
||||
|
||||
@@ -837,10 +951,10 @@ void DocWriter::endContent(std::ostream& ostr)
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeDescription(std::ostream& ostr, const std::string& text)
|
||||
void DocWriter::writeDescription(std::ostream& ostr, const std::string& text, std::ostream* pSstr)
|
||||
{
|
||||
ostr << "<div class=\"description\">\n"
|
||||
<< "<p>";
|
||||
<< "<p>";
|
||||
|
||||
_titleId = 0;
|
||||
_htmlMode = false;
|
||||
@@ -851,7 +965,7 @@ void DocWriter::writeDescription(std::ostream& ostr, const std::string& text)
|
||||
{
|
||||
std::string line;
|
||||
while (it != end && *it != '\n') line += *it++;
|
||||
writeDescriptionLine(ostr, line, state);
|
||||
writeDescriptionLine(ostr, line, state, pSstr);
|
||||
if (it != end) ++it;
|
||||
}
|
||||
switch (state)
|
||||
@@ -875,7 +989,7 @@ void DocWriter::writeDescription(std::ostream& ostr, const std::string& text)
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeDescriptionLine(std::ostream& ostr, const std::string& text, TextState& state)
|
||||
void DocWriter::writeDescriptionLine(std::ostream& ostr, const std::string& text, TextState& state, std::ostream* pSstr)
|
||||
{
|
||||
if (_htmlMode)
|
||||
{
|
||||
@@ -895,7 +1009,7 @@ void DocWriter::writeDescriptionLine(std::ostream& ostr, const std::string& text
|
||||
switch (state)
|
||||
{
|
||||
case TEXT_PARAGRAPH:
|
||||
writeText(ostr, text);
|
||||
writeText(ostr, text, pSstr);
|
||||
break;
|
||||
case TEXT_LIST:
|
||||
ostr << "</li>\n</ul>\n<p>";
|
||||
@@ -1061,7 +1175,7 @@ std::string DocWriter::htmlizeName(const std::string& name)
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeText(std::ostream& ostr, const std::string& text)
|
||||
void DocWriter::writeText(std::ostream& ostr, const std::string& text, std::ostream* pSstr)
|
||||
{
|
||||
std::string::const_iterator it(text.begin());
|
||||
std::string::const_iterator end(text.end());
|
||||
@@ -1085,21 +1199,23 @@ void DocWriter::writeText(std::ostream& ostr, const std::string& text)
|
||||
}
|
||||
while (it != end && std::isspace(*it)) ++it;
|
||||
ostr << "</p><" << heading << ">" << format("<a id=\"%d\">", _titleId++) << htmlize(std::string(it, end)) << "</a></" << heading << "><p>" << std::endl;
|
||||
if (pSstr) *pSstr << std::string(it, end) << '\n';
|
||||
return;
|
||||
}
|
||||
}
|
||||
writeText(ostr, it, end);
|
||||
writeText(ostr, it, end, pSstr);
|
||||
if (pSstr) *pSstr << ' ';
|
||||
ostr << ' ';
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeText(std::ostream& ostr, std::string::const_iterator begin, const std::string::const_iterator& end)
|
||||
void DocWriter::writeText(std::ostream& ostr, std::string::const_iterator begin, const std::string::const_iterator& end, std::ostream* pSstr)
|
||||
{
|
||||
std::string token;
|
||||
nextToken(begin, end, token);
|
||||
while (!token.empty())
|
||||
{
|
||||
if (!writeSymbol(ostr, token, begin, end) && !writeSpecial(ostr, token, begin, end))
|
||||
if (!writeSymbol(ostr, token, begin, end, pSstr) && !writeSpecial(ostr, token, begin, end))
|
||||
{
|
||||
if (token == "[[")
|
||||
{
|
||||
@@ -1121,7 +1237,7 @@ void DocWriter::writeText(std::ostream& ostr, std::string::const_iterator begin,
|
||||
std::string target;
|
||||
if (uri.compare(0, 7, "http://") == 0 || uri.compare(0, 8, "https://") == 0)
|
||||
target = "_blank";
|
||||
writeTargetLink(ostr, uri, text, target);
|
||||
writeTargetLink(ostr, uri, text, target, pSstr);
|
||||
}
|
||||
begin = it;
|
||||
nextToken(begin, end, token);
|
||||
@@ -1148,7 +1264,7 @@ void DocWriter::writeText(std::ostream& ostr, std::string::const_iterator begin,
|
||||
}
|
||||
begin = it;
|
||||
}
|
||||
if (token == "GH")
|
||||
if (token == "GH" || token == "PR")
|
||||
{
|
||||
std::string uri(GITHUB_POCO_URI);
|
||||
std::string::const_iterator it(begin);
|
||||
@@ -1171,7 +1287,7 @@ void DocWriter::writeText(std::ostream& ostr, std::string::const_iterator begin,
|
||||
nextToken(begin, end, n);
|
||||
if (!n.empty() && std::isdigit(n[0]))
|
||||
{
|
||||
uri += "/issues/";
|
||||
uri += token == "GH" ? "/issues/" : "/pull/";
|
||||
uri += n;
|
||||
writeTargetLink(ostr, uri, token + " #" + n, "_blank");
|
||||
nextToken(begin, end, token);
|
||||
@@ -1208,6 +1324,7 @@ void DocWriter::writeText(std::ostream& ostr, std::string::const_iterator begin,
|
||||
else
|
||||
{
|
||||
ostr << htmlize(token);
|
||||
if (pSstr) *pSstr << token;
|
||||
}
|
||||
nextToken(begin, end, token);
|
||||
}
|
||||
@@ -1236,7 +1353,7 @@ void DocWriter::writeDecl(std::ostream& ostr, std::string::const_iterator begin,
|
||||
}
|
||||
|
||||
|
||||
bool DocWriter::writeSymbol(std::ostream& ostr, std::string& token, std::string::const_iterator& begin, const std::string::const_iterator& end)
|
||||
bool DocWriter::writeSymbol(std::ostream& ostr, std::string& token, std::string::const_iterator& begin, const std::string::const_iterator& end, std::ostream* pSstr)
|
||||
{
|
||||
if (std::isalnum(token[0]) && _pNameSpace)
|
||||
{
|
||||
@@ -1261,7 +1378,7 @@ bool DocWriter::writeSymbol(std::ostream& ostr, std::string& token, std::string:
|
||||
Symbol* pSym = _pNameSpace->lookup(id);
|
||||
if (pSym)
|
||||
{
|
||||
writeLink(ostr, pSym, id);
|
||||
writeLink(ostr, pSym, id, pSstr);
|
||||
nextToken(begin, end, token);
|
||||
return true;
|
||||
}
|
||||
@@ -1655,7 +1772,7 @@ void DocWriter::writeNestedClasses(std::ostream& ostr, const Struct* pStruct)
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeNameSpacesSummary(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeNameSpacesSummary(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable nameSpaces;
|
||||
pNameSpace->nameSpaces(nameSpaces);
|
||||
@@ -1672,7 +1789,7 @@ void DocWriter::writeNameSpacesSummary(std::ostream& ostr, const NameSpace* pNam
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeNameSpaces(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeNameSpaces(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable nameSpaces;
|
||||
pNameSpace->nameSpaces(nameSpaces);
|
||||
@@ -1691,7 +1808,7 @@ void DocWriter::writeNameSpaces(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeClassesSummary(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeClassesSummary(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable classes;
|
||||
pNameSpace->classes(classes);
|
||||
@@ -1708,7 +1825,7 @@ void DocWriter::writeClassesSummary(std::ostream& ostr, const NameSpace* pNameSp
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeClasses(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeClasses(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable classes;
|
||||
pNameSpace->classes(classes);
|
||||
@@ -1740,7 +1857,7 @@ void DocWriter::writeClassSummary(std::ostream& ostr, const Struct* pStruct)
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeTypesSummary(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeTypesSummary(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable types;
|
||||
pNameSpace->typeDefs(types);
|
||||
@@ -1757,7 +1874,7 @@ void DocWriter::writeTypesSummary(std::ostream& ostr, const NameSpace* pNameSpac
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeAliasesSummary(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeAliasesSummary(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable types;
|
||||
pNameSpace->typeAliases(types);
|
||||
@@ -1774,7 +1891,7 @@ void DocWriter::writeAliasesSummary(std::ostream& ostr, const NameSpace* pNameSp
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeTypes(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeTypes(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable types;
|
||||
pNameSpace->typeDefs(types);
|
||||
@@ -1790,13 +1907,13 @@ void DocWriter::writeTypes(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
for (NameSpace::Iterator it = types.begin(); it != types.end(); ++it)
|
||||
{
|
||||
if (it->second->getAccess() != Symbol::ACC_PRIVATE)
|
||||
writeType(ostr, static_cast<const TypeDef*>(it->second));
|
||||
writeType(ostr, static_cast<const TypeDef*>(it->second), pSstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeAliases(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeAliases(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable types;
|
||||
pNameSpace->typeAliases(types);
|
||||
@@ -1812,13 +1929,13 @@ void DocWriter::writeAliases(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
for (NameSpace::Iterator it = types.begin(); it != types.end(); ++it)
|
||||
{
|
||||
if (it->second->getAccess() != Symbol::ACC_PRIVATE)
|
||||
writeType(ostr, static_cast<const TypeDef*>(it->second));
|
||||
writeType(ostr, static_cast<const TypeDef*>(it->second), pSstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeType(std::ostream& ostr, const TypeDef* pType)
|
||||
void DocWriter::writeType(std::ostream& ostr, const TypeDef* pType, std::ostream* pSstr)
|
||||
{
|
||||
ostr << "<h3>";
|
||||
writeAnchor(ostr, pType->name(), pType);
|
||||
@@ -1828,11 +1945,11 @@ void DocWriter::writeType(std::ostream& ostr, const TypeDef* pType)
|
||||
ostr << "<p class=\"decl\">";
|
||||
writeDecl(ostr, pType->declaration());
|
||||
ostr << ";</p>\n";
|
||||
writeDescription(ostr, pType->getDocumentation());
|
||||
writeDescription(ostr, pType->getDocumentation(), pSstr);
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeEnums(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeEnums(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable enums;
|
||||
pNameSpace->enums(enums);
|
||||
@@ -1848,13 +1965,13 @@ void DocWriter::writeEnums(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
for (NameSpace::Iterator it = enums.begin(); it != enums.end(); ++it)
|
||||
{
|
||||
if (it->second->getAccess() != Symbol::ACC_PRIVATE)
|
||||
writeEnum(ostr, static_cast<const Enum*>(it->second));
|
||||
writeEnum(ostr, static_cast<const Enum*>(it->second), pSstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeEnum(std::ostream& ostr, const Enum* pEnum)
|
||||
void DocWriter::writeEnum(std::ostream& ostr, const Enum* pEnum, std::ostream* pSstr)
|
||||
{
|
||||
ostr << "<h3>";
|
||||
const std::string& name = pEnum->name();
|
||||
@@ -1865,7 +1982,7 @@ void DocWriter::writeEnum(std::ostream& ostr, const Enum* pEnum)
|
||||
if (pEnum->getAccess() != Symbol::ACC_PUBLIC)
|
||||
writeIcon(ostr, "protected");
|
||||
ostr << "</h3>\n";
|
||||
writeDescription(ostr, pEnum->getDocumentation());
|
||||
writeDescription(ostr, pEnum->getDocumentation(), pSstr);
|
||||
for (Enum::Iterator it = pEnum->begin(); it != pEnum->end(); ++it)
|
||||
{
|
||||
const std::string& name = (*it)->name();
|
||||
@@ -1875,7 +1992,7 @@ void DocWriter::writeEnum(std::ostream& ostr, const Enum* pEnum)
|
||||
if (!value.empty())
|
||||
ostr << " = " << htmlize(value);
|
||||
ostr << "</p>\n";
|
||||
writeDescription(ostr, (*it)->getDocumentation());
|
||||
writeDescription(ostr, (*it)->getDocumentation(), pSstr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1927,7 +2044,7 @@ void DocWriter::writeMethods(std::ostream& ostr, const Struct* pStruct)
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeFunctionsSummary(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeFunctionsSummary(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable funcs;
|
||||
pNameSpace->functions(funcs);
|
||||
@@ -1949,7 +2066,7 @@ void DocWriter::writeFunctionsSummary(std::ostream& ostr, const NameSpace* pName
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeFunctions(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeFunctions(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable funcs;
|
||||
pNameSpace->functions(funcs);
|
||||
@@ -1964,7 +2081,7 @@ void DocWriter::writeFunctions(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeFunction(std::ostream& ostr, const Function* pFunc)
|
||||
void DocWriter::writeFunction(std::ostream& ostr, const Function* pFunc, std::ostream* pSstr)
|
||||
{
|
||||
ostr << "<h3>";
|
||||
writeAnchor(ostr, pFunc->name(), pFunc);
|
||||
@@ -1978,6 +2095,12 @@ void DocWriter::writeFunction(std::ostream& ostr, const Function* pFunc)
|
||||
writeIcon(ostr, "inline");
|
||||
ostr << "</h3>\n";
|
||||
ostr << "<p class=\"decl\">";
|
||||
|
||||
const std::string& attrs = pFunc->getAttributeList();
|
||||
if (!attrs.empty())
|
||||
{
|
||||
ostr << "<i>" << htmlize(attrs) << "</i><br />";
|
||||
}
|
||||
const std::string& decl = pFunc->declaration();
|
||||
writeDecl(ostr, decl);
|
||||
if (!std::isalnum(decl[decl.length() - 1]))
|
||||
@@ -2015,7 +2138,7 @@ void DocWriter::writeFunction(std::ostream& ostr, const Function* pFunc)
|
||||
ostr << " = 0";
|
||||
ostr << ";</p>\n";
|
||||
|
||||
if (pFunc->attrs().has("deprecated"))
|
||||
if (pFunc->attrs().has("deprecated") || pFunc->getAttributeList().compare(0, 12, "[[deprecated") == 0)
|
||||
{
|
||||
writeDeprecated(ostr, "function");
|
||||
}
|
||||
@@ -2025,7 +2148,7 @@ void DocWriter::writeFunction(std::ostream& ostr, const Function* pFunc)
|
||||
if (doc.empty() && pFunc->isPublic() && !pOverridden && !pFunc->isConstructor() && !pFunc->isDestructor())
|
||||
logger().notice(std::string("Undocumented public function: ") + pFunc->fullName());
|
||||
|
||||
writeDescription(ostr, doc);
|
||||
writeDescription(ostr, doc, pSstr);
|
||||
if (pOverridden)
|
||||
{
|
||||
ostr << "<div class=\"description\"><p><b>" << tr("See_also") << ":</b> ";
|
||||
@@ -2035,7 +2158,7 @@ void DocWriter::writeFunction(std::ostream& ostr, const Function* pFunc)
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeVariables(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
void DocWriter::writeVariables(std::ostream& ostr, const NameSpace* pNameSpace, std::ostream* pSstr)
|
||||
{
|
||||
NameSpace::SymbolTable vars;
|
||||
pNameSpace->variables(vars);
|
||||
@@ -2052,18 +2175,18 @@ void DocWriter::writeVariables(std::ostream& ostr, const NameSpace* pNameSpace)
|
||||
for (NameSpace::Iterator it = vars.begin(); it != vars.end(); ++it)
|
||||
{
|
||||
if (it->second->getAccess() == Symbol::ACC_PUBLIC)
|
||||
writeVariable(ostr, static_cast<const Variable*>(it->second));
|
||||
writeVariable(ostr, static_cast<const Variable*>(it->second), pSstr);
|
||||
}
|
||||
for (NameSpace::Iterator it = vars.begin(); it != vars.end(); ++it)
|
||||
{
|
||||
if (it->second->getAccess() == Symbol::ACC_PROTECTED)
|
||||
writeVariable(ostr, static_cast<const Variable*>(it->second));
|
||||
writeVariable(ostr, static_cast<const Variable*>(it->second), pSstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeVariable(std::ostream& ostr, const Variable* pVar)
|
||||
void DocWriter::writeVariable(std::ostream& ostr, const Variable* pVar, std::ostream* pSstr)
|
||||
{
|
||||
ostr << "<h3>";
|
||||
writeAnchor(ostr, pVar->name(), pVar);
|
||||
@@ -2075,7 +2198,7 @@ void DocWriter::writeVariable(std::ostream& ostr, const Variable* pVar)
|
||||
ostr << "<p class=\"decl\">";
|
||||
writeDecl(ostr, pVar->declaration());
|
||||
ostr << ";</p>\n";
|
||||
writeDescription(ostr, pVar->getDocumentation());
|
||||
writeDescription(ostr, pVar->getDocumentation(), pSstr);
|
||||
}
|
||||
|
||||
|
||||
@@ -2099,9 +2222,10 @@ void DocWriter::writeLink(std::ostream& ostr, const std::string& uri, const std:
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeLink(std::ostream& ostr, const Symbol* pSymbol, const std::string& name)
|
||||
void DocWriter::writeLink(std::ostream& ostr, const Symbol* pSymbol, const std::string& name, std::ostream* pSstr)
|
||||
{
|
||||
ostr << "<a href=\"" << uriFor(pSymbol) << "\" title=\"" << titleFor(pSymbol) << "\">" << htmlizeName(name) << "</a>";
|
||||
if (pSstr) *pSstr << name;
|
||||
}
|
||||
|
||||
|
||||
@@ -2111,7 +2235,7 @@ void DocWriter::writeLink(std::ostream& ostr, const std::string& uri, const std:
|
||||
}
|
||||
|
||||
|
||||
void DocWriter::writeTargetLink(std::ostream& ostr, const std::string& uri, const std::string& text, const std::string& target)
|
||||
void DocWriter::writeTargetLink(std::ostream& ostr, const std::string& uri, const std::string& text, const std::string& target, std::ostream* pSstr)
|
||||
{
|
||||
if (_noFrames && target != "_blank")
|
||||
ostr << "<a href=\"" << uri << "\">" << text << "</a>";
|
||||
@@ -2119,6 +2243,7 @@ void DocWriter::writeTargetLink(std::ostream& ostr, const std::string& uri, cons
|
||||
ostr << "<a href=\"" << uri << "\" target=\"" << target << "\">" << text << "</a>";
|
||||
else
|
||||
ostr << "<a href=\"" << uri << "\">" << htmlize(text) << "</a>";
|
||||
if (pSstr) *pSstr << text;
|
||||
}
|
||||
|
||||
|
||||
@@ -2304,6 +2429,7 @@ void DocWriter::writePage(Page& page)
|
||||
|
||||
std::string path(pathFor(page.fileName));
|
||||
std::ofstream ostr(path.c_str());
|
||||
std::ostringstream sstr;
|
||||
if (!ostr.good()) throw Poco::CreateFileException(path);
|
||||
writeHeader(ostr, title, "js/iframeResizer.min.js");
|
||||
writeTitle(ostr, tr(category), title);
|
||||
@@ -2314,12 +2440,13 @@ void DocWriter::writePage(Page& page)
|
||||
{
|
||||
writeTOC(ostr, toc);
|
||||
}
|
||||
writeDescription(ostr, text);
|
||||
writeDescription(ostr, text, &sstr);
|
||||
writeCopyright(ostr);
|
||||
endContent(ostr);
|
||||
endBody(ostr);
|
||||
ostr << "<script>CollapsibleLists.apply(true)</script>" << std::endl;
|
||||
writeFooter(ostr);
|
||||
if (_searchIndex) writeSearchIndex(page.fileName, sstr.str());
|
||||
}
|
||||
|
||||
|
||||
@@ -2358,7 +2485,6 @@ void DocWriter::writeTOC(std::ostream& ostr, const TOC& toc)
|
||||
{
|
||||
ostr << "<div class=\"toc\">" << std::endl;
|
||||
ostr << "<ul class=\"collapsibleList\"><li>" << tr("TOC") << std::endl;
|
||||
int lastLevel = 0;
|
||||
std::vector<int> levelStack;
|
||||
levelStack.push_back(0);
|
||||
for (TOC::const_iterator it = toc.begin(); it != toc.end(); ++it)
|
||||
@@ -2383,7 +2509,6 @@ void DocWriter::writeTOC(std::ostream& ostr, const TOC& toc)
|
||||
ostr << "</li>" << std::endl;
|
||||
}
|
||||
ostr << "<li class=\"level" << level << "\"><a href=\"#" << it->id << "\">" << htmlize(it->title) << "</a>" << std::endl;
|
||||
lastLevel = level;
|
||||
}
|
||||
while (!levelStack.empty())
|
||||
{
|
||||
|
56
vendor/POCO/PocoDoc/src/DocWriter.h
vendored
56
vendor/POCO/PocoDoc/src/DocWriter.h
vendored
@@ -42,7 +42,7 @@ class DocWriter
|
||||
/// to a directory.
|
||||
{
|
||||
public:
|
||||
DocWriter(const Poco::CppParser::NameSpace::SymbolTable& symbols, const std::string& path, bool prettifyCode = true, bool noFrames = false);
|
||||
DocWriter(const Poco::CppParser::NameSpace::SymbolTable& symbols, const std::string& path, bool prettifyCode = true, bool noFrames = false, bool searchIndex = false);
|
||||
/// Creates the DocWriter.
|
||||
|
||||
~DocWriter();
|
||||
@@ -56,6 +56,9 @@ public:
|
||||
|
||||
void addPage(const std::string& path);
|
||||
/// Adds a page.
|
||||
|
||||
static const std::string DATABASE_DIR;
|
||||
static const std::string DATABASE_NAME;
|
||||
|
||||
protected:
|
||||
enum TextState
|
||||
@@ -100,6 +103,10 @@ protected:
|
||||
typedef std::map<std::string, std::string> StringMap;
|
||||
typedef std::map<std::string, Page> PageMap;
|
||||
|
||||
void initDatabase();
|
||||
void writeSearchIndex(std::string link, std::string content);
|
||||
static void writeSearchBox(std::ostream& ostr);
|
||||
|
||||
void writePages();
|
||||
void writePage(Page& page);
|
||||
void scanTOC(const std::string& text, TOC& toc);
|
||||
@@ -134,18 +141,18 @@ protected:
|
||||
static void endBody(std::ostream& ostr);
|
||||
static void beginContent(std::ostream& ostr);
|
||||
static void endContent(std::ostream& ostr);
|
||||
void writeDescription(std::ostream& ostr, const std::string& text);
|
||||
void writeDescriptionLine(std::ostream& ostr, const std::string& text, TextState& state);
|
||||
void writeDescription(std::ostream& ostr, const std::string& text, std::ostream* pSstr = nullptr);
|
||||
void writeDescriptionLine(std::ostream& ostr, const std::string& text, TextState& state, std::ostream* pSstr = nullptr);
|
||||
void writeSummary(std::ostream& ostr, const std::string& text, const std::string& uri);
|
||||
static std::string htmlize(const std::string& str);
|
||||
static std::string htmlize(char c);
|
||||
static TextState analyzeLine(const std::string& line);
|
||||
static std::string htmlizeName(const std::string& name);
|
||||
void writeText(std::ostream& ostr, const std::string& text);
|
||||
void writeText(std::ostream& ostr, std::string::const_iterator begin, const std::string::const_iterator& end);
|
||||
void writeText(std::ostream& ostr, const std::string& text, std::ostream* pSstr = nullptr);
|
||||
void writeText(std::ostream& ostr, std::string::const_iterator begin, const std::string::const_iterator& end, std::ostream* pSstr = nullptr);
|
||||
void writeDecl(std::ostream& ostr, const std::string& decl);
|
||||
void writeDecl(std::ostream& ostr, std::string::const_iterator begin, const std::string::const_iterator& end);
|
||||
bool writeSymbol(std::ostream& ostr, std::string& token, std::string::const_iterator& begin, const std::string::const_iterator& end);
|
||||
bool writeSymbol(std::ostream& ostr, std::string& token, std::string::const_iterator& begin, const std::string::const_iterator& end, std::ostream* pSstr = nullptr);
|
||||
bool writeSpecial(std::ostream& ostr, std::string& token, std::string::const_iterator& begin, const std::string::const_iterator& end);
|
||||
void nextToken(std::string::const_iterator& it, const std::string::const_iterator& end, std::string& token);
|
||||
void writeListItem(std::ostream& ostr, const std::string& text);
|
||||
@@ -155,31 +162,31 @@ protected:
|
||||
void writeInheritance(std::ostream& ostr, const Poco::CppParser::Struct* pStruct);
|
||||
void writeMethodSummary(std::ostream& ostr, const Poco::CppParser::Struct* pStruct);
|
||||
void writeNestedClasses(std::ostream& ostr, const Poco::CppParser::Struct* pStruct);
|
||||
void writeNameSpacesSummary(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeNameSpaces(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeClassesSummary(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeClasses(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeNameSpacesSummary(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeNameSpaces(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeClassesSummary(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeClasses(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeClassSummary(std::ostream& ostr, const Poco::CppParser::Struct* pStruct);
|
||||
void writeTypesSummary(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeAliasesSummary(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeTypes(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeAliases(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeType(std::ostream& ostr, const Poco::CppParser::TypeDef* pType);
|
||||
void writeEnums(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeEnum(std::ostream& ostr, const Poco::CppParser::Enum* pEnum);
|
||||
void writeTypesSummary(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeAliasesSummary(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeTypes(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeAliases(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeType(std::ostream& ostr, const Poco::CppParser::TypeDef* pType, std::ostream* pSstr = nullptr);
|
||||
void writeEnums(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeEnum(std::ostream& ostr, const Poco::CppParser::Enum* pEnum, std::ostream* pSstr);
|
||||
void writeConstructors(std::ostream& ostr, const Poco::CppParser::Struct* pStruct);
|
||||
void writeDestructor(std::ostream& ostr, const Poco::CppParser::Struct* pStruct);
|
||||
void writeMethods(std::ostream& ostr, const Poco::CppParser::Struct* pNameSpace);
|
||||
void writeFunctionsSummary(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeFunctions(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeFunction(std::ostream& ostr, const Poco::CppParser::Function* pFunc);
|
||||
void writeVariables(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace);
|
||||
void writeVariable(std::ostream& ostr, const Poco::CppParser::Variable* pVar);
|
||||
void writeFunctionsSummary(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeFunctions(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeFunction(std::ostream& ostr, const Poco::CppParser::Function* pFunc, std::ostream* pSstr = nullptr);
|
||||
void writeVariables(std::ostream& ostr, const Poco::CppParser::NameSpace* pNameSpace, std::ostream* pSstr = nullptr);
|
||||
void writeVariable(std::ostream& ostr, const Poco::CppParser::Variable* pVar, std::ostream* pSstr = nullptr);
|
||||
static void writeNameListItem(std::ostream& ostr, const std::string& name, const Poco::CppParser::Symbol* pSymbol, const Poco::CppParser::NameSpace* pNameSpace, bool& first);
|
||||
static void writeLink(std::ostream& ostr, const std::string& uri, const std::string& text);
|
||||
static void writeLink(std::ostream& ostr, const Poco::CppParser::Symbol* pSymbol, const std::string& text);
|
||||
static void writeLink(std::ostream& ostr, const Poco::CppParser::Symbol* pSymbol, const std::string& text, std::ostream* pSstr = nullptr);
|
||||
static void writeLink(std::ostream& ostr, const std::string& uri, const std::string& text, const std::string& linkClass);
|
||||
void writeTargetLink(std::ostream& ostr, const std::string& uri, const std::string& text, const std::string& target);
|
||||
void writeTargetLink(std::ostream& ostr, const std::string& uri, const std::string& text, const std::string& target, std::ostream* pSstr = nullptr);
|
||||
static void writeImageLink(std::ostream& ostr, const std::string& uri, const std::string& image, const std::string& alt);
|
||||
static void writeImage(std::ostream& ostr, const std::string& uri, const std::string& caption);
|
||||
static void writeIcon(std::ostream& ostr, const std::string& icon);
|
||||
@@ -212,6 +219,7 @@ private:
|
||||
bool _pendingLine;
|
||||
int _indent;
|
||||
int _titleId;
|
||||
bool _searchIndex;
|
||||
|
||||
static std::string _language;
|
||||
static StringMap _strings;
|
||||
|
38
vendor/POCO/PocoDoc/src/PocoDoc.cpp
vendored
38
vendor/POCO/PocoDoc/src/PocoDoc.cpp
vendored
@@ -113,7 +113,8 @@ class PocoDocApp: public Application
|
||||
public:
|
||||
PocoDocApp():
|
||||
_helpRequested(false),
|
||||
_writeEclipseTOC(false)
|
||||
_writeEclipseTOC(false),
|
||||
_searchIndexEnabled(false)
|
||||
{
|
||||
std::setlocale(LC_ALL, "");
|
||||
}
|
||||
@@ -168,6 +169,12 @@ protected:
|
||||
.required(false)
|
||||
.repeatable(false)
|
||||
.callback(OptionCallback<PocoDocApp>(this, &PocoDocApp::handleEclipse)));
|
||||
|
||||
options.addOption(
|
||||
Option("search-index", "s", "Enable search index (requires FTS5 support).")
|
||||
.required(false)
|
||||
.repeatable(false)
|
||||
.callback(OptionCallback<PocoDocApp>(this, &PocoDocApp::handleSearchIndex)));
|
||||
}
|
||||
|
||||
void handleHelp(const std::string& name, const std::string& value)
|
||||
@@ -201,6 +208,11 @@ protected:
|
||||
_writeEclipseTOC = true;
|
||||
}
|
||||
|
||||
void handleSearchIndex(const std::string& name, const std::string& value)
|
||||
{
|
||||
_searchIndexEnabled = true;
|
||||
}
|
||||
|
||||
void handleConfig(const std::string& name, const std::string& value)
|
||||
{
|
||||
loadConfiguration(value, -200);
|
||||
@@ -233,7 +245,7 @@ protected:
|
||||
for (StringTokenizer::Iterator itg = excTokenizer.begin(); itg != excTokenizer.end(); ++itg)
|
||||
{
|
||||
Glob glob(*itg);
|
||||
if (glob.match(p.getFileName()))
|
||||
if (glob.match(p.getFileName()) || glob.match(p.toString()))
|
||||
include = false;
|
||||
}
|
||||
if (include)
|
||||
@@ -321,11 +333,6 @@ protected:
|
||||
logger().log(exc);
|
||||
++errors;
|
||||
}
|
||||
catch (std::exception& exc)
|
||||
{
|
||||
logger().error(std::string(exc.what()));
|
||||
++errors;
|
||||
}
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
@@ -351,7 +358,21 @@ protected:
|
||||
File file(path);
|
||||
file.createDirectories();
|
||||
|
||||
DocWriter writer(_gst, path.toString(), config().getBool("PocoDoc.prettifyCode", false), _writeEclipseTOC);
|
||||
if (_searchIndexEnabled || config().getBool("PocoDoc.searchIndex", false))
|
||||
{
|
||||
#if defined(POCO_ENABLE_SQLITE_FTS5)
|
||||
std::string dbDirectory = path.toString() + DocWriter::DATABASE_DIR;
|
||||
Path dbPath(dbDirectory);
|
||||
dbPath.makeDirectory();
|
||||
File dbFile(dbPath);
|
||||
dbFile.createDirectories();
|
||||
_searchIndexEnabled = true;
|
||||
#else
|
||||
logger().error("FTS5 is not enabled, search is not supported");
|
||||
#endif
|
||||
}
|
||||
|
||||
DocWriter writer(_gst, path.toString(), config().getBool("PocoDoc.prettifyCode", false), _writeEclipseTOC, _searchIndexEnabled);
|
||||
|
||||
if (config().hasProperty("PocoDoc.pages"))
|
||||
{
|
||||
@@ -520,6 +541,7 @@ protected:
|
||||
private:
|
||||
bool _helpRequested;
|
||||
bool _writeEclipseTOC;
|
||||
bool _searchIndexEnabled;
|
||||
Poco::CppParser::NameSpace::SymbolTable _gst;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user