66# define DBG_CTX(x) printf x
68# define DBG_CTX(x) do { } while(0)
71# ifdef SQLITE3_DEBUG_SQL
73static void sqlLog(
void *dbName,
const char *sql){
74 msg(
"SQL: '{}'\n", sql);
81 "CREATE TABLE IF NOT EXISTS meta (\n"
82 "\t-- Information about this db and how it was generated.\n"
84 "\tdoxygen_version TEXT PRIMARY KEY NOT NULL,\n"
92 "\tschema_version TEXT NOT NULL, -- Schema-specific semver\n"
94 "\tgenerated_at TEXT NOT NULL,\n"
95 "\tgenerated_on TEXT NOT NULL,\n"
97 "\tproject_name TEXT NOT NULL,\n"
98 "\tproject_number TEXT,\n"
99 "\tproject_brief TEXT\n"
103 "CREATE TABLE IF NOT EXISTS includes (\n"
104 "\t-- #include relations.\n"
105 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
106 "\tlocal INTEGER NOT NULL,\n"
107 "\tsrc_id INTEGER NOT NULL REFERENCES path, -- File id of the includer.\n"
108 "\tdst_id INTEGER NOT NULL REFERENCES path, -- File id of the includee.\n"
113 "\tUNIQUE(local, src_id, dst_id) ON CONFLICT IGNORE\n"
117 "CREATE TABLE IF NOT EXISTS contains (\n"
118 "\t-- inner/outer relations (file, namespace, dir, class, group, page)\n"
119 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
120 "\tinner_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
121 "\touter_rowid INTEGER NOT NULL REFERENCES compounddef\n"
138 "CREATE TABLE IF NOT EXISTS path (\n"
139 "\t-- Paths of source files and includes.\n"
140 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
141 "\ttype INTEGER NOT NULL, -- 1:file 2:dir\n"
142 "\tlocal INTEGER NOT NULL,\n"
143 "\tfound INTEGER NOT NULL,\n"
144 "\tname TEXT NOT NULL\n"
148 "CREATE TABLE IF NOT EXISTS refid (\n"
149 "\t-- Distinct refid for all documented entities.\n"
150 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
151 "\trefid TEXT NOT NULL UNIQUE\n"
155 "CREATE TABLE IF NOT EXISTS xrefs (\n"
156 "\t-- Cross-reference relation\n"
157 "\t-- (combines xml <referencedby> and <references> nodes).\n"
158 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
159 "\tsrc_rowid INTEGER NOT NULL REFERENCES refid, -- referrer id.\n"
160 "\tdst_rowid INTEGER NOT NULL REFERENCES refid, -- referee id.\n"
161 "\tcontext TEXT NOT NULL, -- inline, argument, initializer\n"
162 "\t-- Just need to know they link; ignore duplicates.\n"
163 "\tUNIQUE(src_rowid, dst_rowid, context) ON CONFLICT IGNORE\n"
167 "CREATE TABLE IF NOT EXISTS memberdef (\n"
168 "\t-- All processed identifiers.\n"
169 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
170 "\tname TEXT NOT NULL,\n"
171 "\tdefinition TEXT,\n"
173 "\targsstring TEXT,\n"
175 "\tinitializer TEXT,\n"
179 "\tprot INTEGER DEFAULT 0, -- 0:public 1:protected 2:private 3:package\n"
180 "\tstatic INTEGER DEFAULT 0, -- 0:no 1:yes\n"
181 "\textern INTEGER DEFAULT 0, -- 0:no 1:yes\n"
182 "\tconst INTEGER DEFAULT 0, -- 0:no 1:yes\n"
183 "\texplicit INTEGER DEFAULT 0, -- 0:no 1:yes\n"
184 "\tinline INTEGER DEFAULT 0, -- 0:no 1:yes 2:both (set after encountering inline and not-inline)\n"
185 "\tfinal INTEGER DEFAULT 0, -- 0:no 1:yes\n"
186 "\tsealed INTEGER DEFAULT 0, -- 0:no 1:yes\n"
187 "\tnew INTEGER DEFAULT 0, -- 0:no 1:yes\n"
188 "\toptional INTEGER DEFAULT 0, -- 0:no 1:yes\n"
189 "\trequired INTEGER DEFAULT 0, -- 0:no 1:yes\n"
190 "\tvolatile INTEGER DEFAULT 0, -- 0:no 1:yes\n"
191 "\tvirt INTEGER DEFAULT 0, -- 0:no 1:virtual 2:pure-virtual\n"
192 "\tmutable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
193 "\tthread_local INTEGER DEFAULT 0, -- 0:no 1:yes\n"
194 "\tinitonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
195 "\tattribute INTEGER DEFAULT 0, -- 0:no 1:yes\n"
196 "\tproperty INTEGER DEFAULT 0, -- 0:no 1:yes\n"
197 "\treadonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
198 "\tbound INTEGER DEFAULT 0, -- 0:no 1:yes\n"
199 "\tconstrained INTEGER DEFAULT 0, -- 0:no 1:yes\n"
200 "\ttransient INTEGER DEFAULT 0, -- 0:no 1:yes\n"
201 "\tmaybevoid INTEGER DEFAULT 0, -- 0:no 1:yes\n"
202 "\tmaybedefault INTEGER DEFAULT 0, -- 0:no 1:yes\n"
203 "\tmaybeambiguous INTEGER DEFAULT 0, -- 0:no 1:yes\n"
204 "\treadable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
205 "\twritable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
206 "\tgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
207 "\tprivategettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
208 "\tprotectedgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
209 "\tsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
210 "\tprivatesettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
211 "\tprotectedsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
212 "\taccessor INTEGER DEFAULT 0, -- 0:no 1:assign 2:copy 3:retain 4:string 5:weak\n"
213 "\taddable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
214 "\tremovable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
215 "\traisable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
216 "\tkind TEXT NOT NULL, -- 'macro definition' 'function' 'variable' 'typedef' 'enumeration' 'enumvalue' 'signal' 'slot' 'friend' 'dcop' 'property' 'event' 'interface' 'service'\n"
217 "\tbodystart INTEGER DEFAULT 0, -- starting line of definition\n"
218 "\tbodyend INTEGER DEFAULT 0, -- ending line of definition\n"
219 "\tbodyfile_id INTEGER REFERENCES path, -- file of definition\n"
220 "\tfile_id INTEGER NOT NULL REFERENCES path, -- file where this identifier is located\n"
221 "\tline INTEGER NOT NULL, -- line where this identifier is located\n"
222 "\tcolumn INTEGER NOT NULL, -- column where this identifier is located\n"
223 "\tdetaileddescription TEXT,\n"
224 "\tbriefdescription TEXT,\n"
225 "\tinbodydescription TEXT,\n"
226 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
230 "CREATE TABLE IF NOT EXISTS member (\n"
231 "\t-- Memberdef <-> containing compound relation.\n"
232 "\t-- Similar to XML listofallmembers.\n"
233 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
234 "\tscope_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
235 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef,\n"
236 "\tprot INTEGER NOT NULL,\n"
237 "\tvirt INTEGER NOT NULL,\n"
238 "\tUNIQUE(scope_rowid, memberdef_rowid)\n"
242 "CREATE TABLE IF NOT EXISTS reimplements (\n"
243 "\t-- Inherited member reimplementation relations.\n"
244 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
245 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplementing memberdef id.\n"
246 "\treimplemented_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplemented memberdef id.\n"
247 "\tUNIQUE(memberdef_rowid, reimplemented_rowid) ON CONFLICT IGNORE\n"
251 "CREATE TABLE IF NOT EXISTS compounddef (\n"
252 "\t-- Class/struct definitions.\n"
253 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
254 "\tname TEXT NOT NULL,\n"
257 "\tkind TEXT NOT NULL, -- 'category' 'class' 'constants' 'dir' 'enum' 'example' 'exception' 'file' 'group' 'interface' 'library' 'module' 'namespace' 'package' 'page' 'protocol' 'service' 'singleton' 'struct' 'type' 'union' 'unknown' ''\n"
259 "\tfile_id INTEGER NOT NULL REFERENCES path,\n"
260 "\tline INTEGER NOT NULL,\n"
261 "\tcolumn INTEGER NOT NULL,\n"
262 "\theader_id INTEGER REFERENCES path,\n"
263 "\tdetaileddescription TEXT,\n"
264 "\tbriefdescription TEXT,\n"
265 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
269 "CREATE TABLE IF NOT EXISTS compoundref (\n"
270 "\t-- Inheritance relation.\n"
271 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
272 "\tbase_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
273 "\tderived_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
274 "\tprot INTEGER NOT NULL,\n"
275 "\tvirt INTEGER NOT NULL,\n"
276 "\tUNIQUE(base_rowid, derived_rowid)\n"
280 "CREATE TABLE IF NOT EXISTS param (\n"
281 "\t-- All processed parameters.\n"
282 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
283 "\tattributes TEXT,\n"
289 "\tbriefdescription TEXT\n"
291 "CREATE UNIQUE INDEX idx_param ON param\n"
295 "CREATE TABLE IF NOT EXISTS memberdef_param (\n"
296 "\t-- Junction table for memberdef parameters.\n"
297 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
298 "\tmemberdef_id INTEGER NOT NULL REFERENCES memberdef,\n"
299 "\tparam_id INTEGER NOT NULL REFERENCES param\n"
326 "CREATE VIEW IF NOT EXISTS def (\n"
327 "\t-- Combined summary of all -def types for easier joins.\n"
337 "\tmemberdef.kind,\n"
338 "\tmemberdef.name,\n"
339 "\tmemberdef.briefdescription \n"
341 "JOIN memberdef ON refid.rowid=memberdef.rowid \n"
346 "\tcompounddef.kind,\n"
347 "\tcompounddef.name,\n"
349 "\t\tWHEN briefdescription IS NOT NULL \n"
350 "\t\tTHEN briefdescription \n"
354 "JOIN compounddef ON refid.rowid=compounddef.rowid;"
358 "CREATE VIEW IF NOT EXISTS local_file (\n"
359 "\t-- File paths found within the project.\n"
368 "FROM path WHERE path.type=1 AND path.local=1 AND path.found=1;\n"
372 "CREATE VIEW IF NOT EXISTS external_file (\n"
373 "\t-- File paths outside the project (found or not).\n"
382 "FROM path WHERE path.type=1 AND path.local=0;\n"
386 "CREATE VIEW IF NOT EXISTS inline_xrefs (\n"
387 "\t-- Crossrefs from inline member source.\n"
394 "\txrefs.src_rowid,\n"
395 "\txrefs.dst_rowid\n"
396 "FROM xrefs WHERE xrefs.context='inline';\n"
400 "CREATE VIEW IF NOT EXISTS argument_xrefs (\n"
401 "\t-- Crossrefs from member def/decl arguments\n"
408 "\txrefs.src_rowid,\n"
409 "\txrefs.dst_rowid\n"
410 "FROM xrefs WHERE xrefs.context='argument';\n"
414 "CREATE VIEW IF NOT EXISTS initializer_xrefs (\n"
415 "\t-- Crossrefs from member initializers\n"
422 "\txrefs.src_rowid,\n"
423 "\txrefs.dst_rowid\n"
424 "FROM xrefs WHERE xrefs.context='initializer';\n"
428 "CREATE VIEW IF NOT EXISTS inner_outer\n"
429 "\t-- Joins 'contains' relations to simplify inner/outer 'rel' queries.\n"
433 "FROM def as inner\n"
434 "\tJOIN contains ON inner.rowid=contains.inner_rowid\n"
435 "\tJOIN def AS outer ON outer.rowid=contains.outer_rowid;\n"
439 "CREATE VIEW IF NOT EXISTS rel (\n"
440 "\t-- Boolean indicator of relations available for a given entity.\n"
441 "\t-- Join to (compound-|member-)def to find fetch-worthy relations.\n"
445 "\tinnercompounds,\n"
446 "\toutercompounds,\n"
455 "\tinnernamespaces,\n"
456 "\touternamespaces,\n"
465 "\targument_links_in,\n"
466 "\targument_links_out,\n"
467 "\tinitializer_links_in,\n"
468 "\tinitializer_links_out\n"
472 "\tEXISTS (SELECT rowid FROM reimplements WHERE reimplemented_rowid=def.rowid),\n"
473 "\tEXISTS (SELECT rowid FROM reimplements WHERE memberdef_rowid=def.rowid),\n"
474 "\t-- rowid/kind for inner, [rowid:1/kind:1] for outer\n"
475 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid),\n"
476 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid),\n"
477 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='page'),\n"
478 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='page'),\n"
479 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='dir'),\n"
480 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='dir'),\n"
481 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='file'),\n"
482 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='file'),\n"
483 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind in (\n"
484 "'category','class','enum','exception','interface','module','protocol',\n"
485 "'service','singleton','struct','type','union'\n"
487 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1] in (\n"
488 "'category','class','enum','exception','interface','module','protocol',\n"
489 "'service','singleton','struct','type','union'\n"
491 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='namespace'),\n"
492 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='namespace'),\n"
493 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='group'),\n"
494 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='group'),\n"
495 "\tEXISTS (SELECT rowid FROM member WHERE scope_rowid=def.rowid),\n"
496 "\tEXISTS (SELECT rowid FROM member WHERE memberdef_rowid=def.rowid),\n"
497 "\tEXISTS (SELECT rowid FROM compoundref WHERE base_rowid=def.rowid),\n"
498 "\tEXISTS (SELECT rowid FROM compoundref WHERE derived_rowid=def.rowid),\n"
499 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE dst_rowid=def.rowid),\n"
500 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE src_rowid=def.rowid),\n"
501 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE dst_rowid=def.rowid),\n"
502 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE src_rowid=def.rowid),\n"
503 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE dst_rowid=def.rowid),\n"
504 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE src_rowid=def.rowid)\n"
505 "FROM def ORDER BY def.rowid;"
513 sqlite3 *
db =
nullptr;
522 "( doxygen_version, schema_version, generated_at, generated_on, project_name, project_number, project_brief )"
524 "(:doxygen_version,:schema_version,:generated_at,:generated_on,:project_name,:project_number,:project_brief )"
529 "INSERT INTO includes "
530 "( local, src_id, dst_id ) "
532 "(:local,:src_id,:dst_id )"
536 "SELECT COUNT(*) FROM includes WHERE "
537 "local=:local AND src_id=:src_id AND dst_id=:dst_id"
542 "INSERT INTO contains "
543 "( inner_rowid, outer_rowid )"
545 "(:inner_rowid,:outer_rowid )"
550 "SELECT rowid FROM path WHERE name=:name"
555 "( type, local, found, name )"
557 "(:type,:local,:found,:name )"
562 "SELECT rowid FROM refid WHERE refid=:refid"
575 "( src_rowid, dst_rowid, context )"
577 "(:src_rowid,:dst_rowid,:context )"
581 "INSERT INTO reimplements "
582 "( memberdef_rowid, reimplemented_rowid )"
584 "(:memberdef_rowid,:reimplemented_rowid )"
589 "SELECT EXISTS (SELECT * FROM memberdef WHERE rowid = :rowid)"
595 "SELECT * FROM memberdef WHERE "
596 "rowid = :rowid AND inline != 2 AND inline != :new_inline"
602 "INSERT INTO memberdef "
658 "detaileddescription,"
702 ":protectedsettable,"
703 ":protectedgettable,"
718 ":detaileddescription,"
732 "UPDATE memberdef SET "
734 "file_id = :file_id,"
737 "detaileddescription = 'Declaration: ' || :detaileddescription || 'Definition: ' || detaileddescription,"
738 "briefdescription = 'Declaration: ' || :briefdescription || 'Definition: ' || briefdescription,"
739 "inbodydescription = 'Declaration: ' || :inbodydescription || 'Definition: ' || inbodydescription "
740 "WHERE rowid = :rowid"
744 "UPDATE memberdef SET "
746 "bodystart = :bodystart,"
747 "bodyend = :bodyend,"
748 "bodyfile_id = :bodyfile_id,"
749 "detaileddescription = 'Declaration: ' || detaileddescription || 'Definition: ' || :detaileddescription,"
750 "briefdescription = 'Declaration: ' || briefdescription || 'Definition: ' || :briefdescription,"
751 "inbodydescription = 'Declaration: ' || inbodydescription || 'Definition: ' || :inbodydescription "
752 "WHERE rowid = :rowid"
757 "INSERT INTO member "
758 "( scope_rowid, memberdef_rowid, prot, virt ) "
760 "(:scope_rowid,:memberdef_rowid,:prot,:virt )"
765 "INSERT INTO compounddef "
777 "detaileddescription"
791 ":detaileddescription"
797 "SELECT * FROM compounddef WHERE rowid = :rowid"
803 "INSERT INTO compoundref "
804 "( base_rowid, derived_rowid, prot, virt ) "
806 "(:base_rowid,:derived_rowid,:prot,:virt )"
811 "SELECT rowid FROM param WHERE "
812 "(attributes IS NULL OR attributes=:attributes) AND "
813 "(type IS NULL OR type=:type) AND "
814 "(declname IS NULL OR declname=:declname) AND "
815 "(defname IS NULL OR defname=:defname) AND "
816 "(array IS NULL OR array=:array) AND "
817 "(defval IS NULL OR defval=:defval) AND "
818 "(briefdescription IS NULL OR briefdescription=:briefdescription)"
823 "( attributes, type, declname, defname, array, defval, briefdescription ) "
825 "(:attributes,:type,:declname,:defname,:array,:defval,:briefdescription)"
830 "INSERT INTO memberdef_param "
831 "( memberdef_id, param_id)"
833 "(:memberdef_id,:param_id)"
849 const DString &anchor,std::string_view
852 std::string rs = file.
str();
868 int idx = sqlite3_bind_parameter_index(s.
stmt, name);
870 err(
"sqlite3_bind_parameter_index({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
873 int rv = sqlite3_bind_text(s.
stmt, idx, value.
data(), -1, SQLITE_TRANSIENT);
875 err(
"sqlite3_bind_text({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
883 int idx = sqlite3_bind_parameter_index(s.
stmt, name);
885 err(
"sqlite3_bind_parameter_index({})[{}] failed to find column: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
888 int rv = sqlite3_bind_int(s.
stmt, idx, value);
890 err(
"sqlite3_bind_int({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
904 int rc = sqlite3_step(s.
stmt);
905 if (rc!=SQLITE_DONE && rc!=SQLITE_ROW)
907 DBG_CTX((
"sqlite3_step: %s (rc: %d)\n", sqlite3_errmsg(s.
db), rc));
908 sqlite3_reset(s.
stmt);
909 sqlite3_clear_bindings(s.
stmt);
912 if (getRowId && select) rowid = sqlite3_column_int(s.
stmt, 0);
913 if (getRowId && !select) rowid =
static_cast<int>(sqlite3_last_insert_rowid(s.
db));
914 sqlite3_reset(s.
stmt);
915 sqlite3_clear_bindings(s.
stmt);
922 if (name==
nullptr)
return rowid;
981 return test ? true :
false;
989 return test ? true :
false;
996 return test ? true :
false;
1001 if (src_refid.
rowid==-1||dst_refid.
rowid==-1)
1036 if (declAl.
size()>0)
1038 auto defIt = defAl.
begin();
1043 if (defIt!=defAl.
end())
1049 if (!a.attrib.empty())
1054 if (!a.type.empty())
1059 for (
const auto &s : list)
1069 if (!a.name.empty())
1074 if (defArg && !defArg->
name.
empty() && defArg->
name!=a.name)
1079 if (!a.array.empty())
1084 if (!a.defval.empty())
1097 DBG_CTX((
"error INSERT params failed\n"));
1136 if (md->
memberType()==MemberType::EnumValue)
return;
1155 else if (typeStr==
"virtual") typeStr=
"";
1162 int rc = sqlite3_prepare_v2(db,s.
query,-1,&s.
stmt,
nullptr);
1165 err(
"prepare failed for:\n {}\n {}\n", s.
query, sqlite3_errmsg(db));
1207 char * sErrMsg =
nullptr;
1208 sqlite3_exec(db,
"BEGIN TRANSACTION",
nullptr,
nullptr, &sErrMsg);
1213 char * sErrMsg =
nullptr;
1214 sqlite3_exec(db,
"END TRANSACTION",
nullptr,
nullptr, &sErrMsg);
1219 char * sErrMsg =
nullptr;
1220 sqlite3_exec(db,
"PRAGMA synchronous = OFF",
nullptr,
nullptr, &sErrMsg);
1221 sqlite3_exec(db,
"PRAGMA journal_mode = MEMORY",
nullptr,
nullptr, &sErrMsg);
1222 sqlite3_exec(db,
"PRAGMA temp_store = MEMORY;",
nullptr,
nullptr, &sErrMsg);
1227 msg(
"Initializing DB schema (tables)...\n");
1231 char *errmsg =
nullptr;
1232 int rc = sqlite3_exec(db, q,
nullptr,
nullptr, &errmsg);
1233 if (rc != SQLITE_OK)
1235 err(
"failed to execute query: {}\n\t{}\n", q, errmsg);
1244 msg(
"Initializing DB schema (views)...\n");
1248 char *errmsg =
nullptr;
1249 int rc = sqlite3_exec(db, q,
nullptr,
nullptr, &errmsg);
1250 if (rc != SQLITE_OK)
1252 err(
"failed to execute query: {}\n\t{}\n", q, errmsg);
1274 for (
const auto &cd : cl)
1276 if (!cd->isHidden() && !cd->isAnonymous())
1289 for (
const auto &cd : cl)
1301 for (
const auto &mod : ml)
1314 for (
const auto &pd : pl)
1317 pd->getGroupDef() ? pd->getOutputFileBase()+
"_"+pd->name() : pd->getOutputFileBase()
1328 for (
const auto &sgd : gl)
1340 for (
const auto &fd: fl)
1352 for (
const auto &subdir : dl)
1364 for (
const auto &nd : nl)
1366 if (!nd->isHidden() && !nd->isAnonymous())
1384 if (!a.type.empty())
1390 if (!a.name.empty())
1397 if (!a.defval.empty())
1429 if (doc.
empty())
return "";
1441 auto astImpl =
dynamic_cast<const DocNodeAST*
>(ast.get());
1449 std::visit(visitor,astImpl->root);
1576 if (md->
memberType()==MemberType::EnumValue)
return;
1598 struct SqlStmt memberdef_update;
1605 if (bodyfile_id == -1)
1607 sqlite3_clear_bindings(memberdef_update.
stmt);
1641 step(memberdef_update,
true);
1649 for (
const auto &rmd : refList)
1655 for (
const auto &rmd : refByList)
1687 if (md->
memberType() == MemberType::Variable)
1705 if (bitfield.
at(0)==
':') bitfield=bitfield.
mid(1);
1709 else if (md->
memberType() == MemberType::Property)
1725 else if (md->
isCopy()) accessor = 2;
1726 else if (md->
isRetain()) accessor = 3;
1727 else if (md->
isStrong()) accessor = 4;
1728 else if (md->
isWeak()) accessor = 5;
1735 else if (md->
memberType() == MemberType::Event)
1770 if (!typeStr.
empty())
1795 for (
const auto &s : list)
1799 DBG_CTX((
"initializer:%s %s %s %d\n",
1836 if (bodyfile_id == -1)
1856 else if (md->
memberType()==MemberType::Define &&
1878 struct Refid scope_refid,
1883 if (ml==
nullptr)
return;
1884 for (
const auto &md : *ml)
1900 for (
auto &mi : *mni)
1988 DBG_CTX((
"-----> ClassDef includeInfo for %s\n",
qPrint(nm)));
1989 DBG_CTX((
" local : %d\n", ii->local));
1990 DBG_CTX((
" imported : %d\n", ii->imported));
1995 DBG_CTX((
" file_id : %d\n", file_id));
1996 DBG_CTX((
" header_id: %d\n", header_id));
2025 struct Refid derived_refid =
insertRefid(bcd.classDef->getOutputFileBase());
2044 mg->documentation());
2123 mg->documentation());
2183 mg->documentation());
2243 if(ii.fileDef->isReference())
2246 DString tagfile = ii.fileDef->getReference();
2247 dst_path = ii.fileDef->absFilePath();
2252 dst_path = ii.fileDef->absFilePath();
2258 dst_id =
insertPath(ii.includeName,isLocal,
false);
2261 DBG_CTX((
"-----> FileDef includeInfo for %s\n",
qPrint(ii.includeName)));
2262 DBG_CTX((
" local: %d\n", isLocal));
2266 DBG_CTX((
"include: %s\n",
qPrint(ii.fileDef->absFilePath())));
2268 DBG_CTX((
" src_id : %d\n", src_id));
2269 DBG_CTX((
" dst_id: %d\n", dst_id));
2292 if(ii.fileDef->isReference())
2295 DString tagfile = ii.fileDef->getReference();
2296 src_path = ii.fileDef->absFilePath();
2301 src_path = ii.fileDef->absFilePath();
2307 src_id =
insertPath(ii.includeName,isLocal,
false);
2334 mg->documentation());
2407 mg->documentation());
2481 qrefid+=
"_"+pd->
name();
2483 if (qrefid==
"index") qrefid=
"indexpage";
2511 title = si->
title();
2515 title = pd->
title();
2545 sqlite3 *db =
nullptr;
2547 int rc = sqlite3_initialize();
2548 if (rc != SQLITE_OK)
2550 err(
"sqlite3_initialize failed\n");
2554 std::string dbFileName =
"doxygen_sqlite3.db";
2555 FileInfo fi(outputDirectory.
str()+
"/"+dbFileName);
2565 err(
"doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n");
2570 rc = sqlite3_open_v2(
2573 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
2576 if (rc != SQLITE_OK)
2579 err(
"Database open failed: doxygen_sqlite3.db\n");
2600# ifdef SQLITE3_DEBUG
2602 sqlite3_trace(db, &sqlLog,
nullptr);
2613 err(
"sqlite generator: prepareStatements failed!\n");
2622 msg(
"Generating Sqlite3 output for class {}\n",cd->name());
2629 msg(
"Generating Sqlite3 output for concept {}\n",cd->name());
2636 msg(
"Generating Sqlite3 output for module {}\n",mod->name());
2643 msg(
"Generating Sqlite3 output for namespace {}\n",nd->name());
2650 for (
const auto &fd : *fn)
2652 msg(
"Generating Sqlite3 output for file {}\n",fd->name());
2660 msg(
"Generating Sqlite3 output for group {}\n",gd->name());
2667 msg(
"Generating Sqlite3 output for page {}\n",pd->name());
2674 msg(
"Generating Sqlite3 output for dir {}\n",dd->name());
2681 msg(
"Generating Sqlite3 output for example {}\n",pd->name());
2688 msg(
"Generating Sqlite3 output for the main page\n");
This class represents an function or template argument list.
bool constSpecifier() const
bool volatileSpecifier() const
A abstract class representing of a compound symbol.
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 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 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 ClassLinkedRefMap getClasses() const =0
returns the classes nested into this class
virtual FileDef * getFileDef() const =0
Returns the namespace this compound is in, or 0 if it has a global scope.
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 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
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 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 writeTemplateArgumentList(const ArgumentList &al, const Definition *scope, const FileDef *fileScope)
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 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)
This class contains the information about the argument of a function or template.
Helper class to pass options when calling OutputList::generateDoc().
Class representing the data associated with a #include statement.
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.