65# define DBG_CTX(x) printf x
67# define DBG_CTX(x) do { } while(0)
70# ifdef SQLITE3_DEBUG_SQL
72static void sqlLog(
void *dbName,
const char *sql){
73 msg(
"SQL: '{}'\n", sql);
80 "CREATE TABLE IF NOT EXISTS meta (\n"
81 "\t-- Information about this db and how it was generated.\n"
83 "\tdoxygen_version TEXT PRIMARY KEY NOT NULL,\n"
91 "\tschema_version TEXT NOT NULL, -- Schema-specific semver\n"
93 "\tgenerated_at TEXT NOT NULL,\n"
94 "\tgenerated_on TEXT NOT NULL,\n"
96 "\tproject_name TEXT NOT NULL,\n"
97 "\tproject_number TEXT,\n"
98 "\tproject_brief TEXT\n"
102 "CREATE TABLE IF NOT EXISTS includes (\n"
103 "\t-- #include relations.\n"
104 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
105 "\tlocal INTEGER NOT NULL,\n"
106 "\tsrc_id INTEGER NOT NULL REFERENCES path, -- File id of the includer.\n"
107 "\tdst_id INTEGER NOT NULL REFERENCES path, -- File id of the includee.\n"
112 "\tUNIQUE(local, src_id, dst_id) ON CONFLICT IGNORE\n"
116 "CREATE TABLE IF NOT EXISTS contains (\n"
117 "\t-- inner/outer relations (file, namespace, dir, class, group, page)\n"
118 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
119 "\tinner_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
120 "\touter_rowid INTEGER NOT NULL REFERENCES compounddef\n"
137 "CREATE TABLE IF NOT EXISTS path (\n"
138 "\t-- Paths of source files and includes.\n"
139 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
140 "\ttype INTEGER NOT NULL, -- 1:file 2:dir\n"
141 "\tlocal INTEGER NOT NULL,\n"
142 "\tfound INTEGER NOT NULL,\n"
143 "\tname TEXT NOT NULL\n"
147 "CREATE TABLE IF NOT EXISTS refid (\n"
148 "\t-- Distinct refid for all documented entities.\n"
149 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
150 "\trefid TEXT NOT NULL UNIQUE\n"
154 "CREATE TABLE IF NOT EXISTS xrefs (\n"
155 "\t-- Cross-reference relation\n"
156 "\t-- (combines xml <referencedby> and <references> nodes).\n"
157 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
158 "\tsrc_rowid INTEGER NOT NULL REFERENCES refid, -- referrer id.\n"
159 "\tdst_rowid INTEGER NOT NULL REFERENCES refid, -- referee id.\n"
160 "\tcontext TEXT NOT NULL, -- inline, argument, initializer\n"
161 "\t-- Just need to know they link; ignore duplicates.\n"
162 "\tUNIQUE(src_rowid, dst_rowid, context) ON CONFLICT IGNORE\n"
166 "CREATE TABLE IF NOT EXISTS memberdef (\n"
167 "\t-- All processed identifiers.\n"
168 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
169 "\tname TEXT NOT NULL,\n"
170 "\tdefinition TEXT,\n"
172 "\targsstring TEXT,\n"
174 "\tinitializer TEXT,\n"
178 "\tprot INTEGER DEFAULT 0, -- 0:public 1:protected 2:private 3:package\n"
179 "\tstatic INTEGER DEFAULT 0, -- 0:no 1:yes\n"
180 "\textern INTEGER DEFAULT 0, -- 0:no 1:yes\n"
181 "\tconst INTEGER DEFAULT 0, -- 0:no 1:yes\n"
182 "\texplicit INTEGER DEFAULT 0, -- 0:no 1:yes\n"
183 "\tinline INTEGER DEFAULT 0, -- 0:no 1:yes 2:both (set after encountering inline and not-inline)\n"
184 "\tfinal INTEGER DEFAULT 0, -- 0:no 1:yes\n"
185 "\tsealed INTEGER DEFAULT 0, -- 0:no 1:yes\n"
186 "\tnew INTEGER DEFAULT 0, -- 0:no 1:yes\n"
187 "\toptional INTEGER DEFAULT 0, -- 0:no 1:yes\n"
188 "\trequired INTEGER DEFAULT 0, -- 0:no 1:yes\n"
189 "\tvolatile INTEGER DEFAULT 0, -- 0:no 1:yes\n"
190 "\tvirt INTEGER DEFAULT 0, -- 0:no 1:virtual 2:pure-virtual\n"
191 "\tmutable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
192 "\tthread_local INTEGER DEFAULT 0, -- 0:no 1:yes\n"
193 "\tinitonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
194 "\tattribute INTEGER DEFAULT 0, -- 0:no 1:yes\n"
195 "\tproperty INTEGER DEFAULT 0, -- 0:no 1:yes\n"
196 "\treadonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
197 "\tbound INTEGER DEFAULT 0, -- 0:no 1:yes\n"
198 "\tconstrained INTEGER DEFAULT 0, -- 0:no 1:yes\n"
199 "\ttransient INTEGER DEFAULT 0, -- 0:no 1:yes\n"
200 "\tmaybevoid INTEGER DEFAULT 0, -- 0:no 1:yes\n"
201 "\tmaybedefault INTEGER DEFAULT 0, -- 0:no 1:yes\n"
202 "\tmaybeambiguous INTEGER DEFAULT 0, -- 0:no 1:yes\n"
203 "\treadable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
204 "\twritable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
205 "\tgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
206 "\tprivategettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
207 "\tprotectedgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
208 "\tsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
209 "\tprivatesettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
210 "\tprotectedsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
211 "\taccessor INTEGER DEFAULT 0, -- 0:no 1:assign 2:copy 3:retain 4:string 5:weak\n"
212 "\taddable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
213 "\tremovable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
214 "\traisable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
215 "\tkind TEXT NOT NULL, -- 'macro definition' 'function' 'variable' 'typedef' 'enumeration' 'enumvalue' 'signal' 'slot' 'friend' 'dcop' 'property' 'event' 'interface' 'service'\n"
216 "\tbodystart INTEGER DEFAULT 0, -- starting line of definition\n"
217 "\tbodyend INTEGER DEFAULT 0, -- ending line of definition\n"
218 "\tbodyfile_id INTEGER REFERENCES path, -- file of definition\n"
219 "\tfile_id INTEGER NOT NULL REFERENCES path, -- file where this identifier is located\n"
220 "\tline INTEGER NOT NULL, -- line where this identifier is located\n"
221 "\tcolumn INTEGER NOT NULL, -- column where this identifier is located\n"
222 "\tdetaileddescription TEXT,\n"
223 "\tbriefdescription TEXT,\n"
224 "\tinbodydescription TEXT,\n"
225 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
229 "CREATE TABLE IF NOT EXISTS member (\n"
230 "\t-- Memberdef <-> containing compound relation.\n"
231 "\t-- Similar to XML listofallmembers.\n"
232 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
233 "\tscope_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
234 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef,\n"
235 "\tprot INTEGER NOT NULL,\n"
236 "\tvirt INTEGER NOT NULL,\n"
237 "\tUNIQUE(scope_rowid, memberdef_rowid)\n"
241 "CREATE TABLE IF NOT EXISTS reimplements (\n"
242 "\t-- Inherited member reimplementation relations.\n"
243 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
244 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplementing memberdef id.\n"
245 "\treimplemented_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplemented memberdef id.\n"
246 "\tUNIQUE(memberdef_rowid, reimplemented_rowid) ON CONFLICT IGNORE\n"
250 "CREATE TABLE IF NOT EXISTS compounddef (\n"
251 "\t-- Class/struct definitions.\n"
252 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
253 "\tname TEXT NOT NULL,\n"
256 "\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"
258 "\tfile_id INTEGER NOT NULL REFERENCES path,\n"
259 "\tline INTEGER NOT NULL,\n"
260 "\tcolumn INTEGER NOT NULL,\n"
261 "\theader_id INTEGER REFERENCES path,\n"
262 "\tdetaileddescription TEXT,\n"
263 "\tbriefdescription TEXT,\n"
264 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
268 "CREATE TABLE IF NOT EXISTS compoundref (\n"
269 "\t-- Inheritance relation.\n"
270 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
271 "\tbase_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
272 "\tderived_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
273 "\tprot INTEGER NOT NULL,\n"
274 "\tvirt INTEGER NOT NULL,\n"
275 "\tUNIQUE(base_rowid, derived_rowid)\n"
279 "CREATE TABLE IF NOT EXISTS param (\n"
280 "\t-- All processed parameters.\n"
281 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
282 "\tattributes TEXT,\n"
288 "\tbriefdescription TEXT\n"
290 "CREATE UNIQUE INDEX idx_param ON param\n"
294 "CREATE TABLE IF NOT EXISTS memberdef_param (\n"
295 "\t-- Junction table for memberdef parameters.\n"
296 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
297 "\tmemberdef_id INTEGER NOT NULL REFERENCES memberdef,\n"
298 "\tparam_id INTEGER NOT NULL REFERENCES param\n"
325 "CREATE VIEW IF NOT EXISTS def (\n"
326 "\t-- Combined summary of all -def types for easier joins.\n"
336 "\tmemberdef.kind,\n"
337 "\tmemberdef.name,\n"
338 "\tmemberdef.briefdescription \n"
340 "JOIN memberdef ON refid.rowid=memberdef.rowid \n"
345 "\tcompounddef.kind,\n"
346 "\tcompounddef.name,\n"
348 "\t\tWHEN briefdescription IS NOT NULL \n"
349 "\t\tTHEN briefdescription \n"
353 "JOIN compounddef ON refid.rowid=compounddef.rowid;"
357 "CREATE VIEW IF NOT EXISTS local_file (\n"
358 "\t-- File paths found within the project.\n"
367 "FROM path WHERE path.type=1 AND path.local=1 AND path.found=1;\n"
371 "CREATE VIEW IF NOT EXISTS external_file (\n"
372 "\t-- File paths outside the project (found or not).\n"
381 "FROM path WHERE path.type=1 AND path.local=0;\n"
385 "CREATE VIEW IF NOT EXISTS inline_xrefs (\n"
386 "\t-- Crossrefs from inline member source.\n"
393 "\txrefs.src_rowid,\n"
394 "\txrefs.dst_rowid\n"
395 "FROM xrefs WHERE xrefs.context='inline';\n"
399 "CREATE VIEW IF NOT EXISTS argument_xrefs (\n"
400 "\t-- Crossrefs from member def/decl arguments\n"
407 "\txrefs.src_rowid,\n"
408 "\txrefs.dst_rowid\n"
409 "FROM xrefs WHERE xrefs.context='argument';\n"
413 "CREATE VIEW IF NOT EXISTS initializer_xrefs (\n"
414 "\t-- Crossrefs from member initializers\n"
421 "\txrefs.src_rowid,\n"
422 "\txrefs.dst_rowid\n"
423 "FROM xrefs WHERE xrefs.context='initializer';\n"
427 "CREATE VIEW IF NOT EXISTS inner_outer\n"
428 "\t-- Joins 'contains' relations to simplify inner/outer 'rel' queries.\n"
432 "FROM def as inner\n"
433 "\tJOIN contains ON inner.rowid=contains.inner_rowid\n"
434 "\tJOIN def AS outer ON outer.rowid=contains.outer_rowid;\n"
438 "CREATE VIEW IF NOT EXISTS rel (\n"
439 "\t-- Boolean indicator of relations available for a given entity.\n"
440 "\t-- Join to (compound-|member-)def to find fetch-worthy relations.\n"
444 "\tinnercompounds,\n"
445 "\toutercompounds,\n"
454 "\tinnernamespaces,\n"
455 "\touternamespaces,\n"
464 "\targument_links_in,\n"
465 "\targument_links_out,\n"
466 "\tinitializer_links_in,\n"
467 "\tinitializer_links_out\n"
471 "\tEXISTS (SELECT rowid FROM reimplements WHERE reimplemented_rowid=def.rowid),\n"
472 "\tEXISTS (SELECT rowid FROM reimplements WHERE memberdef_rowid=def.rowid),\n"
473 "\t-- rowid/kind for inner, [rowid:1/kind:1] for outer\n"
474 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid),\n"
475 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid),\n"
476 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='page'),\n"
477 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='page'),\n"
478 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='dir'),\n"
479 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='dir'),\n"
480 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='file'),\n"
481 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='file'),\n"
482 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind in (\n"
483 "'category','class','enum','exception','interface','module','protocol',\n"
484 "'service','singleton','struct','type','union'\n"
486 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1] in (\n"
487 "'category','class','enum','exception','interface','module','protocol',\n"
488 "'service','singleton','struct','type','union'\n"
490 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='namespace'),\n"
491 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='namespace'),\n"
492 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='group'),\n"
493 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='group'),\n"
494 "\tEXISTS (SELECT rowid FROM member WHERE scope_rowid=def.rowid),\n"
495 "\tEXISTS (SELECT rowid FROM member WHERE memberdef_rowid=def.rowid),\n"
496 "\tEXISTS (SELECT rowid FROM compoundref WHERE base_rowid=def.rowid),\n"
497 "\tEXISTS (SELECT rowid FROM compoundref WHERE derived_rowid=def.rowid),\n"
498 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE dst_rowid=def.rowid),\n"
499 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE src_rowid=def.rowid),\n"
500 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE dst_rowid=def.rowid),\n"
501 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE src_rowid=def.rowid),\n"
502 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE dst_rowid=def.rowid),\n"
503 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE src_rowid=def.rowid)\n"
504 "FROM def ORDER BY def.rowid;"
512 sqlite3 *
db =
nullptr;
521 "( doxygen_version, schema_version, generated_at, generated_on, project_name, project_number, project_brief )"
523 "(:doxygen_version,:schema_version,:generated_at,:generated_on,:project_name,:project_number,:project_brief )"
528 "INSERT INTO includes "
529 "( local, src_id, dst_id ) "
531 "(:local,:src_id,:dst_id )"
535 "SELECT COUNT(*) FROM includes WHERE "
536 "local=:local AND src_id=:src_id AND dst_id=:dst_id"
541 "INSERT INTO contains "
542 "( inner_rowid, outer_rowid )"
544 "(:inner_rowid,:outer_rowid )"
549 "SELECT rowid FROM path WHERE name=:name"
554 "( type, local, found, name )"
556 "(:type,:local,:found,:name )"
561 "SELECT rowid FROM refid WHERE refid=:refid"
574 "( src_rowid, dst_rowid, context )"
576 "(:src_rowid,:dst_rowid,:context )"
580 "INSERT INTO reimplements "
581 "( memberdef_rowid, reimplemented_rowid )"
583 "(:memberdef_rowid,:reimplemented_rowid )"
588 "SELECT EXISTS (SELECT * FROM memberdef WHERE rowid = :rowid)"
594 "SELECT * FROM memberdef WHERE "
595 "rowid = :rowid AND inline != 2 AND inline != :new_inline"
601 "INSERT INTO memberdef "
657 "detaileddescription,"
701 ":protectedsettable,"
702 ":protectedgettable,"
717 ":detaileddescription,"
731 "UPDATE memberdef SET "
733 "file_id = :file_id,"
736 "detaileddescription = 'Declaration: ' || :detaileddescription || 'Definition: ' || detaileddescription,"
737 "briefdescription = 'Declaration: ' || :briefdescription || 'Definition: ' || briefdescription,"
738 "inbodydescription = 'Declaration: ' || :inbodydescription || 'Definition: ' || inbodydescription "
739 "WHERE rowid = :rowid"
743 "UPDATE memberdef SET "
745 "bodystart = :bodystart,"
746 "bodyend = :bodyend,"
747 "bodyfile_id = :bodyfile_id,"
748 "detaileddescription = 'Declaration: ' || detaileddescription || 'Definition: ' || :detaileddescription,"
749 "briefdescription = 'Declaration: ' || briefdescription || 'Definition: ' || :briefdescription,"
750 "inbodydescription = 'Declaration: ' || inbodydescription || 'Definition: ' || :inbodydescription "
751 "WHERE rowid = :rowid"
756 "INSERT INTO member "
757 "( scope_rowid, memberdef_rowid, prot, virt ) "
759 "(:scope_rowid,:memberdef_rowid,:prot,:virt )"
764 "INSERT INTO compounddef "
776 "detaileddescription"
790 ":detaileddescription"
796 "SELECT * FROM compounddef WHERE rowid = :rowid"
802 "INSERT INTO compoundref "
803 "( base_rowid, derived_rowid, prot, virt ) "
805 "(:base_rowid,:derived_rowid,:prot,:virt )"
810 "SELECT rowid FROM param WHERE "
811 "(attributes IS NULL OR attributes=:attributes) AND "
812 "(type IS NULL OR type=:type) AND "
813 "(declname IS NULL OR declname=:declname) AND "
814 "(defname IS NULL OR defname=:defname) AND "
815 "(array IS NULL OR array=:array) AND "
816 "(defval IS NULL OR defval=:defval) AND "
817 "(briefdescription IS NULL OR briefdescription=:briefdescription)"
822 "( attributes, type, declname, defname, array, defval, briefdescription ) "
824 "(:attributes,:type,:declname,:defname,:array,:defval,:briefdescription)"
829 "INSERT INTO memberdef_param "
830 "( memberdef_id, param_id)"
832 "(:memberdef_id,:param_id)"
848 const QCString &anchor,std::string_view
851 std::string rs = file.
str();
867 int idx = sqlite3_bind_parameter_index(s.
stmt, name);
869 err(
"sqlite3_bind_parameter_index({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
872 int rv = sqlite3_bind_text(s.
stmt, idx, value.
data(), -1, SQLITE_TRANSIENT);
874 err(
"sqlite3_bind_text({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
882 int idx = sqlite3_bind_parameter_index(s.
stmt, name);
884 err(
"sqlite3_bind_parameter_index({})[{}] failed to find column: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
887 int rv = sqlite3_bind_int(s.
stmt, idx, value);
889 err(
"sqlite3_bind_int({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
898 int rc = sqlite3_step(s.
stmt);
899 if (rc!=SQLITE_DONE && rc!=SQLITE_ROW)
901 DBG_CTX((
"sqlite3_step: %s (rc: %d)\n", sqlite3_errmsg(s.
db), rc));
902 sqlite3_reset(s.
stmt);
903 sqlite3_clear_bindings(s.
stmt);
906 if (getRowId && select) rowid = sqlite3_column_int(s.
stmt, 0);
907 if (getRowId && !select) rowid =
static_cast<int>(sqlite3_last_insert_rowid(s.
db));
908 sqlite3_reset(s.
stmt);
909 sqlite3_clear_bindings(s.
stmt);
916 if (name==
nullptr)
return rowid;
975 return test ? true :
false;
983 return test ? true :
false;
990 return test ? true :
false;
1028 if (declAl.
size()>0)
1030 auto defIt = defAl.
begin();
1035 if (defIt!=defAl.
end())
1041 if (!a.attrib.isEmpty())
1046 if (!a.type.isEmpty())
1051 for (
const auto &s : list)
1061 if (!a.name.isEmpty())
1071 if (!a.array.isEmpty())
1076 if (!a.defval.isEmpty())
1089 DBG_CTX((
"error INSERT params failed\n"));
1147 else if (typeStr==
"virtual") typeStr=
"";
1154 int rc = sqlite3_prepare_v2(db,s.
query,-1,&s.
stmt,
nullptr);
1157 err(
"prepare failed for:\n {}\n {}\n", s.
query, sqlite3_errmsg(db));
1199 char * sErrMsg =
nullptr;
1200 sqlite3_exec(db,
"BEGIN TRANSACTION",
nullptr,
nullptr, &sErrMsg);
1205 char * sErrMsg =
nullptr;
1206 sqlite3_exec(db,
"END TRANSACTION",
nullptr,
nullptr, &sErrMsg);
1211 char * sErrMsg =
nullptr;
1212 sqlite3_exec(db,
"PRAGMA synchronous = OFF",
nullptr,
nullptr, &sErrMsg);
1213 sqlite3_exec(db,
"PRAGMA journal_mode = MEMORY",
nullptr,
nullptr, &sErrMsg);
1214 sqlite3_exec(db,
"PRAGMA temp_store = MEMORY;",
nullptr,
nullptr, &sErrMsg);
1219 msg(
"Initializing DB schema (tables)...\n");
1223 char *errmsg =
nullptr;
1224 int rc = sqlite3_exec(db, q,
nullptr,
nullptr, &errmsg);
1225 if (rc != SQLITE_OK)
1227 err(
"failed to execute query: {}\n\t{}\n", q, errmsg);
1236 msg(
"Initializing DB schema (views)...\n");
1240 char *errmsg =
nullptr;
1241 int rc = sqlite3_exec(db, q,
nullptr,
nullptr, &errmsg);
1242 if (rc != SQLITE_OK)
1244 err(
"failed to execute query: {}\n\t{}\n", q, errmsg);
1266 for (
const auto &cd : cl)
1268 if (!cd->isHidden() && !cd->isAnonymous())
1281 for (
const auto &cd : cl)
1293 for (
const auto &mod : ml)
1306 for (
const auto &pd : pl)
1309 pd->getGroupDef() ? pd->getOutputFileBase()+
"_"+pd->name() : pd->getOutputFileBase()
1320 for (
const auto &sgd : gl)
1332 for (
const auto &fd: fl)
1344 for (
const auto subdir : dl)
1356 for (
const auto &nd : nl)
1358 if (!nd->isHidden() && !nd->isAnonymous())
1376 if (!a.type.isEmpty())
1382 if (!a.name.isEmpty())
1389 if (!a.defval.isEmpty())
1433 auto astImpl =
dynamic_cast<const DocNodeAST*
>(ast.get());
1441 std::visit(visitor,astImpl->root);
1590 struct SqlStmt memberdef_update;
1597 if (bodyfile_id == -1)
1599 sqlite3_clear_bindings(memberdef_update.
stmt);
1641 for (
const auto &rmd : refList)
1647 for (
const auto &rmd : refByList)
1709 if (bitfield.
at(0)==
':') bitfield=bitfield.
mid(1);
1729 else if (md->
isCopy()) accessor = 2;
1730 else if (md->
isRetain()) accessor = 3;
1731 else if (md->
isStrong()) accessor = 4;
1732 else if (md->
isWeak()) accessor = 5;
1796 for (
const auto &s : list)
1800 DBG_CTX((
"initializer:%s %s %s %d\n",
1837 if (bodyfile_id == -1)
1879 struct Refid scope_refid,
1884 if (ml==
nullptr)
return;
1885 for (
const auto &md : *ml)
1901 for (
auto &mi : *mni)
1989 DBG_CTX((
"-----> ClassDef includeInfo for %s\n",
qPrint(nm)));
1990 DBG_CTX((
" local : %d\n", ii->local));
1991 DBG_CTX((
" imported : %d\n", ii->imported));
1996 DBG_CTX((
" file_id : %d\n", file_id));
1997 DBG_CTX((
" header_id: %d\n", header_id));
2026 struct Refid derived_refid =
insertRefid(bcd.classDef->getOutputFileBase());
2045 mg->documentation());
2124 mg->documentation());
2184 mg->documentation());
2244 if(ii.fileDef->isReference())
2247 QCString tagfile = ii.fileDef->getReference();
2248 dst_path = ii.fileDef->absFilePath();
2253 dst_path = ii.fileDef->absFilePath();
2262 DBG_CTX((
"-----> FileDef includeInfo for %s\n",
qPrint(ii.includeName)));
2263 DBG_CTX((
" local: %d\n", isLocal));
2267 DBG_CTX((
"include: %s\n",
qPrint(ii.fileDef->absFilePath())));
2269 DBG_CTX((
" src_id : %d\n", src_id));
2270 DBG_CTX((
" dst_id: %d\n", dst_id));
2293 if(ii.fileDef->isReference())
2296 QCString tagfile = ii.fileDef->getReference();
2297 src_path = ii.fileDef->absFilePath();
2302 src_path = ii.fileDef->absFilePath();
2335 mg->documentation());
2408 mg->documentation());
2482 qrefid+=
"_"+pd->
name();
2484 if (qrefid==
"index") qrefid=
"indexpage";
2512 title = si->
title();
2516 title = pd->
title();
2546 sqlite3 *db =
nullptr;
2548 int rc = sqlite3_initialize();
2549 if (rc != SQLITE_OK)
2551 err(
"sqlite3_initialize failed\n");
2555 std::string dbFileName =
"doxygen_sqlite3.db";
2556 FileInfo fi(outputDirectory.
str()+
"/"+dbFileName);
2566 err(
"doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n");
2571 rc = sqlite3_open_v2(
2574 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
2577 if (rc != SQLITE_OK)
2580 err(
"Database open failed: doxygen_sqlite3.db\n");
2601# ifdef SQLITE3_DEBUG
2603 sqlite3_trace(db, &sqlLog,
nullptr);
2614 err(
"sqlite generator: prepareStatements failed!\n");
2623 msg(
"Generating Sqlite3 output for class {}\n",cd->name());
2630 msg(
"Generating Sqlite3 output for concept {}\n",cd->name());
2637 msg(
"Generating Sqlite3 output for module {}\n",mod->name());
2644 msg(
"Generating Sqlite3 output for namespace {}\n",nd->name());
2651 for (
const auto &fd : *fn)
2653 msg(
"Generating Sqlite3 output for file {}\n",fd->name());
2661 msg(
"Generating Sqlite3 output for group {}\n",gd->name());
2668 msg(
"Generating Sqlite3 output for page {}\n",pd->name());
2675 msg(
"Generating Sqlite3 output for dir {}\n",dd->name());
2682 msg(
"Generating Sqlite3 output for example {}\n",pd->name());
2689 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 QCString compoundTypeString() const =0
Returns the type of compound as a string.
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 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 QCString 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
The common base class of all entity definitions found in the sources.
virtual QCString docFile() const =0
virtual int getEndBodyLine() const =0
virtual int docLine() const =0
virtual QCString getDefFileName() const =0
virtual int getDefLine() const =0
virtual DefType definitionType() const =0
virtual QCString anchor() const =0
virtual const FileDef * getBodyDef() const =0
virtual QCString briefDescription(bool abbreviate=FALSE) const =0
virtual bool isAnonymous() const =0
virtual bool isHidden() const =0
virtual QCString documentation() const =0
virtual QCString displayName(bool includeScope=TRUE) const =0
virtual QCString getOutputFileBase() const =0
virtual Definition * getOuterScope() const =0
virtual const MemberVector & getReferencedByMembers() const =0
virtual int getStartBodyLine() const =0
virtual QCString getDefFileExtension() const =0
virtual int getDefColumn() const =0
virtual bool isReference() const =0
virtual const MemberVector & getReferencesMembers() const =0
virtual QCString inbodyDocumentation() const =0
virtual const QCString & name() 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 QCString absFilePath() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual QCString title() const =0
virtual const IncludeInfoList & includeFileList() const =0
virtual const MemberLists & getMemberLists() const =0
virtual const QCString & docName() 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 const GroupList & getSubGroups() const =0
virtual QCString groupTitle() 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
const T * find(const std::string &key) const
A model of a class/file/namespace member symbol.
virtual QCString typeString() const =0
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 bool isSealed() const =0
virtual QCString definition() const =0
virtual const ClassDef * getClassDef() const =0
virtual const ArgumentList & templateArguments() 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 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 QCString getScopeString() const =0
virtual bool isStatic() const =0
virtual const MemberDef * reimplements() const =0
virtual bool isMaybeDefault() const =0
virtual QCString getWriteAccessor() const =0
virtual bool isPrivateSettable() const =0
virtual QCString bitfieldString() const =0
virtual bool isRaisable() const =0
virtual bool isRemovable() const =0
virtual bool isConstrained() const =0
virtual bool isReadonly() const =0
virtual bool isBound() const =0
virtual bool isThreadLocal() 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 QCString getReadAccessor() const =0
virtual bool isGettable() const =0
virtual MemberType memberType() const =0
virtual bool isReadable() const =0
virtual bool isWeak() const =0
virtual QCString memberTypeName() const =0
virtual bool isStrong() const =0
virtual QCString argsString() const =0
virtual Specifier virtualness(int count=0) const =0
virtual bool isFinal() const =0
virtual const ArgumentList & declArgumentList() const =0
virtual bool isMutable() const =0
virtual bool isProperty() const =0
virtual const QCString & initializer() const =0
A list of MemberDef objects as shown in documentation sections.
MemberListType listType() const
constexpr bool isDetailed() const
constexpr bool isDeclaration() const
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 QCString 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 QCString title() const =0
virtual const GroupDef * getGroupDef() const =0
This is an alternative implementation of QCString.
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
char & at(size_t i)
Returns a reference to the character at index i.
bool isEmpty() const
Returns TRUE iff the string is empty.
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
const std::string & str() const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
bool stripPrefix(const QCString &prefix)
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 QCString &, const QCString &file, const QCString &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
QCString dateToString(DateTimeType includeTime)
Returns the current date, when includeTime is set also the time is provided.
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const QCString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const QCString &input, const DocOptions &options)
IDocParserPtr createDocParser()
factory function to create a parser
constexpr uint32_t IncludeKind_ImportMask
constexpr uint32_t IncludeKind_LocalMask
MemberDef * toMemberDef(Definition *d)
const char * qPrint(const char *s)
static bool memberdefExists(struct Refid refid)
QCString getSQLDocBlock(const Definition *scope, const Definition *def, const QCString &doc, const QCString &fileName, int lineNr)
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 generateSqlite3Section(const Definition *d, const MemberList *ml, struct Refid scope_refid, const char *, const QCString &=QCString(), const QCString &=QCString())
static bool memberdefIncomplete(struct Refid refid, const MemberDef *md)
SqlStmt memberdef_incomplete
static void generateSqlite3ForModule(const ModuleDef *mod)
static void getSQLDesc(SqlStmt &s, const char *col, const QCString &value, const Definition *def)
static bool bindTextParameter(SqlStmt &s, const char *name, const QCString &value)
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 getSQLDescCompound(SqlStmt &s, const char *col, const QCString &value, const Definition *def)
static int insertPath(QCString name, bool local=TRUE, bool found=TRUE, int type=1)
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)
const char * table_schema[][2]
static void endTransaction(sqlite3 *db)
static void stripQualifiers(QCString &typeStr)
static void writeTemplateArgumentList(const ArgumentList &al, const Definition *scope, const FileDef *fileScope)
static void associateAllClassMembers(const ClassDef *cd, struct Refid scope_refid)
struct Refid insertRefid(const QCString &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)
SqlStmt memberdef_param_insert
static int initializeViews(sqlite3 *db)
static int step(SqlStmt &s, bool getRowId=FALSE, bool select=FALSE)
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 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.
Class representing the data associated with a #include statement.
QCString filterTitle(const QCString &title)
static QCString stripFromPath(const QCString &p, const StringVector &l)
void linkifyText(const TextGeneratorIntf &out, const Definition *scope, const FileDef *fileScope, const Definition *self, const QCString &text, bool autoBreak, bool external, bool keepSpaces, int indentLevel)
QCString convertCharEntitiesToUTF8(const QCString &str)
A bunch of utility functions.