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: '%s'\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 "\tinitonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
193 "\tattribute INTEGER DEFAULT 0, -- 0:no 1:yes\n"
194 "\tproperty INTEGER DEFAULT 0, -- 0:no 1:yes\n"
195 "\treadonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
196 "\tbound INTEGER DEFAULT 0, -- 0:no 1:yes\n"
197 "\tconstrained INTEGER DEFAULT 0, -- 0:no 1:yes\n"
198 "\ttransient INTEGER DEFAULT 0, -- 0:no 1:yes\n"
199 "\tmaybevoid INTEGER DEFAULT 0, -- 0:no 1:yes\n"
200 "\tmaybedefault INTEGER DEFAULT 0, -- 0:no 1:yes\n"
201 "\tmaybeambiguous INTEGER DEFAULT 0, -- 0:no 1:yes\n"
202 "\treadable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
203 "\twritable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
204 "\tgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
205 "\tprivategettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
206 "\tprotectedgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
207 "\tsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
208 "\tprivatesettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
209 "\tprotectedsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
210 "\taccessor INTEGER DEFAULT 0, -- 0:no 1:assign 2:copy 3:retain 4:string 5:weak\n"
211 "\taddable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
212 "\tremovable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
213 "\traisable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
214 "\tkind TEXT NOT NULL, -- 'macro definition' 'function' 'variable' 'typedef' 'enumeration' 'enumvalue' 'signal' 'slot' 'friend' 'dcop' 'property' 'event' 'interface' 'service'\n"
215 "\tbodystart INTEGER DEFAULT 0, -- starting line of definition\n"
216 "\tbodyend INTEGER DEFAULT 0, -- ending line of definition\n"
217 "\tbodyfile_id INTEGER REFERENCES path, -- file of definition\n"
218 "\tfile_id INTEGER NOT NULL REFERENCES path, -- file where this identifier is located\n"
219 "\tline INTEGER NOT NULL, -- line where this identifier is located\n"
220 "\tcolumn INTEGER NOT NULL, -- column where this identifier is located\n"
221 "\tdetaileddescription TEXT,\n"
222 "\tbriefdescription TEXT,\n"
223 "\tinbodydescription TEXT,\n"
224 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
228 "CREATE TABLE IF NOT EXISTS member (\n"
229 "\t-- Memberdef <-> containing compound relation.\n"
230 "\t-- Similar to XML listofallmembers.\n"
231 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
232 "\tscope_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
233 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef,\n"
234 "\tprot INTEGER NOT NULL,\n"
235 "\tvirt INTEGER NOT NULL,\n"
236 "\tUNIQUE(scope_rowid, memberdef_rowid)\n"
240 "CREATE TABLE IF NOT EXISTS reimplements (\n"
241 "\t-- Inherited member reimplementation relations.\n"
242 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
243 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplementing memberdef id.\n"
244 "\treimplemented_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplemented memberdef id.\n"
245 "\tUNIQUE(memberdef_rowid, reimplemented_rowid) ON CONFLICT IGNORE\n"
249 "CREATE TABLE IF NOT EXISTS compounddef (\n"
250 "\t-- Class/struct definitions.\n"
251 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
252 "\tname TEXT NOT NULL,\n"
255 "\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"
257 "\tfile_id INTEGER NOT NULL REFERENCES path,\n"
258 "\tline INTEGER NOT NULL,\n"
259 "\tcolumn INTEGER NOT NULL,\n"
260 "\theader_id INTEGER REFERENCES path,\n"
261 "\tdetaileddescription TEXT,\n"
262 "\tbriefdescription TEXT,\n"
263 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
267 "CREATE TABLE IF NOT EXISTS compoundref (\n"
268 "\t-- Inheritance relation.\n"
269 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
270 "\tbase_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
271 "\tderived_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
272 "\tprot INTEGER NOT NULL,\n"
273 "\tvirt INTEGER NOT NULL,\n"
274 "\tUNIQUE(base_rowid, derived_rowid)\n"
278 "CREATE TABLE IF NOT EXISTS param (\n"
279 "\t-- All processed parameters.\n"
280 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
281 "\tattributes TEXT,\n"
287 "\tbriefdescription TEXT\n"
289 "CREATE UNIQUE INDEX idx_param ON param\n"
293 "CREATE TABLE IF NOT EXISTS memberdef_param (\n"
294 "\t-- Junction table for memberdef parameters.\n"
295 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
296 "\tmemberdef_id INTEGER NOT NULL REFERENCES memberdef,\n"
297 "\tparam_id INTEGER NOT NULL REFERENCES param\n"
324 "CREATE VIEW IF NOT EXISTS def (\n"
325 "\t-- Combined summary of all -def types for easier joins.\n"
335 "\tmemberdef.kind,\n"
336 "\tmemberdef.name,\n"
337 "\tmemberdef.briefdescription \n"
339 "JOIN memberdef ON refid.rowid=memberdef.rowid \n"
344 "\tcompounddef.kind,\n"
345 "\tcompounddef.name,\n"
347 "\t\tWHEN briefdescription IS NOT NULL \n"
348 "\t\tTHEN briefdescription \n"
352 "JOIN compounddef ON refid.rowid=compounddef.rowid;"
356 "CREATE VIEW IF NOT EXISTS local_file (\n"
357 "\t-- File paths found within the project.\n"
366 "FROM path WHERE path.type=1 AND path.local=1 AND path.found=1;\n"
370 "CREATE VIEW IF NOT EXISTS external_file (\n"
371 "\t-- File paths outside the project (found or not).\n"
380 "FROM path WHERE path.type=1 AND path.local=0;\n"
384 "CREATE VIEW IF NOT EXISTS inline_xrefs (\n"
385 "\t-- Crossrefs from inline member source.\n"
392 "\txrefs.src_rowid,\n"
393 "\txrefs.dst_rowid\n"
394 "FROM xrefs WHERE xrefs.context='inline';\n"
398 "CREATE VIEW IF NOT EXISTS argument_xrefs (\n"
399 "\t-- Crossrefs from member def/decl arguments\n"
406 "\txrefs.src_rowid,\n"
407 "\txrefs.dst_rowid\n"
408 "FROM xrefs WHERE xrefs.context='argument';\n"
412 "CREATE VIEW IF NOT EXISTS initializer_xrefs (\n"
413 "\t-- Crossrefs from member initializers\n"
420 "\txrefs.src_rowid,\n"
421 "\txrefs.dst_rowid\n"
422 "FROM xrefs WHERE xrefs.context='initializer';\n"
426 "CREATE VIEW IF NOT EXISTS inner_outer\n"
427 "\t-- Joins 'contains' relations to simplify inner/outer 'rel' queries.\n"
431 "FROM def as inner\n"
432 "\tJOIN contains ON inner.rowid=contains.inner_rowid\n"
433 "\tJOIN def AS outer ON outer.rowid=contains.outer_rowid;\n"
437 "CREATE VIEW IF NOT EXISTS rel (\n"
438 "\t-- Boolean indicator of relations available for a given entity.\n"
439 "\t-- Join to (compound-|member-)def to find fetch-worthy relations.\n"
443 "\tinnercompounds,\n"
444 "\toutercompounds,\n"
453 "\tinnernamespaces,\n"
454 "\touternamespaces,\n"
463 "\targument_links_in,\n"
464 "\targument_links_out,\n"
465 "\tinitializer_links_in,\n"
466 "\tinitializer_links_out\n"
470 "\tEXISTS (SELECT rowid FROM reimplements WHERE reimplemented_rowid=def.rowid),\n"
471 "\tEXISTS (SELECT rowid FROM reimplements WHERE memberdef_rowid=def.rowid),\n"
472 "\t-- rowid/kind for inner, [rowid:1/kind:1] for outer\n"
473 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid),\n"
474 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid),\n"
475 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='page'),\n"
476 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='page'),\n"
477 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='dir'),\n"
478 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='dir'),\n"
479 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='file'),\n"
480 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='file'),\n"
481 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind in (\n"
482 "'category','class','enum','exception','interface','module','protocol',\n"
483 "'service','singleton','struct','type','union'\n"
485 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1] in (\n"
486 "'category','class','enum','exception','interface','module','protocol',\n"
487 "'service','singleton','struct','type','union'\n"
489 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='namespace'),\n"
490 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='namespace'),\n"
491 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='group'),\n"
492 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='group'),\n"
493 "\tEXISTS (SELECT rowid FROM member WHERE scope_rowid=def.rowid),\n"
494 "\tEXISTS (SELECT rowid FROM member WHERE memberdef_rowid=def.rowid),\n"
495 "\tEXISTS (SELECT rowid FROM compoundref WHERE base_rowid=def.rowid),\n"
496 "\tEXISTS (SELECT rowid FROM compoundref WHERE derived_rowid=def.rowid),\n"
497 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE dst_rowid=def.rowid),\n"
498 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE src_rowid=def.rowid),\n"
499 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE dst_rowid=def.rowid),\n"
500 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE src_rowid=def.rowid),\n"
501 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE dst_rowid=def.rowid),\n"
502 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE src_rowid=def.rowid)\n"
503 "FROM def ORDER BY def.rowid;"
511 sqlite3 *
db =
nullptr;
520 "( doxygen_version, schema_version, generated_at, generated_on, project_name, project_number, project_brief )"
522 "(:doxygen_version,:schema_version,:generated_at,:generated_on,:project_name,:project_number,:project_brief )"
527 "INSERT INTO includes "
528 "( local, src_id, dst_id ) "
530 "(:local,:src_id,:dst_id )"
534 "SELECT COUNT(*) FROM includes WHERE "
535 "local=:local AND src_id=:src_id AND dst_id=:dst_id"
540 "INSERT INTO contains "
541 "( inner_rowid, outer_rowid )"
543 "(:inner_rowid,:outer_rowid )"
548 "SELECT rowid FROM path WHERE name=:name"
553 "( type, local, found, name )"
555 "(:type,:local,:found,:name )"
560 "SELECT rowid FROM refid WHERE refid=:refid"
573 "( src_rowid, dst_rowid, context )"
575 "(:src_rowid,:dst_rowid,:context )"
579 "INSERT INTO reimplements "
580 "( memberdef_rowid, reimplemented_rowid )"
582 "(:memberdef_rowid,:reimplemented_rowid )"
587 "SELECT EXISTS (SELECT * FROM memberdef WHERE rowid = :rowid)"
593 "SELECT * FROM memberdef WHERE "
594 "rowid = :rowid AND inline != 2 AND inline != :new_inline"
600 "INSERT INTO memberdef "
655 "detaileddescription,"
698 ":protectedsettable,"
699 ":protectedgettable,"
714 ":detaileddescription,"
728 "UPDATE memberdef SET "
730 "file_id = :file_id,"
733 "detaileddescription = 'Declaration: ' || :detaileddescription || 'Definition: ' || detaileddescription,"
734 "briefdescription = 'Declaration: ' || :briefdescription || 'Definition: ' || briefdescription,"
735 "inbodydescription = 'Declaration: ' || :inbodydescription || 'Definition: ' || inbodydescription "
736 "WHERE rowid = :rowid"
740 "UPDATE memberdef SET "
742 "bodystart = :bodystart,"
743 "bodyend = :bodyend,"
744 "bodyfile_id = :bodyfile_id,"
745 "detaileddescription = 'Declaration: ' || detaileddescription || 'Definition: ' || :detaileddescription,"
746 "briefdescription = 'Declaration: ' || briefdescription || 'Definition: ' || :briefdescription,"
747 "inbodydescription = 'Declaration: ' || inbodydescription || 'Definition: ' || :inbodydescription "
748 "WHERE rowid = :rowid"
753 "INSERT INTO member "
754 "( scope_rowid, memberdef_rowid, prot, virt ) "
756 "(:scope_rowid,:memberdef_rowid,:prot,:virt )"
761 "INSERT INTO compounddef "
773 "detaileddescription"
787 ":detaileddescription"
793 "SELECT * FROM compounddef WHERE rowid = :rowid"
799 "INSERT INTO compoundref "
800 "( base_rowid, derived_rowid, prot, virt ) "
802 "(:base_rowid,:derived_rowid,:prot,:virt )"
807 "SELECT rowid FROM param WHERE "
808 "(attributes IS NULL OR attributes=:attributes) AND "
809 "(type IS NULL OR type=:type) AND "
810 "(declname IS NULL OR declname=:declname) AND "
811 "(defname IS NULL OR defname=:defname) AND "
812 "(array IS NULL OR array=:array) AND "
813 "(defval IS NULL OR defval=:defval) AND "
814 "(briefdescription IS NULL OR briefdescription=:briefdescription)"
819 "( attributes, type, declname, defname, array, defval, briefdescription ) "
821 "(:attributes,:type,:declname,:defname,:array,:defval,:briefdescription)"
826 "INSERT INTO memberdef_param "
827 "( memberdef_id, param_id)"
829 "(:memberdef_id,:param_id)"
845 const QCString &anchor,std::string_view
848 std::string rs = file.
str();
864 int idx = sqlite3_bind_parameter_index(s.
stmt, name);
866 err(
"sqlite3_bind_parameter_index(%s)[%s] failed: %s\n", name, s.
query, sqlite3_errmsg(s.
db));
869 int rv = sqlite3_bind_text(s.
stmt, idx, value.
data(), -1, SQLITE_TRANSIENT);
871 err(
"sqlite3_bind_text(%s)[%s] failed: %s\n", name, s.
query, sqlite3_errmsg(s.
db));
879 int idx = sqlite3_bind_parameter_index(s.
stmt, name);
881 err(
"sqlite3_bind_parameter_index(%s)[%s] failed to find column: %s\n", name, s.
query, sqlite3_errmsg(s.
db));
884 int rv = sqlite3_bind_int(s.
stmt, idx, value);
886 err(
"sqlite3_bind_int(%s)[%s] failed: %s\n", name, s.
query, sqlite3_errmsg(s.
db));
895 int rc = sqlite3_step(s.
stmt);
896 if (rc!=SQLITE_DONE && rc!=SQLITE_ROW)
898 DBG_CTX((
"sqlite3_step: %s (rc: %d)\n", sqlite3_errmsg(s.
db), rc));
899 sqlite3_reset(s.
stmt);
900 sqlite3_clear_bindings(s.
stmt);
903 if (getRowId && select) rowid = sqlite3_column_int(s.
stmt, 0);
904 if (getRowId && !select) rowid =
static_cast<int>(sqlite3_last_insert_rowid(s.
db));
905 sqlite3_reset(s.
stmt);
906 sqlite3_clear_bindings(s.
stmt);
913 if (name==
nullptr)
return rowid;
972 return test ? true :
false;
980 return test ? true :
false;
987 return test ? true :
false;
1025 if (declAl.
size()>0)
1027 auto defIt = defAl.
begin();
1032 if (defIt!=defAl.
end())
1038 if (!a.attrib.isEmpty())
1043 if (!a.type.isEmpty())
1048 for (
const auto &s : list)
1058 if (!a.name.isEmpty())
1068 if (!a.array.isEmpty())
1073 if (!a.defval.isEmpty())
1086 DBG_CTX((
"error INSERT params failed\n"));
1144 else if (typeStr==
"virtual") typeStr=
"";
1151 int rc = sqlite3_prepare_v2(db,s.
query,-1,&s.
stmt,
nullptr);
1154 err(
"prepare failed for:\n %s\n %s\n", s.
query, sqlite3_errmsg(db));
1196 char * sErrMsg =
nullptr;
1197 sqlite3_exec(db,
"BEGIN TRANSACTION",
nullptr,
nullptr, &sErrMsg);
1202 char * sErrMsg =
nullptr;
1203 sqlite3_exec(db,
"END TRANSACTION",
nullptr,
nullptr, &sErrMsg);
1208 char * sErrMsg =
nullptr;
1209 sqlite3_exec(db,
"PRAGMA synchronous = OFF",
nullptr,
nullptr, &sErrMsg);
1210 sqlite3_exec(db,
"PRAGMA journal_mode = MEMORY",
nullptr,
nullptr, &sErrMsg);
1211 sqlite3_exec(db,
"PRAGMA temp_store = MEMORY;",
nullptr,
nullptr, &sErrMsg);
1216 msg(
"Initializing DB schema (tables)...\n");
1220 char *errmsg =
nullptr;
1221 int rc = sqlite3_exec(db, q,
nullptr,
nullptr, &errmsg);
1222 if (rc != SQLITE_OK)
1224 err(
"failed to execute query: %s\n\t%s\n", q, errmsg);
1233 msg(
"Initializing DB schema (views)...\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: %s\n\t%s\n", q, errmsg);
1263 for (
const auto &cd : cl)
1265 if (!cd->isHidden() && !cd->isAnonymous())
1278 for (
const auto &cd : cl)
1290 for (
const auto &mod : ml)
1303 for (
const auto &pd : pl)
1306 pd->getGroupDef() ? pd->getOutputFileBase()+
"_"+pd->name() : pd->getOutputFileBase()
1317 for (
const auto &sgd : gl)
1329 for (
const auto &fd: fl)
1341 for (
const auto subdir : dl)
1353 for (
const auto &nd : nl)
1355 if (!nd->isHidden() && !nd->isAnonymous())
1373 if (!a.type.isEmpty())
1379 if (!a.name.isEmpty())
1386 if (!a.defval.isEmpty())
1436 auto astImpl =
dynamic_cast<const DocNodeAST*
>(ast.get());
1444 std::visit(visitor,astImpl->root);
1593 struct SqlStmt memberdef_update;
1600 if (bodyfile_id == -1)
1602 sqlite3_clear_bindings(memberdef_update.
stmt);
1644 for (
const auto &rmd : refList)
1650 for (
const auto &rmd : refByList)
1711 if (bitfield.
at(0)==
':') bitfield=bitfield.
mid(1);
1731 else if (md->
isCopy()) accessor = 2;
1732 else if (md->
isRetain()) accessor = 3;
1733 else if (md->
isStrong()) accessor = 4;
1734 else if (md->
isWeak()) accessor = 5;
1798 for (
const auto &s : list)
1802 DBG_CTX((
"initializer:%s %s %s %d\n",
1839 if (bodyfile_id == -1)
1881 struct Refid scope_refid,
1886 if (ml==
nullptr)
return;
1887 for (
const auto &md : *ml)
1903 for (
auto &mi : *mni)
1991 DBG_CTX((
"-----> ClassDef includeInfo for %s\n",
qPrint(nm)));
1992 DBG_CTX((
" local : %d\n", ii->local));
1993 DBG_CTX((
" imported : %d\n", ii->imported));
1998 DBG_CTX((
" file_id : %d\n", file_id));
1999 DBG_CTX((
" header_id: %d\n", header_id));
2028 struct Refid derived_refid =
insertRefid(bcd.classDef->getOutputFileBase());
2047 mg->documentation());
2126 mg->documentation());
2186 mg->documentation());
2246 if(ii.fileDef->isReference())
2249 QCString tagfile = ii.fileDef->getReference();
2250 dst_path = ii.fileDef->absFilePath();
2255 dst_path = ii.fileDef->absFilePath();
2264 DBG_CTX((
"-----> FileDef includeInfo for %s\n",
qPrint(ii.includeName)));
2265 DBG_CTX((
" local: %d\n", isLocal));
2269 DBG_CTX((
"include: %s\n",
qPrint(ii.fileDef->absFilePath())));
2271 DBG_CTX((
" src_id : %d\n", src_id));
2272 DBG_CTX((
" dst_id: %d\n", dst_id));
2295 if(ii.fileDef->isReference())
2298 QCString tagfile = ii.fileDef->getReference();
2299 src_path = ii.fileDef->absFilePath();
2304 src_path = ii.fileDef->absFilePath();
2337 mg->documentation());
2410 mg->documentation());
2484 qrefid+=
"_"+pd->
name();
2486 if (qrefid==
"index") qrefid=
"indexpage";
2514 title = si->
title();
2518 title = pd->
title();
2548 sqlite3 *db =
nullptr;
2550 int rc = sqlite3_initialize();
2551 if (rc != SQLITE_OK)
2553 err(
"sqlite3_initialize failed\n");
2557 std::string dbFileName =
"doxygen_sqlite3.db";
2558 FileInfo fi(outputDirectory.
str()+
"/"+dbFileName);
2568 err(
"doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n");
2573 rc = sqlite3_open_v2(
2576 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
2579 if (rc != SQLITE_OK)
2582 err(
"Database open failed: %s\n",
"doxygen_sqlite3.db");
2603# ifdef SQLITE3_DEBUG
2605 sqlite3_trace(db, &sqlLog,
nullptr);
2616 err(
"sqlite generator: prepareStatements failed!\n");
2625 msg(
"Generating Sqlite3 output for class %s\n",
qPrint(cd->name()));
2632 msg(
"Generating Sqlite3 output for concept %s\n",
qPrint(cd->name()));
2639 msg(
"Generating Sqlite3 output for module %s\n",
qPrint(mod->name()));
2646 msg(
"Generating Sqlite3 output for namespace %s\n",
qPrint(nd->name()));
2653 for (
const auto &fd : *fn)
2655 msg(
"Generating Sqlite3 output for file %s\n",
qPrint(fd->name()));
2663 msg(
"Generating Sqlite3 output for group %s\n",
qPrint(gd->name()));
2670 msg(
"Generating Sqlite3 output for page %s\n",
qPrint(pd->name()));
2677 msg(
"Generating Sqlite3 output for dir %s\n",
qPrint(dd->name()));
2684 msg(
"Generating Sqlite3 output for example %s\n",
qPrint(pd->name()));
2691 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 const MemberGroupList & getMemberGroups() const =0
Returns the member groups defined for this class.
virtual const ClassDef * templateMaster() const =0
Returns the template master of which this class is an instance.
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
Find an object given the key.
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 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.
IDocParserPtr createDocParser()
factory function to create a parser
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const QCString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const QCString &input, bool indexWords, bool isExample, const QCString &exampleName, bool singleLine, bool linkFromIndex, bool markdownSupport)
constexpr uint32_t IncludeKind_ImportMask
constexpr uint32_t IncludeKind_LocalMask
MemberDef * toMemberDef(Definition *d)
void msg(const char *fmt,...)
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.