58# define DBG_CTX(x) printf x
60# define DBG_CTX(x) do { } while(0)
63# ifdef SQLITE3_DEBUG_SQL
65static void sqlLog(
void *dbName,
const char *sql){
66 msg(
"SQL: '{}'\n", sql);
73 "CREATE TABLE IF NOT EXISTS meta (\n"
74 "\t-- Information about this db and how it was generated.\n"
76 "\tdoxygen_version TEXT PRIMARY KEY NOT NULL,\n"
84 "\tschema_version TEXT NOT NULL, -- Schema-specific semver\n"
86 "\tgenerated_at TEXT NOT NULL,\n"
87 "\tgenerated_on TEXT NOT NULL,\n"
89 "\tproject_name TEXT NOT NULL,\n"
90 "\tproject_number TEXT,\n"
91 "\tproject_brief TEXT\n"
95 "CREATE TABLE IF NOT EXISTS includes (\n"
96 "\t-- #include relations.\n"
97 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
98 "\tlocal INTEGER NOT NULL,\n"
99 "\tsrc_id INTEGER NOT NULL REFERENCES path, -- File id of the includer.\n"
100 "\tdst_id INTEGER NOT NULL REFERENCES path, -- File id of the includee.\n"
105 "\tUNIQUE(local, src_id, dst_id) ON CONFLICT IGNORE\n"
109 "CREATE TABLE IF NOT EXISTS contains (\n"
110 "\t-- inner/outer relations (file, namespace, dir, class, group, page)\n"
111 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
112 "\tinner_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
113 "\touter_rowid INTEGER NOT NULL REFERENCES compounddef\n"
130 "CREATE TABLE IF NOT EXISTS path (\n"
131 "\t-- Paths of source files and includes.\n"
132 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
133 "\ttype INTEGER NOT NULL, -- 1:file 2:dir\n"
134 "\tlocal INTEGER NOT NULL,\n"
135 "\tfound INTEGER NOT NULL,\n"
136 "\tname TEXT NOT NULL\n"
140 "CREATE TABLE IF NOT EXISTS refid (\n"
141 "\t-- Distinct refid for all documented entities.\n"
142 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
143 "\trefid TEXT NOT NULL UNIQUE\n"
147 "CREATE TABLE IF NOT EXISTS xrefs (\n"
148 "\t-- Cross-reference relation\n"
149 "\t-- (combines xml <referencedby> and <references> nodes).\n"
150 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
151 "\tsrc_rowid INTEGER NOT NULL REFERENCES refid, -- referrer id.\n"
152 "\tdst_rowid INTEGER NOT NULL REFERENCES refid, -- referee id.\n"
153 "\tcontext TEXT NOT NULL, -- inline, argument, initializer\n"
154 "\t-- Just need to know they link; ignore duplicates.\n"
155 "\tUNIQUE(src_rowid, dst_rowid, context) ON CONFLICT IGNORE\n"
159 "CREATE TABLE IF NOT EXISTS memberdef (\n"
160 "\t-- All processed identifiers.\n"
161 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
162 "\tname TEXT NOT NULL,\n"
163 "\tdefinition TEXT,\n"
165 "\targsstring TEXT,\n"
167 "\tinitializer TEXT,\n"
171 "\tprot INTEGER DEFAULT 0, -- 0:public 1:protected 2:private 3:package\n"
172 "\tstatic INTEGER DEFAULT 0, -- 0:no 1:yes\n"
173 "\textern INTEGER DEFAULT 0, -- 0:no 1:yes\n"
174 "\tconst INTEGER DEFAULT 0, -- 0:no 1:yes\n"
175 "\texplicit INTEGER DEFAULT 0, -- 0:no 1:yes\n"
176 "\tinline INTEGER DEFAULT 0, -- 0:no 1:yes 2:both (set after encountering inline and not-inline)\n"
177 "\tfinal INTEGER DEFAULT 0, -- 0:no 1:yes\n"
178 "\tsealed INTEGER DEFAULT 0, -- 0:no 1:yes\n"
179 "\tnew INTEGER DEFAULT 0, -- 0:no 1:yes\n"
180 "\toptional INTEGER DEFAULT 0, -- 0:no 1:yes\n"
181 "\trequired INTEGER DEFAULT 0, -- 0:no 1:yes\n"
182 "\tvolatile INTEGER DEFAULT 0, -- 0:no 1:yes\n"
183 "\tvirt INTEGER DEFAULT 0, -- 0:no 1:virtual 2:pure-virtual\n"
184 "\tmutable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
185 "\tthread_local INTEGER DEFAULT 0, -- 0:no 1:yes\n"
186 "\tinitonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
187 "\tattribute INTEGER DEFAULT 0, -- 0:no 1:yes\n"
188 "\tproperty INTEGER DEFAULT 0, -- 0:no 1:yes\n"
189 "\treadonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
190 "\tbound INTEGER DEFAULT 0, -- 0:no 1:yes\n"
191 "\tconstrained INTEGER DEFAULT 0, -- 0:no 1:yes\n"
192 "\ttransient INTEGER DEFAULT 0, -- 0:no 1:yes\n"
193 "\tmaybevoid INTEGER DEFAULT 0, -- 0:no 1:yes\n"
194 "\tmaybedefault INTEGER DEFAULT 0, -- 0:no 1:yes\n"
195 "\tmaybeambiguous INTEGER DEFAULT 0, -- 0:no 1:yes\n"
196 "\treadable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
197 "\twritable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
198 "\tgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
199 "\tprivategettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
200 "\tprotectedgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
201 "\tsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
202 "\tprivatesettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
203 "\tprotectedsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
204 "\taccessor INTEGER DEFAULT 0, -- 0:no 1:assign 2:copy 3:retain 4:string 5:weak\n"
205 "\taddable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
206 "\tremovable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
207 "\traisable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
208 "\tkind TEXT NOT NULL, -- 'macro definition' 'function' 'variable' 'typedef' 'enumeration' 'enumvalue' 'signal' 'slot' 'friend' 'dcop' 'property' 'event' 'interface' 'service'\n"
209 "\tbodystart INTEGER DEFAULT 0, -- starting line of definition\n"
210 "\tbodyend INTEGER DEFAULT 0, -- ending line of definition\n"
211 "\tbodyfile_id INTEGER REFERENCES path, -- file of definition\n"
212 "\tfile_id INTEGER NOT NULL REFERENCES path, -- file where this identifier is located\n"
213 "\tline INTEGER NOT NULL, -- line where this identifier is located\n"
214 "\tcolumn INTEGER NOT NULL, -- column where this identifier is located\n"
215 "\tdetaileddescription TEXT,\n"
216 "\tbriefdescription TEXT,\n"
217 "\tinbodydescription TEXT,\n"
218 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
222 "CREATE TABLE IF NOT EXISTS member (\n"
223 "\t-- Memberdef <-> containing compound relation.\n"
224 "\t-- Similar to XML listofallmembers.\n"
225 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
226 "\tscope_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
227 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef,\n"
228 "\tprot INTEGER NOT NULL,\n"
229 "\tvirt INTEGER NOT NULL,\n"
230 "\tUNIQUE(scope_rowid, memberdef_rowid)\n"
234 "CREATE TABLE IF NOT EXISTS reimplements (\n"
235 "\t-- Inherited member reimplementation relations.\n"
236 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
237 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplementing memberdef id.\n"
238 "\treimplemented_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplemented memberdef id.\n"
239 "\tUNIQUE(memberdef_rowid, reimplemented_rowid) ON CONFLICT IGNORE\n"
243 "CREATE TABLE IF NOT EXISTS compounddef (\n"
244 "\t-- Class/struct definitions.\n"
245 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
246 "\tname TEXT NOT NULL,\n"
249 "\tkind TEXT NOT NULL, -- 'category' 'class' 'constants' 'dir' 'enum' 'example' 'exception' 'file' 'group' 'interface' 'library' 'module' 'namespace' 'package' 'page' 'protocol' 'record' 'service' 'singleton' 'struct' 'type' 'union' 'unknown' ''\n"
251 "\tfile_id INTEGER NOT NULL REFERENCES path,\n"
252 "\tline INTEGER NOT NULL,\n"
253 "\tcolumn INTEGER NOT NULL,\n"
254 "\theader_id INTEGER REFERENCES path,\n"
255 "\tfinal INTEGER, -- 0:no 1:yes\n"
256 "\tsealed INTEGER, -- 0:no 1:yes\n"
257 "\tabstract INTEGER, -- 0:no 1:yes\n"
258 "\tref INTEGER, -- 0:no 1:yes\n"
259 "\tdetaileddescription TEXT,\n"
260 "\tbriefdescription TEXT,\n"
261 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
265 "CREATE TABLE IF NOT EXISTS compoundref (\n"
266 "\t-- Inheritance relation.\n"
267 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
268 "\tbase_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
269 "\tderived_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
270 "\tprot INTEGER NOT NULL,\n"
271 "\tvirt INTEGER NOT NULL,\n"
272 "\tUNIQUE(base_rowid, derived_rowid)\n"
276 "CREATE TABLE IF NOT EXISTS param (\n"
277 "\t-- All processed parameters.\n"
278 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
279 "\tattributes TEXT,\n"
285 "\ttypeconstraint TEXT,\n"
286 "\tbriefdescription TEXT\n"
288 "CREATE UNIQUE INDEX idx_param ON param\n"
292 "CREATE TABLE IF NOT EXISTS memberdef_param (\n"
293 "\t-- Junction table for memberdef parameters.\n"
294 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
295 "\tmemberdef_id INTEGER NOT NULL REFERENCES memberdef,\n"
296 "\tparam_id INTEGER NOT NULL REFERENCES param\n"
323 "CREATE VIEW IF NOT EXISTS def (\n"
324 "\t-- Combined summary of all -def types for easier joins.\n"
334 "\tmemberdef.kind,\n"
335 "\tmemberdef.name,\n"
336 "\tmemberdef.briefdescription \n"
338 "JOIN memberdef ON refid.rowid=memberdef.rowid \n"
343 "\tcompounddef.kind,\n"
344 "\tcompounddef.name,\n"
346 "\t\tWHEN briefdescription IS NOT NULL \n"
347 "\t\tTHEN briefdescription \n"
351 "JOIN compounddef ON refid.rowid=compounddef.rowid;"
355 "CREATE VIEW IF NOT EXISTS local_file (\n"
356 "\t-- File paths found within the project.\n"
365 "FROM path WHERE path.type=1 AND path.local=1 AND path.found=1;\n"
369 "CREATE VIEW IF NOT EXISTS external_file (\n"
370 "\t-- File paths outside the project (found or not).\n"
379 "FROM path WHERE path.type=1 AND path.local=0;\n"
383 "CREATE VIEW IF NOT EXISTS inline_xrefs (\n"
384 "\t-- Crossrefs from inline member source.\n"
391 "\txrefs.src_rowid,\n"
392 "\txrefs.dst_rowid\n"
393 "FROM xrefs WHERE xrefs.context='inline';\n"
397 "CREATE VIEW IF NOT EXISTS argument_xrefs (\n"
398 "\t-- Crossrefs from member def/decl arguments\n"
405 "\txrefs.src_rowid,\n"
406 "\txrefs.dst_rowid\n"
407 "FROM xrefs WHERE xrefs.context='argument';\n"
411 "CREATE VIEW IF NOT EXISTS initializer_xrefs (\n"
412 "\t-- Crossrefs from member initializers\n"
419 "\txrefs.src_rowid,\n"
420 "\txrefs.dst_rowid\n"
421 "FROM xrefs WHERE xrefs.context='initializer';\n"
425 "CREATE VIEW IF NOT EXISTS inner_outer\n"
426 "\t-- Joins 'contains' relations to simplify inner/outer 'rel' queries.\n"
430 "FROM def as inner\n"
431 "\tJOIN contains ON inner.rowid=contains.inner_rowid\n"
432 "\tJOIN def AS outer ON outer.rowid=contains.outer_rowid;\n"
436 "CREATE VIEW IF NOT EXISTS rel (\n"
437 "\t-- Boolean indicator of relations available for a given entity.\n"
438 "\t-- Join to (compound-|member-)def to find fetch-worthy relations.\n"
442 "\tinnercompounds,\n"
443 "\toutercompounds,\n"
452 "\tinnernamespaces,\n"
453 "\touternamespaces,\n"
462 "\targument_links_in,\n"
463 "\targument_links_out,\n"
464 "\tinitializer_links_in,\n"
465 "\tinitializer_links_out\n"
469 "\tEXISTS (SELECT rowid FROM reimplements WHERE reimplemented_rowid=def.rowid),\n"
470 "\tEXISTS (SELECT rowid FROM reimplements WHERE memberdef_rowid=def.rowid),\n"
471 "\t-- rowid/kind for inner, [rowid:1/kind:1] for outer\n"
472 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid),\n"
473 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid),\n"
474 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='page'),\n"
475 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='page'),\n"
476 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='dir'),\n"
477 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='dir'),\n"
478 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='file'),\n"
479 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='file'),\n"
480 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind in (\n"
481 "'category','class','enum','exception','interface','module','protocol',\n"
482 "'record','service','singleton','struct','type','union'\n"
484 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1] in (\n"
485 "'category','class','enum','exception','interface','module','protocol',\n"
486 "'record','service','singleton','struct','type','union'\n"
488 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='namespace'),\n"
489 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='namespace'),\n"
490 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='group'),\n"
491 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='group'),\n"
492 "\tEXISTS (SELECT rowid FROM member WHERE scope_rowid=def.rowid),\n"
493 "\tEXISTS (SELECT rowid FROM member WHERE memberdef_rowid=def.rowid),\n"
494 "\tEXISTS (SELECT rowid FROM compoundref WHERE base_rowid=def.rowid),\n"
495 "\tEXISTS (SELECT rowid FROM compoundref WHERE derived_rowid=def.rowid),\n"
496 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE dst_rowid=def.rowid),\n"
497 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE src_rowid=def.rowid),\n"
498 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE dst_rowid=def.rowid),\n"
499 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE src_rowid=def.rowid),\n"
500 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE dst_rowid=def.rowid),\n"
501 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE src_rowid=def.rowid)\n"
502 "FROM def ORDER BY def.rowid;"
510 sqlite3 *
db =
nullptr;
519 "( doxygen_version, schema_version, generated_at, generated_on, project_name, project_number, project_brief )"
521 "(:doxygen_version,:schema_version,:generated_at,:generated_on,:project_name,:project_number,:project_brief )"
526 "INSERT INTO includes "
527 "( local, src_id, dst_id ) "
529 "(:local,:src_id,:dst_id )"
533 "SELECT COUNT(*) FROM includes WHERE "
534 "local=:local AND src_id=:src_id AND dst_id=:dst_id"
539 "INSERT INTO contains "
540 "( inner_rowid, outer_rowid )"
542 "(:inner_rowid,:outer_rowid )"
547 "SELECT rowid FROM path WHERE name=:name"
552 "( type, local, found, name )"
554 "(:type,:local,:found,:name )"
559 "SELECT rowid FROM refid WHERE refid=:refid"
572 "( src_rowid, dst_rowid, context )"
574 "(:src_rowid,:dst_rowid,:context )"
578 "INSERT INTO reimplements "
579 "( memberdef_rowid, reimplemented_rowid )"
581 "(:memberdef_rowid,:reimplemented_rowid )"
586 "SELECT EXISTS (SELECT * FROM memberdef WHERE rowid = :rowid)"
592 "SELECT * FROM memberdef WHERE "
593 "rowid = :rowid AND inline != 2 AND inline != :new_inline"
599 "INSERT INTO memberdef "
655 "detaileddescription,"
699 ":protectedsettable,"
700 ":protectedgettable,"
715 ":detaileddescription,"
729 "UPDATE memberdef SET "
731 "file_id = :file_id,"
734 "detaileddescription = 'Declaration: ' || :detaileddescription || 'Definition: ' || detaileddescription,"
735 "briefdescription = 'Declaration: ' || :briefdescription || 'Definition: ' || briefdescription,"
736 "inbodydescription = 'Declaration: ' || :inbodydescription || 'Definition: ' || inbodydescription "
737 "WHERE rowid = :rowid"
741 "UPDATE memberdef SET "
743 "bodystart = :bodystart,"
744 "bodyend = :bodyend,"
745 "bodyfile_id = :bodyfile_id,"
746 "detaileddescription = 'Declaration: ' || detaileddescription || 'Definition: ' || :detaileddescription,"
747 "briefdescription = 'Declaration: ' || briefdescription || 'Definition: ' || :briefdescription,"
748 "inbodydescription = 'Declaration: ' || inbodydescription || 'Definition: ' || :inbodydescription "
749 "WHERE rowid = :rowid"
754 "INSERT INTO member "
755 "( scope_rowid, memberdef_rowid, prot, virt ) "
757 "(:scope_rowid,:memberdef_rowid,:prot,:virt )"
762 "INSERT INTO compounddef "
778 "detaileddescription"
796 ":detaileddescription"
802 "SELECT * FROM compounddef WHERE rowid = :rowid"
808 "INSERT INTO compoundref "
809 "( base_rowid, derived_rowid, prot, virt ) "
811 "(:base_rowid,:derived_rowid,:prot,:virt )"
816 "SELECT rowid FROM param WHERE "
817 "(attributes IS NULL OR attributes=:attributes) AND "
818 "(type IS NULL OR type=:type) AND "
819 "(declname IS NULL OR declname=:declname) AND "
820 "(defname IS NULL OR defname=:defname) AND "
821 "(array IS NULL OR array=:array) AND "
822 "(defval IS NULL OR defval=:defval) AND "
823 "typeconstraint IS :typeconstraint AND "
824 "(briefdescription IS NULL OR briefdescription=:briefdescription)"
829 "( attributes, type, declname, defname, array, defval, typeconstraint, briefdescription ) "
831 "(:attributes,:type,:declname,:defname,:array,:defval,:typeconstraint,:briefdescription)"
836 "INSERT INTO memberdef_param "
837 "( memberdef_id, param_id)"
839 "(:memberdef_id,:param_id)"
855 const DString &anchor,std::string_view
858 std::string rs = file.
str();
874 int idx = sqlite3_bind_parameter_index(s.
stmt, name);
876 err(
"sqlite3_bind_parameter_index({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
879 int rv = sqlite3_bind_text(s.
stmt, idx, value.
data(), -1, SQLITE_TRANSIENT);
881 err(
"sqlite3_bind_text({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
889 int idx = sqlite3_bind_parameter_index(s.
stmt, name);
891 err(
"sqlite3_bind_parameter_index({})[{}] failed to find column: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
894 int rv = sqlite3_bind_int(s.
stmt, idx, value);
896 err(
"sqlite3_bind_int({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
910 int rc = sqlite3_step(s.
stmt);
911 if (rc!=SQLITE_DONE && rc!=SQLITE_ROW)
913 DBG_CTX((
"sqlite3_step: %s (rc: %d)\n", sqlite3_errmsg(s.
db), rc));
914 sqlite3_reset(s.
stmt);
915 sqlite3_clear_bindings(s.
stmt);
918 if (getRowId && select) rowid = sqlite3_column_int(s.
stmt, 0);
919 if (getRowId && !select) rowid =
static_cast<int>(sqlite3_last_insert_rowid(s.
db));
920 sqlite3_reset(s.
stmt);
921 sqlite3_clear_bindings(s.
stmt);
928 if (name==
nullptr)
return rowid;
987 return test ? true :
false;
995 return test ? true :
false;
1002 return test ? true :
false;
1007 if (src_refid.
rowid==-1||dst_refid.
rowid==-1)
1042 if (declAl.
size()>0)
1044 auto defIt = defAl.
begin();
1049 if (defIt!=defAl.
end())
1055 if (!a.attrib.empty())
1060 if (!a.type.empty())
1065 for (
const auto &s : list)
1075 if (!a.name.empty())
1080 if (defArg && !defArg->
name.
empty() && defArg->
name!=a.name)
1085 if (!a.array.empty())
1090 if (!a.defval.empty())
1103 DBG_CTX((
"error INSERT params failed\n"));
1142 if (md->
memberType()==MemberType::EnumValue)
return;
1161 else if (typeStr==
"virtual") typeStr=
"";
1168 int rc = sqlite3_prepare_v2(db,s.
query,-1,&s.
stmt,
nullptr);
1171 err(
"prepare failed for:\n {}\n {}\n", s.
query, sqlite3_errmsg(db));
1213 char * sErrMsg =
nullptr;
1214 sqlite3_exec(db,
"BEGIN TRANSACTION",
nullptr,
nullptr, &sErrMsg);
1219 char * sErrMsg =
nullptr;
1220 sqlite3_exec(db,
"END TRANSACTION",
nullptr,
nullptr, &sErrMsg);
1225 char * sErrMsg =
nullptr;
1226 sqlite3_exec(db,
"PRAGMA synchronous = OFF",
nullptr,
nullptr, &sErrMsg);
1227 sqlite3_exec(db,
"PRAGMA journal_mode = MEMORY",
nullptr,
nullptr, &sErrMsg);
1228 sqlite3_exec(db,
"PRAGMA temp_store = MEMORY;",
nullptr,
nullptr, &sErrMsg);
1233 msg(
"Initializing DB schema (tables)...\n");
1237 char *errmsg =
nullptr;
1238 int rc = sqlite3_exec(db, q,
nullptr,
nullptr, &errmsg);
1239 if (rc != SQLITE_OK)
1241 err(
"failed to execute query: {}\n\t{}\n", q, errmsg);
1250 msg(
"Initializing DB schema (views)...\n");
1254 char *errmsg =
nullptr;
1255 int rc = sqlite3_exec(db, q,
nullptr,
nullptr, &errmsg);
1256 if (rc != SQLITE_OK)
1258 err(
"failed to execute query: {}\n\t{}\n", q, errmsg);
1280 for (
const auto &cd : cl)
1282 if (!cd->isHidden() && !cd->isAnonymous())
1295 for (
const auto &cd : cl)
1307 for (
const auto &mod : ml)
1320 for (
const auto &pd : pl)
1323 pd->getGroupDef() ? pd->getOutputFileBase()+
"_"+pd->name() : pd->getOutputFileBase()
1334 for (
const auto &sgd : gl)
1346 for (
const auto &fd: fl)
1358 for (
const auto &subdir : dl)
1370 for (
const auto &nd : nl)
1372 if (!nd->isHidden() && !nd->isAnonymous())
1391 if (!a.type.empty())
1397 if (!a.name.empty())
1404 if (!a.defval.empty())
1410 DString typeConstraint = a.typeConstraint;
1412 const DString ¶mName = a.name.
empty() ? a.type : a.name;
1413 for (
const Argument &tc : typeConstraints)
1415 if (tc.name==paramName && !tc.type.
empty())
1417 if (!typeConstraint.
empty()) typeConstraint+=
", ";
1418 typeConstraint+=tc.type;
1421 if (!typeConstraint.
empty())
1452 if (doc.
empty())
return "";
1464 auto astImpl =
dynamic_cast<const DocNodeAST*
>(ast.get());
1472 std::visit(visitor,astImpl->root);
1599 if (md->
memberType()==MemberType::EnumValue)
return;
1621 struct SqlStmt memberdef_update;
1628 if (bodyfile_id == -1)
1630 sqlite3_clear_bindings(memberdef_update.
stmt);
1664 step(memberdef_update,
true);
1672 for (
const auto &rmd : refList)
1678 for (
const auto &rmd : refByList)
1710 if (md->
memberType() == MemberType::Variable)
1728 if (bitfield.
at(0)==
':') bitfield=bitfield.
mid(1);
1732 else if (md->
memberType() == MemberType::Property)
1749 else if (md->
isCopy()) accessor = 2;
1750 else if (md->
isRetain()) accessor = 3;
1751 else if (md->
isStrong()) accessor = 4;
1752 else if (md->
isWeak()) accessor = 5;
1759 else if (md->
memberType() == MemberType::Event)
1794 if (!typeStr.
empty())
1819 for (
const auto &s : list)
1823 DBG_CTX((
"initializer:%s %s %s %d\n",
1860 if (bodyfile_id == -1)
1880 else if (md->
memberType()==MemberType::Define &&
1902 struct Refid scope_refid,
1907 if (ml==
nullptr)
return;
1908 for (
const auto &md : *ml)
1924 for (
auto &mi : *mni)
2016 DBG_CTX((
"-----> ClassDef includeInfo for %s\n",
qPrint(nm)));
2017 DBG_CTX((
" local : %d\n", ii->local));
2018 DBG_CTX((
" imported : %d\n", ii->imported));
2023 DBG_CTX((
" file_id : %d\n", file_id));
2024 DBG_CTX((
" header_id: %d\n", header_id));
2053 struct Refid derived_refid =
insertRefid(bcd.classDef->getOutputFileBase());
2072 mg->documentation());
2151 mg->documentation());
2211 mg->documentation());
2271 if(ii.fileDef->isReference())
2274 DString tagfile = ii.fileDef->getReference();
2275 dst_path = ii.fileDef->absFilePath();
2280 dst_path = ii.fileDef->absFilePath();
2286 dst_id =
insertPath(ii.includeName,isLocal,
false);
2289 DBG_CTX((
"-----> FileDef includeInfo for %s\n",
qPrint(ii.includeName)));
2290 DBG_CTX((
" local: %d\n", isLocal));
2294 DBG_CTX((
"include: %s\n",
qPrint(ii.fileDef->absFilePath())));
2296 DBG_CTX((
" src_id : %d\n", src_id));
2297 DBG_CTX((
" dst_id: %d\n", dst_id));
2320 if(ii.fileDef->isReference())
2323 DString tagfile = ii.fileDef->getReference();
2324 src_path = ii.fileDef->absFilePath();
2329 src_path = ii.fileDef->absFilePath();
2335 src_id =
insertPath(ii.includeName,isLocal,
false);
2362 mg->documentation());
2435 mg->documentation());
2509 qrefid+=
"_"+pd->
name();
2511 if (qrefid==
"index") qrefid=
"indexpage";
2539 title = si->
title();
2543 title = pd->
title();
2573 sqlite3 *db =
nullptr;
2575 int rc = sqlite3_initialize();
2576 if (rc != SQLITE_OK)
2578 err(
"sqlite3_initialize failed\n");
2582 std::string dbFileName =
"doxygen_sqlite3.db";
2583 FileInfo fi(outputDirectory.
str()+
"/"+dbFileName);
2593 err(
"doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n");
2598 rc = sqlite3_open_v2(
2601 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
2604 if (rc != SQLITE_OK)
2607 err(
"Database open failed: doxygen_sqlite3.db\n");
2628# ifdef SQLITE3_DEBUG
2630 sqlite3_trace(db, &sqlLog,
nullptr);
2641 err(
"sqlite generator: prepareStatements failed!\n");
2650 msg(
"Generating Sqlite3 output for class {}\n",cd->name());
2657 msg(
"Generating Sqlite3 output for concept {}\n",cd->name());
2664 msg(
"Generating Sqlite3 output for module {}\n",mod->name());
2671 msg(
"Generating Sqlite3 output for namespace {}\n",nd->name());
2678 for (
const auto &fd : *fn)
2680 msg(
"Generating Sqlite3 output for file {}\n",fd->name());
2688 msg(
"Generating Sqlite3 output for group {}\n",gd->name());
2695 msg(
"Generating Sqlite3 output for page {}\n",pd->name());
2702 msg(
"Generating Sqlite3 output for dir {}\n",dd->name());
2709 msg(
"Generating Sqlite3 output for example {}\n",pd->name());
2716 msg(
"Generating Sqlite3 output for the main page\n");
This class contains the information about the argument of a function or template.
This class represents an function or template argument list.
bool constSpecifier() const
bool volatileSpecifier() const
A abstract class representing of a compound symbol.
virtual bool isAbstract() const =0
Returns true if there is at least one pure virtual member in this class.
virtual bool isFinal() const =0
Returns true if this class is marked as final.
virtual const ArgumentList & templateArguments() const =0
Returns the template arguments of this class.
virtual const MemberLists & getMemberLists() const =0
Returns the list containing the list of members sorted per type.
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual bool isSealed() const =0
Returns true if this class is marked as sealed.
virtual Protection protection() const =0
Return the protection level (Public,Protected,Private) in which this compound was found.
virtual DString compoundTypeString() const =0
Returns the type of compound as a string.
virtual const ArgumentList & typeConstraints() const =0
virtual const MemberNameInfoLinkedMap & memberNameInfoLinkedMap() const =0
Returns a dictionary of all members.
virtual bool isImplicitTemplateInstance() const =0
virtual const MemberGroupList & getMemberGroups() const =0
Returns the member groups defined for this class.
virtual bool isRef() const =0
Returns true if this class is a C# ref struct or a C++/CLI ref class.
virtual ClassLinkedRefMap getClasses() const =0
returns the classes nested into this class
virtual FileDef * getFileDef() const =0
Returns the file in which this compound's definition can be found.
virtual const IncludeInfo * includeInfo() const =0
virtual DString title() const =0
virtual const BaseClassList & subClasses() const =0
Returns the list of sub classes that directly derive from this class.
virtual ArgumentList getTemplateParameterList() const =0
virtual const FileDef * getFileDef() const =0
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
DString mid(size_t index, size_t len=npos) const
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
char & at(size_t i)
Returns a reference to the character at index i.
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
const std::string & str() const
bool stripPrefix(const DString &prefix)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
The common base class of all entity definitions found in the sources.
virtual DString briefDescription(bool abbreviate=false) const =0
virtual int getEndBodyLine() const =0
virtual DString getDefFileExtension() const =0
virtual int docLine() const =0
virtual DString getDefFileName() const =0
virtual DString documentation() const =0
virtual DString inbodyDocumentation() const =0
virtual int getDefLine() const =0
virtual DefType definitionType() const =0
virtual const DString & name() const =0
virtual const FileDef * getBodyDef() const =0
virtual size_t getDefColumn() const =0
virtual bool isAnonymous() const =0
virtual DString displayName(bool includeScope=true) const =0
virtual bool isHidden() const =0
virtual DString anchor() const =0
virtual Definition * getOuterScope() const =0
virtual DString docFile() const =0
virtual const MemberVector & getReferencedByMembers() const =0
virtual int getStartBodyLine() const =0
virtual bool isReference() const =0
virtual const MemberVector & getReferencesMembers() const =0
virtual DString getOutputFileBase() const =0
A model of a directory symbol.
virtual const DirList & subDirs() const =0
virtual const FileList & getFiles() const =0
Class representing a directory in the file system.
bool remove(const std::string &path, bool acceptsAbsPath=true) const
Class representing the abstract syntax tree of a documentation block.
static NamespaceLinkedMap * namespaceLinkedMap
static ConceptLinkedMap * conceptLinkedMap
static std::unique_ptr< PageDef > mainPage
static FileNameLinkedMap * inputNameLinkedMap
static ClassLinkedMap * classLinkedMap
static PageLinkedMap * exampleLinkedMap
static PageLinkedMap * pageLinkedMap
static DirLinkedMap * dirLinkedMap
static GroupLinkedMap * groupLinkedMap
A model of a file symbol.
virtual const NamespaceLinkedRefMap & getNamespaces() const =0
virtual const MemberGroupList & getMemberGroups() const =0
virtual DString absFilePath() const =0
virtual const DString & docName() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual const IncludeInfoList & includeFileList() const =0
virtual const MemberLists & getMemberLists() const =0
virtual DString title() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const IncludeInfoList & includedByFileList() const =0
Minimal replacement for QFileInfo.
std::string absFilePath() const
A model of a group of symbols.
virtual DString groupTitle() const =0
virtual const GroupList & getSubGroups() const =0
virtual const FileList & getFiles() const =0
virtual const MemberLists & getMemberLists() const =0
virtual const MemberGroupList & getMemberGroups() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const PageLinkedRefMap & getPages() const =0
virtual const NamespaceLinkedRefMap & getNamespaces() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual const ModuleLinkedRefMap & getModules() const =0
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
DString convertCharEntitiesToUTF8(const DString &s) const
Class representing the data associated with a #include statement.
const T * find(const std::string &key) const
A model of a class/file/namespace member symbol.
virtual bool isInitonly() const =0
virtual bool isAssign() const =0
virtual bool isExplicit() const =0
virtual bool isNew() const =0
virtual bool isMaybeVoid() const =0
virtual DString argsString() const =0
virtual bool isSealed() const =0
virtual DString definition() const =0
virtual const ClassDef * getClassDef() const =0
virtual const ArgumentList & templateArguments() const =0
virtual const DString & initializer() const =0
virtual bool isSettable() const =0
virtual bool isRetain() const =0
virtual bool isAddable() const =0
virtual const FileDef * getFileDef() const =0
virtual bool isInline() const =0
virtual DString getReadAccessor() const =0
virtual const ArgumentList & argumentList() const =0
virtual bool isWritable() const =0
virtual bool isMaybeAmbiguous() const =0
virtual bool isPrivateGettable() const =0
virtual bool isRequired() const =0
virtual bool isAttribute() const =0
virtual bool isExternal() const =0
virtual bool isCopy() const =0
virtual DString bitfieldString() const =0
virtual bool isStatic() const =0
virtual const MemberDef * reimplements() const =0
virtual bool isMaybeDefault() const =0
virtual bool isPrivateSettable() const =0
virtual bool isRaisable() const =0
virtual bool isRemovable() const =0
virtual bool isConstrained() const =0
virtual DString getWriteAccessor() const =0
virtual bool isReadonly() const =0
virtual bool isBound() const =0
virtual bool isThreadLocal() const =0
virtual DString getScopeString() const =0
virtual const ArgumentList & typeConstraints() const =0
virtual bool isProtectedSettable() const =0
virtual bool isProtectedGettable() const =0
virtual bool hasOneLineInitializer() const =0
virtual bool isTransient() const =0
virtual bool hasMultiLineInitializer() const =0
virtual Protection protection() const =0
virtual bool isOptional() const =0
virtual bool isGettable() const =0
virtual MemberType memberType() const =0
virtual bool isReadable() const =0
virtual bool isWeak() const =0
virtual bool isStrong() const =0
virtual DString typeString() const =0
virtual Specifier virtualness(int count=0) const =0
virtual bool isFinal() const =0
virtual const ArgumentList & declArgumentList() const =0
virtual DString memberTypeName() const =0
virtual bool isMutable() const =0
virtual bool isProperty() const =0
A list of MemberDef objects as shown in documentation sections.
MemberListType listType() const
constexpr bool isDeclaration() const noexcept
constexpr bool isDetailed() const noexcept
virtual const MemberGroupList & getMemberGroups() const =0
virtual const MemberLists & getMemberLists() const =0
virtual FileList getUsedFiles() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
static ModuleManager & instance()
An abstract interface of a namespace symbol.
virtual ConceptLinkedRefMap getConcepts() const =0
virtual const MemberLists & getMemberLists() const =0
virtual NamespaceLinkedRefMap getNamespaces() const =0
virtual DString title() const =0
virtual ClassLinkedRefMap getClasses() const =0
virtual const MemberGroupList & getMemberGroups() const =0
Class representing a list of different code generators.
void add(OutputCodeIntfPtr &&p)
A model of a page symbol.
virtual const PageLinkedRefMap & getSubPages() const =0
virtual DString title() const =0
virtual const GroupDef * getGroupDef() const =0
class that provide information about a section.
static SectionManager & instance()
returns a reference to the singleton
Abstract interface for a hyperlinked text fragment.
void writeBreak(int) const override
void writeLink(const DString &, const DString &file, const DString &anchor, std::string_view) const override
TextGeneratorSqlite3Impl(StringVector &l)
void writeString(std::string_view, bool) const override
Text streaming class that buffers data.
std::string str() const
Return the contents of the buffer as a std::string object.
Concrete visitor implementation for XML output.
#define Config_getBool(name)
#define Config_getString(name)
std::vector< std::string > StringVector
DString dateToString(DateTimeType includeTime)
Returns the current date, when includeTime is set also the time is provided.
IDocParserPtr createDocParser()
factory function to create a parser
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &input, const DocOptions &options)
const char * qPrint(const char *s)
constexpr uint32_t IncludeKind_ImportMask
constexpr uint32_t IncludeKind_LocalMask
void linkifyText(const TextGeneratorIntf &out, const DString &text, const LinkifyTextOptions &options)
MemberDef * toMemberDef(Definition *d)
static bool memberdefExists(struct Refid refid)
static void recordMetadata()
static int prepareStatement(sqlite3 *db, SqlStmt &s)
SqlStmt compounddef_exists
static bool compounddefExists(struct Refid refid)
static bool insertMemberReference(struct Refid src_refid, struct Refid dst_refid, const char *context)
static int initializeTables(sqlite3 *db)
static void stripQualifiers(DString &typeStr)
struct Refid insertRefid(const DString &refid)
static bool memberdefIncomplete(struct Refid refid, const MemberDef *md)
SqlStmt memberdef_incomplete
static void generateSqlite3ForModule(const ModuleDef *mod)
SqlStmt compoundref_insert
static void beginTransaction(sqlite3 *db)
static void generateSqlite3ForConcept(const ConceptDef *cd)
static void insertMemberFunctionParams(int memberdef_id, const MemberDef *md, const Definition *def)
static void writeInnerClasses(const ClassLinkedRefMap &cl, struct Refid outer_refid)
static void generateSqlite3ForGroup(const GroupDef *gd)
static void writeInnerConcepts(const ConceptLinkedRefMap &cl, struct Refid outer_refid)
static void writeInnerGroups(const GroupList &gl, struct Refid outer_refid)
static void writeInnerPages(const PageLinkedRefMap &pl, struct Refid outer_refid)
static void writeInnerNamespaces(const NamespaceLinkedRefMap &nl, struct Refid outer_refid)
static int prepareStatements(sqlite3 *db)
static void writeInnerModules(const ModuleLinkedRefMap &ml, struct Refid outer_refid)
SqlStmt reimplements_insert
static void insertMemberDefineParams(int memberdef_id, const MemberDef *md, const Definition *def)
static void writeTemplateList(const ClassDef *cd)
static void getSQLDesc(SqlStmt &s, const char *col, const DString &value, const Definition *def)
const char * table_schema[][2]
static void endTransaction(sqlite3 *db)
static void generateSqlite3Section(const Definition *d, const MemberList *ml, struct Refid scope_refid, const char *, const DString &=DString(), const DString &=DString())
static void associateAllClassMembers(const ClassDef *cd, struct Refid scope_refid)
static void generateSqlite3ForDir(const DirDef *dd)
SqlStmt memberdef_update_def
const char * view_schema[][2]
SqlStmt memberdef_update_decl
static void writeInnerFiles(const FileList &fl, struct Refid outer_refid)
DString getSQLDocBlock(const Definition *scope, const Definition *def, const DString &doc, const DString &fileName, int lineNr)
SqlStmt memberdef_param_insert
static int initializeViews(sqlite3 *db)
static int insertPath(DString name, bool local=true, bool found=true, int type=1)
static void getSQLDescCompound(SqlStmt &s, const char *col, const DString &value, const Definition *def)
static bool bindTextParameter(SqlStmt &s, const char *name, const DString &value)
static sqlite3 * openDbConnection()
static void writeTemplateArgumentList(const ArgumentList &al, const Definition *scope, const FileDef *fileScope, const ArgumentList &typeConstraints=ArgumentList())
static void generateSqlite3ForClass(const ClassDef *cd)
static void writeInnerDirs(const DirList &dl, struct Refid outer_refid)
static void generateSqlite3ForNamespace(const NamespaceDef *nd)
static void writeMemberTemplateLists(const MemberDef *md)
static void generateSqlite3ForMember(const MemberDef *md, struct Refid scope_refid, const Definition *def)
static void generateSqlite3ForFile(const FileDef *fd)
static void generateSqlite3ForPage(const PageDef *pd, bool isExample)
static int step(SqlStmt &s, bool getRowId=false, bool select=false)
static void pragmaTuning(sqlite3 *db)
SqlStmt compounddef_insert
static bool bindIntParameter(SqlStmt &s, const char *name, int value)
static void associateMember(const MemberDef *md, struct Refid member_refid, struct Refid scope_refid)
Helper class to pass options when calling OutputList::generateDoc().
LinkifyTextOptions & setScope(const Definition *scope)
LinkifyTextOptions & setSelf(const Definition *self)
LinkifyTextOptions & setFileScope(const FileDef *fileScope)
DString filterTitle(const DString &title)
DString stripFromPath(const DString &path)
A bunch of utility functions.