58# define DBG_CTX(x) printf x
60# define DBG_CTX(x) do { } while(0)
63# ifdef SQLITE3_DEBUG_SQL
65static void sqlLog(
void *dbName,
const char *sql){
66 msg(
"SQL: '{}'\n", sql);
73 "CREATE TABLE IF NOT EXISTS meta (\n"
74 "\t-- Information about this db and how it was generated.\n"
76 "\tdoxygen_version TEXT PRIMARY KEY NOT NULL,\n"
84 "\tschema_version TEXT NOT NULL, -- Schema-specific semver\n"
86 "\tgenerated_at TEXT NOT NULL,\n"
87 "\tgenerated_on TEXT NOT NULL,\n"
89 "\tproject_name TEXT NOT NULL,\n"
90 "\tproject_number TEXT,\n"
91 "\tproject_brief TEXT\n"
95 "CREATE TABLE IF NOT EXISTS includes (\n"
96 "\t-- #include relations.\n"
97 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
98 "\tlocal INTEGER NOT NULL,\n"
99 "\tsrc_id INTEGER NOT NULL REFERENCES path, -- File id of the includer.\n"
100 "\tdst_id INTEGER NOT NULL REFERENCES path, -- File id of the includee.\n"
105 "\tUNIQUE(local, src_id, dst_id) ON CONFLICT IGNORE\n"
109 "CREATE TABLE IF NOT EXISTS contains (\n"
110 "\t-- inner/outer relations (file, namespace, dir, class, group, page)\n"
111 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
112 "\tinner_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
113 "\touter_rowid INTEGER NOT NULL REFERENCES compounddef\n"
130 "CREATE TABLE IF NOT EXISTS path (\n"
131 "\t-- Paths of source files and includes.\n"
132 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
133 "\ttype INTEGER NOT NULL, -- 1:file 2:dir\n"
134 "\tlocal INTEGER NOT NULL,\n"
135 "\tfound INTEGER NOT NULL,\n"
136 "\tname TEXT NOT NULL\n"
140 "CREATE TABLE IF NOT EXISTS refid (\n"
141 "\t-- Distinct refid for all documented entities.\n"
142 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
143 "\trefid TEXT NOT NULL UNIQUE\n"
147 "CREATE TABLE IF NOT EXISTS xrefs (\n"
148 "\t-- Cross-reference relation\n"
149 "\t-- (combines xml <referencedby> and <references> nodes).\n"
150 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
151 "\tsrc_rowid INTEGER NOT NULL REFERENCES refid, -- referrer id.\n"
152 "\tdst_rowid INTEGER NOT NULL REFERENCES refid, -- referee id.\n"
153 "\tcontext TEXT NOT NULL, -- inline, argument, initializer\n"
154 "\t-- Just need to know they link; ignore duplicates.\n"
155 "\tUNIQUE(src_rowid, dst_rowid, context) ON CONFLICT IGNORE\n"
159 "CREATE TABLE IF NOT EXISTS memberdef (\n"
160 "\t-- All processed identifiers.\n"
161 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
162 "\tname TEXT NOT NULL,\n"
163 "\tdefinition TEXT,\n"
165 "\targsstring TEXT,\n"
167 "\tinitializer TEXT,\n"
171 "\tprot INTEGER DEFAULT 0, -- 0:public 1:protected 2:private 3:package\n"
172 "\tstatic INTEGER DEFAULT 0, -- 0:no 1:yes\n"
173 "\textern INTEGER DEFAULT 0, -- 0:no 1:yes\n"
174 "\tconst INTEGER DEFAULT 0, -- 0:no 1:yes\n"
175 "\texplicit INTEGER DEFAULT 0, -- 0:no 1:yes\n"
176 "\tinline INTEGER DEFAULT 0, -- 0:no 1:yes 2:both (set after encountering inline and not-inline)\n"
177 "\tfinal INTEGER DEFAULT 0, -- 0:no 1:yes\n"
178 "\tsealed INTEGER DEFAULT 0, -- 0:no 1:yes\n"
179 "\tnew INTEGER DEFAULT 0, -- 0:no 1:yes\n"
180 "\toptional INTEGER DEFAULT 0, -- 0:no 1:yes\n"
181 "\trequired INTEGER DEFAULT 0, -- 0:no 1:yes\n"
182 "\tvolatile INTEGER DEFAULT 0, -- 0:no 1:yes\n"
183 "\tvirt INTEGER DEFAULT 0, -- 0:no 1:virtual 2:pure-virtual\n"
184 "\tmutable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
185 "\tthread_local INTEGER DEFAULT 0, -- 0:no 1:yes\n"
186 "\tinitonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
187 "\tattribute INTEGER DEFAULT 0, -- 0:no 1:yes\n"
188 "\tproperty INTEGER DEFAULT 0, -- 0:no 1:yes\n"
189 "\treadonly INTEGER DEFAULT 0, -- 0:no 1:yes\n"
190 "\tbound INTEGER DEFAULT 0, -- 0:no 1:yes\n"
191 "\tconstrained INTEGER DEFAULT 0, -- 0:no 1:yes\n"
192 "\ttransient INTEGER DEFAULT 0, -- 0:no 1:yes\n"
193 "\tmaybevoid INTEGER DEFAULT 0, -- 0:no 1:yes\n"
194 "\tmaybedefault INTEGER DEFAULT 0, -- 0:no 1:yes\n"
195 "\tmaybeambiguous INTEGER DEFAULT 0, -- 0:no 1:yes\n"
196 "\treadable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
197 "\twritable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
198 "\tgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
199 "\tprivategettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
200 "\tprotectedgettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
201 "\tsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
202 "\tprivatesettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
203 "\tprotectedsettable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
204 "\taccessor INTEGER DEFAULT 0, -- 0:no 1:assign 2:copy 3:retain 4:string 5:weak\n"
205 "\taddable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
206 "\tremovable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
207 "\traisable INTEGER DEFAULT 0, -- 0:no 1:yes\n"
208 "\tkind TEXT NOT NULL, -- 'macro definition' 'function' 'variable' 'typedef' 'enumeration' 'enumvalue' 'signal' 'slot' 'friend' 'dcop' 'property' 'event' 'interface' 'service'\n"
209 "\tbodystart INTEGER DEFAULT 0, -- starting line of definition\n"
210 "\tbodyend INTEGER DEFAULT 0, -- ending line of definition\n"
211 "\tbodyfile_id INTEGER REFERENCES path, -- file of definition\n"
212 "\tfile_id INTEGER NOT NULL REFERENCES path, -- file where this identifier is located\n"
213 "\tline INTEGER NOT NULL, -- line where this identifier is located\n"
214 "\tcolumn INTEGER NOT NULL, -- column where this identifier is located\n"
215 "\tdetaileddescription TEXT,\n"
216 "\tbriefdescription TEXT,\n"
217 "\tinbodydescription TEXT,\n"
218 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
222 "CREATE TABLE IF NOT EXISTS member (\n"
223 "\t-- Memberdef <-> containing compound relation.\n"
224 "\t-- Similar to XML listofallmembers.\n"
225 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
226 "\tscope_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
227 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef,\n"
228 "\tprot INTEGER NOT NULL,\n"
229 "\tvirt INTEGER NOT NULL,\n"
230 "\tUNIQUE(scope_rowid, memberdef_rowid)\n"
234 "CREATE TABLE IF NOT EXISTS reimplements (\n"
235 "\t-- Inherited member reimplementation relations.\n"
236 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
237 "\tmemberdef_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplementing memberdef id.\n"
238 "\treimplemented_rowid INTEGER NOT NULL REFERENCES memberdef, -- reimplemented memberdef id.\n"
239 "\tUNIQUE(memberdef_rowid, reimplemented_rowid) ON CONFLICT IGNORE\n"
243 "CREATE TABLE IF NOT EXISTS compounddef (\n"
244 "\t-- Class/struct definitions.\n"
245 "\trowid INTEGER PRIMARY KEY NOT NULL,\n"
246 "\tname TEXT NOT NULL,\n"
249 "\tkind TEXT NOT NULL, -- 'category' 'class' 'constants' 'dir' 'enum' 'example' 'exception' 'file' 'group' 'interface' 'library' 'module' 'namespace' 'package' 'page' 'protocol' 'service' 'singleton' 'struct' 'type' 'union' 'unknown' ''\n"
251 "\tfile_id INTEGER NOT NULL REFERENCES path,\n"
252 "\tline INTEGER NOT NULL,\n"
253 "\tcolumn INTEGER NOT NULL,\n"
254 "\theader_id INTEGER REFERENCES path,\n"
255 "\tdetaileddescription TEXT,\n"
256 "\tbriefdescription TEXT,\n"
257 "\tFOREIGN KEY (rowid) REFERENCES refid (rowid)\n"
261 "CREATE TABLE IF NOT EXISTS compoundref (\n"
262 "\t-- Inheritance relation.\n"
263 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
264 "\tbase_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
265 "\tderived_rowid INTEGER NOT NULL REFERENCES compounddef,\n"
266 "\tprot INTEGER NOT NULL,\n"
267 "\tvirt INTEGER NOT NULL,\n"
268 "\tUNIQUE(base_rowid, derived_rowid)\n"
272 "CREATE TABLE IF NOT EXISTS param (\n"
273 "\t-- All processed parameters.\n"
274 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
275 "\tattributes TEXT,\n"
281 "\tbriefdescription TEXT\n"
283 "CREATE UNIQUE INDEX idx_param ON param\n"
287 "CREATE TABLE IF NOT EXISTS memberdef_param (\n"
288 "\t-- Junction table for memberdef parameters.\n"
289 "\trowid INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n"
290 "\tmemberdef_id INTEGER NOT NULL REFERENCES memberdef,\n"
291 "\tparam_id INTEGER NOT NULL REFERENCES param\n"
318 "CREATE VIEW IF NOT EXISTS def (\n"
319 "\t-- Combined summary of all -def types for easier joins.\n"
329 "\tmemberdef.kind,\n"
330 "\tmemberdef.name,\n"
331 "\tmemberdef.briefdescription \n"
333 "JOIN memberdef ON refid.rowid=memberdef.rowid \n"
338 "\tcompounddef.kind,\n"
339 "\tcompounddef.name,\n"
341 "\t\tWHEN briefdescription IS NOT NULL \n"
342 "\t\tTHEN briefdescription \n"
346 "JOIN compounddef ON refid.rowid=compounddef.rowid;"
350 "CREATE VIEW IF NOT EXISTS local_file (\n"
351 "\t-- File paths found within the project.\n"
360 "FROM path WHERE path.type=1 AND path.local=1 AND path.found=1;\n"
364 "CREATE VIEW IF NOT EXISTS external_file (\n"
365 "\t-- File paths outside the project (found or not).\n"
374 "FROM path WHERE path.type=1 AND path.local=0;\n"
378 "CREATE VIEW IF NOT EXISTS inline_xrefs (\n"
379 "\t-- Crossrefs from inline member source.\n"
386 "\txrefs.src_rowid,\n"
387 "\txrefs.dst_rowid\n"
388 "FROM xrefs WHERE xrefs.context='inline';\n"
392 "CREATE VIEW IF NOT EXISTS argument_xrefs (\n"
393 "\t-- Crossrefs from member def/decl arguments\n"
400 "\txrefs.src_rowid,\n"
401 "\txrefs.dst_rowid\n"
402 "FROM xrefs WHERE xrefs.context='argument';\n"
406 "CREATE VIEW IF NOT EXISTS initializer_xrefs (\n"
407 "\t-- Crossrefs from member initializers\n"
414 "\txrefs.src_rowid,\n"
415 "\txrefs.dst_rowid\n"
416 "FROM xrefs WHERE xrefs.context='initializer';\n"
420 "CREATE VIEW IF NOT EXISTS inner_outer\n"
421 "\t-- Joins 'contains' relations to simplify inner/outer 'rel' queries.\n"
425 "FROM def as inner\n"
426 "\tJOIN contains ON inner.rowid=contains.inner_rowid\n"
427 "\tJOIN def AS outer ON outer.rowid=contains.outer_rowid;\n"
431 "CREATE VIEW IF NOT EXISTS rel (\n"
432 "\t-- Boolean indicator of relations available for a given entity.\n"
433 "\t-- Join to (compound-|member-)def to find fetch-worthy relations.\n"
437 "\tinnercompounds,\n"
438 "\toutercompounds,\n"
447 "\tinnernamespaces,\n"
448 "\touternamespaces,\n"
457 "\targument_links_in,\n"
458 "\targument_links_out,\n"
459 "\tinitializer_links_in,\n"
460 "\tinitializer_links_out\n"
464 "\tEXISTS (SELECT rowid FROM reimplements WHERE reimplemented_rowid=def.rowid),\n"
465 "\tEXISTS (SELECT rowid FROM reimplements WHERE memberdef_rowid=def.rowid),\n"
466 "\t-- rowid/kind for inner, [rowid:1/kind:1] for outer\n"
467 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid),\n"
468 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid),\n"
469 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='page'),\n"
470 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='page'),\n"
471 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='dir'),\n"
472 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='dir'),\n"
473 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='file'),\n"
474 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='file'),\n"
475 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind in (\n"
476 "'category','class','enum','exception','interface','module','protocol',\n"
477 "'service','singleton','struct','type','union'\n"
479 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1] in (\n"
480 "'category','class','enum','exception','interface','module','protocol',\n"
481 "'service','singleton','struct','type','union'\n"
483 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='namespace'),\n"
484 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='namespace'),\n"
485 "\tEXISTS (SELECT * FROM inner_outer WHERE [rowid:1]=def.rowid AND kind='group'),\n"
486 "\tEXISTS (SELECT * FROM inner_outer WHERE rowid=def.rowid AND [kind:1]='group'),\n"
487 "\tEXISTS (SELECT rowid FROM member WHERE scope_rowid=def.rowid),\n"
488 "\tEXISTS (SELECT rowid FROM member WHERE memberdef_rowid=def.rowid),\n"
489 "\tEXISTS (SELECT rowid FROM compoundref WHERE base_rowid=def.rowid),\n"
490 "\tEXISTS (SELECT rowid FROM compoundref WHERE derived_rowid=def.rowid),\n"
491 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE dst_rowid=def.rowid),\n"
492 "\tEXISTS (SELECT rowid FROM inline_xrefs WHERE src_rowid=def.rowid),\n"
493 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE dst_rowid=def.rowid),\n"
494 "\tEXISTS (SELECT rowid FROM argument_xrefs WHERE src_rowid=def.rowid),\n"
495 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE dst_rowid=def.rowid),\n"
496 "\tEXISTS (SELECT rowid FROM initializer_xrefs WHERE src_rowid=def.rowid)\n"
497 "FROM def ORDER BY def.rowid;"
505 sqlite3 *
db =
nullptr;
514 "( doxygen_version, schema_version, generated_at, generated_on, project_name, project_number, project_brief )"
516 "(:doxygen_version,:schema_version,:generated_at,:generated_on,:project_name,:project_number,:project_brief )"
521 "INSERT INTO includes "
522 "( local, src_id, dst_id ) "
524 "(:local,:src_id,:dst_id )"
528 "SELECT COUNT(*) FROM includes WHERE "
529 "local=:local AND src_id=:src_id AND dst_id=:dst_id"
534 "INSERT INTO contains "
535 "( inner_rowid, outer_rowid )"
537 "(:inner_rowid,:outer_rowid )"
542 "SELECT rowid FROM path WHERE name=:name"
547 "( type, local, found, name )"
549 "(:type,:local,:found,:name )"
554 "SELECT rowid FROM refid WHERE refid=:refid"
567 "( src_rowid, dst_rowid, context )"
569 "(:src_rowid,:dst_rowid,:context )"
573 "INSERT INTO reimplements "
574 "( memberdef_rowid, reimplemented_rowid )"
576 "(:memberdef_rowid,:reimplemented_rowid )"
581 "SELECT EXISTS (SELECT * FROM memberdef WHERE rowid = :rowid)"
587 "SELECT * FROM memberdef WHERE "
588 "rowid = :rowid AND inline != 2 AND inline != :new_inline"
594 "INSERT INTO memberdef "
650 "detaileddescription,"
694 ":protectedsettable,"
695 ":protectedgettable,"
710 ":detaileddescription,"
724 "UPDATE memberdef SET "
726 "file_id = :file_id,"
729 "detaileddescription = 'Declaration: ' || :detaileddescription || 'Definition: ' || detaileddescription,"
730 "briefdescription = 'Declaration: ' || :briefdescription || 'Definition: ' || briefdescription,"
731 "inbodydescription = 'Declaration: ' || :inbodydescription || 'Definition: ' || inbodydescription "
732 "WHERE rowid = :rowid"
736 "UPDATE memberdef SET "
738 "bodystart = :bodystart,"
739 "bodyend = :bodyend,"
740 "bodyfile_id = :bodyfile_id,"
741 "detaileddescription = 'Declaration: ' || detaileddescription || 'Definition: ' || :detaileddescription,"
742 "briefdescription = 'Declaration: ' || briefdescription || 'Definition: ' || :briefdescription,"
743 "inbodydescription = 'Declaration: ' || inbodydescription || 'Definition: ' || :inbodydescription "
744 "WHERE rowid = :rowid"
749 "INSERT INTO member "
750 "( scope_rowid, memberdef_rowid, prot, virt ) "
752 "(:scope_rowid,:memberdef_rowid,:prot,:virt )"
757 "INSERT INTO compounddef "
769 "detaileddescription"
783 ":detaileddescription"
789 "SELECT * FROM compounddef WHERE rowid = :rowid"
795 "INSERT INTO compoundref "
796 "( base_rowid, derived_rowid, prot, virt ) "
798 "(:base_rowid,:derived_rowid,:prot,:virt )"
803 "SELECT rowid FROM param WHERE "
804 "(attributes IS NULL OR attributes=:attributes) AND "
805 "(type IS NULL OR type=:type) AND "
806 "(declname IS NULL OR declname=:declname) AND "
807 "(defname IS NULL OR defname=:defname) AND "
808 "(array IS NULL OR array=:array) AND "
809 "(defval IS NULL OR defval=:defval) AND "
810 "(briefdescription IS NULL OR briefdescription=:briefdescription)"
815 "( attributes, type, declname, defname, array, defval, briefdescription ) "
817 "(:attributes,:type,:declname,:defname,:array,:defval,:briefdescription)"
822 "INSERT INTO memberdef_param "
823 "( memberdef_id, param_id)"
825 "(:memberdef_id,:param_id)"
841 const DString &anchor,std::string_view
844 std::string rs = file.
str();
860 int idx = sqlite3_bind_parameter_index(s.
stmt, name);
862 err(
"sqlite3_bind_parameter_index({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
865 int rv = sqlite3_bind_text(s.
stmt, idx, value.
data(), -1, SQLITE_TRANSIENT);
867 err(
"sqlite3_bind_text({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
875 int idx = sqlite3_bind_parameter_index(s.
stmt, name);
877 err(
"sqlite3_bind_parameter_index({})[{}] failed to find column: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
880 int rv = sqlite3_bind_int(s.
stmt, idx, value);
882 err(
"sqlite3_bind_int({})[{}] failed: {}\n", name, s.
query, sqlite3_errmsg(s.
db));
896 int rc = sqlite3_step(s.
stmt);
897 if (rc!=SQLITE_DONE && rc!=SQLITE_ROW)
899 DBG_CTX((
"sqlite3_step: %s (rc: %d)\n", sqlite3_errmsg(s.
db), rc));
900 sqlite3_reset(s.
stmt);
901 sqlite3_clear_bindings(s.
stmt);
904 if (getRowId && select) rowid = sqlite3_column_int(s.
stmt, 0);
905 if (getRowId && !select) rowid =
static_cast<int>(sqlite3_last_insert_rowid(s.
db));
906 sqlite3_reset(s.
stmt);
907 sqlite3_clear_bindings(s.
stmt);
914 if (name==
nullptr)
return rowid;
973 return test ? true :
false;
981 return test ? true :
false;
988 return test ? true :
false;
1028 if (declAl.
size()>0)
1030 auto defIt = defAl.
begin();
1035 if (defIt!=defAl.
end())
1041 if (!a.attrib.empty())
1046 if (!a.type.empty())
1051 for (
const auto &s : list)
1061 if (!a.name.empty())
1066 if (defArg && !defArg->
name.
empty() && defArg->
name!=a.name)
1071 if (!a.array.empty())
1076 if (!a.defval.empty())
1089 DBG_CTX((
"error INSERT params failed\n"));
1128 if (md->
memberType()==MemberType::EnumValue)
return;
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.empty())
1382 if (!a.name.empty())
1389 if (!a.defval.empty())
1421 if (doc.
empty())
return "";
1433 auto astImpl =
dynamic_cast<const DocNodeAST*
>(ast.get());
1441 std::visit(visitor,astImpl->root);
1568 if (md->
memberType()==MemberType::EnumValue)
return;
1590 struct SqlStmt memberdef_update;
1597 if (bodyfile_id == -1)
1599 sqlite3_clear_bindings(memberdef_update.
stmt);
1633 step(memberdef_update,
true);
1641 for (
const auto &rmd : refList)
1647 for (
const auto &rmd : refByList)
1679 if (md->
memberType() == MemberType::Variable)
1697 if (bitfield.
at(0)==
':') bitfield=bitfield.
mid(1);
1701 else if (md->
memberType() == MemberType::Property)
1717 else if (md->
isCopy()) accessor = 2;
1718 else if (md->
isRetain()) accessor = 3;
1719 else if (md->
isStrong()) accessor = 4;
1720 else if (md->
isWeak()) accessor = 5;
1727 else if (md->
memberType() == MemberType::Event)
1762 if (!typeStr.
empty())
1787 for (
const auto &s : list)
1791 DBG_CTX((
"initializer:%s %s %s %d\n",
1828 if (bodyfile_id == -1)
1848 else if (md->
memberType()==MemberType::Define &&
1870 struct Refid scope_refid,
1875 if (ml==
nullptr)
return;
1876 for (
const auto &md : *ml)
1892 for (
auto &mi : *mni)
1980 DBG_CTX((
"-----> ClassDef includeInfo for %s\n",
qPrint(nm)));
1981 DBG_CTX((
" local : %d\n", ii->local));
1982 DBG_CTX((
" imported : %d\n", ii->imported));
1987 DBG_CTX((
" file_id : %d\n", file_id));
1988 DBG_CTX((
" header_id: %d\n", header_id));
2017 struct Refid derived_refid =
insertRefid(bcd.classDef->getOutputFileBase());
2036 mg->documentation());
2115 mg->documentation());
2175 mg->documentation());
2235 if(ii.fileDef->isReference())
2238 DString tagfile = ii.fileDef->getReference();
2239 dst_path = ii.fileDef->absFilePath();
2244 dst_path = ii.fileDef->absFilePath();
2250 dst_id =
insertPath(ii.includeName,isLocal,
false);
2253 DBG_CTX((
"-----> FileDef includeInfo for %s\n",
qPrint(ii.includeName)));
2254 DBG_CTX((
" local: %d\n", isLocal));
2258 DBG_CTX((
"include: %s\n",
qPrint(ii.fileDef->absFilePath())));
2260 DBG_CTX((
" src_id : %d\n", src_id));
2261 DBG_CTX((
" dst_id: %d\n", dst_id));
2284 if(ii.fileDef->isReference())
2287 DString tagfile = ii.fileDef->getReference();
2288 src_path = ii.fileDef->absFilePath();
2293 src_path = ii.fileDef->absFilePath();
2299 src_id =
insertPath(ii.includeName,isLocal,
false);
2326 mg->documentation());
2399 mg->documentation());
2473 qrefid+=
"_"+pd->
name();
2475 if (qrefid==
"index") qrefid=
"indexpage";
2503 title = si->
title();
2507 title = pd->
title();
2537 sqlite3 *db =
nullptr;
2539 int rc = sqlite3_initialize();
2540 if (rc != SQLITE_OK)
2542 err(
"sqlite3_initialize failed\n");
2546 std::string dbFileName =
"doxygen_sqlite3.db";
2547 FileInfo fi(outputDirectory.
str()+
"/"+dbFileName);
2557 err(
"doxygen_sqlite3.db already exists! Rename, remove, or archive it to regenerate\n");
2562 rc = sqlite3_open_v2(
2565 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
2568 if (rc != SQLITE_OK)
2571 err(
"Database open failed: doxygen_sqlite3.db\n");
2592# ifdef SQLITE3_DEBUG
2594 sqlite3_trace(db, &sqlLog,
nullptr);
2605 err(
"sqlite generator: prepareStatements failed!\n");
2614 msg(
"Generating Sqlite3 output for class {}\n",cd->name());
2621 msg(
"Generating Sqlite3 output for concept {}\n",cd->name());
2628 msg(
"Generating Sqlite3 output for module {}\n",mod->name());
2635 msg(
"Generating Sqlite3 output for namespace {}\n",nd->name());
2642 for (
const auto &fd : *fn)
2644 msg(
"Generating Sqlite3 output for file {}\n",fd->name());
2652 msg(
"Generating Sqlite3 output for group {}\n",gd->name());
2659 msg(
"Generating Sqlite3 output for page {}\n",pd->name());
2666 msg(
"Generating Sqlite3 output for dir {}\n",dd->name());
2673 msg(
"Generating Sqlite3 output for example {}\n",pd->name());
2680 msg(
"Generating Sqlite3 output for the main page\n");
This class contains the information about the argument of a function or template.
This class represents an function or template argument list.
bool constSpecifier() const
bool volatileSpecifier() const
A abstract class representing of a compound symbol.
virtual 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 file in which this compound's definition can be found.
virtual const IncludeInfo * includeInfo() const =0
virtual DString title() const =0
virtual const BaseClassList & subClasses() const =0
Returns the list of sub classes that directly derive from this class.
virtual ArgumentList getTemplateParameterList() const =0
virtual const FileDef * getFileDef() const =0
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
DString mid(size_t index, size_t len=npos) const
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
char & at(size_t i)
Returns a reference to the character at index i.
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
const std::string & str() const
bool stripPrefix(const DString &prefix)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
The common base class of all entity definitions found in the sources.
virtual DString briefDescription(bool abbreviate=false) const =0
virtual int getEndBodyLine() const =0
virtual DString getDefFileExtension() const =0
virtual int docLine() const =0
virtual DString getDefFileName() const =0
virtual DString documentation() const =0
virtual DString inbodyDocumentation() const =0
virtual int getDefLine() const =0
virtual DefType definitionType() const =0
virtual const DString & name() const =0
virtual const FileDef * getBodyDef() const =0
virtual size_t getDefColumn() const =0
virtual bool isAnonymous() const =0
virtual DString displayName(bool includeScope=true) const =0
virtual bool isHidden() const =0
virtual DString anchor() const =0
virtual Definition * getOuterScope() const =0
virtual DString docFile() const =0
virtual const MemberVector & getReferencedByMembers() const =0
virtual int getStartBodyLine() const =0
virtual bool isReference() const =0
virtual const MemberVector & getReferencesMembers() const =0
virtual DString getOutputFileBase() const =0
A model of a directory symbol.
virtual const DirList & subDirs() const =0
virtual const FileList & getFiles() const =0
Class representing a directory in the file system.
bool remove(const std::string &path, bool acceptsAbsPath=true) const
Class representing the abstract syntax tree of a documentation block.
static NamespaceLinkedMap * namespaceLinkedMap
static ConceptLinkedMap * conceptLinkedMap
static std::unique_ptr< PageDef > mainPage
static FileNameLinkedMap * inputNameLinkedMap
static ClassLinkedMap * classLinkedMap
static PageLinkedMap * exampleLinkedMap
static PageLinkedMap * pageLinkedMap
static DirLinkedMap * dirLinkedMap
static GroupLinkedMap * groupLinkedMap
A model of a file symbol.
virtual const NamespaceLinkedRefMap & getNamespaces() const =0
virtual const MemberGroupList & getMemberGroups() const =0
virtual DString absFilePath() const =0
virtual const DString & docName() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual const IncludeInfoList & includeFileList() const =0
virtual const MemberLists & getMemberLists() const =0
virtual DString title() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const IncludeInfoList & includedByFileList() const =0
Minimal replacement for QFileInfo.
std::string absFilePath() const
A model of a group of symbols.
virtual DString groupTitle() const =0
virtual const GroupList & getSubGroups() const =0
virtual const FileList & getFiles() const =0
virtual const MemberLists & getMemberLists() const =0
virtual const MemberGroupList & getMemberGroups() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const PageLinkedRefMap & getPages() const =0
virtual const NamespaceLinkedRefMap & getNamespaces() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual const ModuleLinkedRefMap & getModules() const =0
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
DString convertCharEntitiesToUTF8(const DString &s) const
Class representing the data associated with a #include statement.
const T * find(const std::string &key) const
A model of a class/file/namespace member symbol.
virtual bool isInitonly() const =0
virtual bool isAssign() const =0
virtual bool isExplicit() const =0
virtual bool isNew() const =0
virtual bool isMaybeVoid() const =0
virtual DString argsString() const =0
virtual bool isSealed() const =0
virtual DString definition() const =0
virtual const ClassDef * getClassDef() const =0
virtual const ArgumentList & templateArguments() const =0
virtual const DString & initializer() const =0
virtual bool isSettable() const =0
virtual bool isRetain() const =0
virtual bool isAddable() const =0
virtual const FileDef * getFileDef() const =0
virtual bool isInline() const =0
virtual DString getReadAccessor() const =0
virtual const ArgumentList & argumentList() const =0
virtual bool isWritable() const =0
virtual bool isMaybeAmbiguous() const =0
virtual bool isPrivateGettable() const =0
virtual bool isRequired() const =0
virtual bool isAttribute() const =0
virtual bool isExternal() const =0
virtual bool isCopy() const =0
virtual DString bitfieldString() const =0
virtual bool isStatic() const =0
virtual const MemberDef * reimplements() const =0
virtual bool isMaybeDefault() const =0
virtual bool isPrivateSettable() const =0
virtual bool isRaisable() const =0
virtual bool isRemovable() const =0
virtual bool isConstrained() const =0
virtual DString getWriteAccessor() const =0
virtual bool isReadonly() const =0
virtual bool isBound() const =0
virtual bool isThreadLocal() const =0
virtual DString getScopeString() const =0
virtual 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)
Helper class to pass options when calling OutputList::generateDoc().
LinkifyTextOptions & setScope(const Definition *scope)
LinkifyTextOptions & setSelf(const Definition *self)
LinkifyTextOptions & setFileScope(const FileDef *fileScope)
DString filterTitle(const DString &title)
DString stripFromPath(const DString &path)
A bunch of utility functions.