|
41 | 41 | #include "containers.h"
|
42 | 42 | #include "debug.h"
|
43 | 43 |
|
44 |
| -// set to 1 for debugging |
45 |
| -#define DUMP_OUTPUT 0 |
46 |
| - |
47 | 44 | // ----------------- private part -----------------------------------------------
|
48 | 45 |
|
49 | 46 | namespace {
|
@@ -296,6 +293,10 @@ class TagCompoundVariant
|
296 | 293 | }
|
297 | 294 | return 0;
|
298 | 295 | }
|
| 296 | + Type type() |
| 297 | + { |
| 298 | + return(static_cast<Type>(m_variant.index())); |
| 299 | + } |
299 | 300 |
|
300 | 301 | private:
|
301 | 302 | VariantT m_variant;
|
@@ -1110,179 +1111,179 @@ void TagFileParser::startCompound( const XMLHandlers::Attributes& attrib )
|
1110 | 1111 | }
|
1111 | 1112 | }
|
1112 | 1113 |
|
1113 |
| -#if DUMP_OUTPUT |
1114 | 1114 | /*! Dumps the internal structures. For debugging only! */
|
1115 | 1115 | void TagFileParser::dump()
|
1116 | 1116 | {
|
1117 |
| - msg("Result:\n"); |
| 1117 | + if (!Debug::isFlagSet(Debug::Tag)) return; |
| 1118 | + |
| 1119 | + Debug::print("Result:\n"); |
1118 | 1120 | //============== CLASSES
|
1119 |
| - for (const auto &comp : m_tagFileCompounds) |
| 1121 | + for (auto &comp : m_tagFileCompounds) |
1120 | 1122 | {
|
1121 |
| - if (comp->compoundType()==TagCompoundInfo::CompoundType::Class) |
| 1123 | + if (comp.type()==TagCompoundVariant::Type::Class) |
1122 | 1124 | {
|
1123 |
| - const TagClassInfo *cd = TagClassInfo::get(comp); |
1124 |
| - msg("class '%s'\n",qPrint(cd->name)); |
1125 |
| - msg(" filename '%s'\n",qPrint(cd->filename)); |
| 1125 | + const TagClassInfo *cd = comp.getClassInfo(); |
| 1126 | + Debug::print("class '%s'\n",qPrint(cd->name)); |
| 1127 | + Debug::print(" filename '%s'\n",qPrint(cd->filename)); |
1126 | 1128 | for (const BaseInfo &bi : cd->bases)
|
1127 | 1129 | {
|
1128 |
| - msg( " base: %s \n", bi.name.isEmpty() ? "" : qPrint(bi.name) ); |
| 1130 | + Debug::print( " base: %s \n", bi.name.isEmpty() ? "" : qPrint(bi.name) ); |
1129 | 1131 | }
|
1130 | 1132 |
|
1131 | 1133 | for (const auto &md : cd->members)
|
1132 | 1134 | {
|
1133 |
| - msg(" member:\n"); |
1134 |
| - msg(" kind: '%s'\n",qPrint(md.kind)); |
1135 |
| - msg(" name: '%s'\n",qPrint(md.name)); |
1136 |
| - msg(" anchor: '%s'\n",qPrint(md.anchor)); |
1137 |
| - msg(" arglist: '%s'\n",qPrint(md.arglist)); |
| 1135 | + Debug::print(" member:\n"); |
| 1136 | + Debug::print(" kind: '%s'\n",qPrint(md.kind)); |
| 1137 | + Debug::print(" name: '%s'\n",qPrint(md.name)); |
| 1138 | + Debug::print(" anchor: '%s'\n",qPrint(md.anchor)); |
| 1139 | + Debug::print(" arglist: '%s'\n",qPrint(md.arglist)); |
1138 | 1140 | }
|
1139 | 1141 | }
|
1140 | 1142 | }
|
1141 | 1143 | //============== CONCEPTS
|
1142 |
| - for (const auto &comp : m_tagFileCompounds) |
| 1144 | + for (auto &comp : m_tagFileCompounds) |
1143 | 1145 | {
|
1144 |
| - if (comp->compoundType()==TagCompoundInfo::CompoundType::Concept) |
| 1146 | + if (comp.type()==TagCompoundVariant::Type::Concept) |
1145 | 1147 | {
|
1146 |
| - const TagConceptInfo *cd = TagConceptInfo::get(comp); |
| 1148 | + const TagConceptInfo *cd = comp.getConceptInfo(); |
1147 | 1149 |
|
1148 |
| - msg("concept '%s'\n",qPrint(cd->name)); |
1149 |
| - msg(" filename '%s'\n",qPrint(cd->filename)); |
| 1150 | + Debug::print("concept '%s'\n",qPrint(cd->name)); |
| 1151 | + Debug::print(" filename '%s'\n",qPrint(cd->filename)); |
1150 | 1152 | }
|
1151 | 1153 | }
|
1152 | 1154 | //============== NAMESPACES
|
1153 |
| - for (const auto &comp : m_tagFileCompounds) |
| 1155 | + for (auto &comp : m_tagFileCompounds) |
1154 | 1156 | {
|
1155 |
| - if (comp->compoundType()==TagCompoundInfo::CompoundType::Namespace) |
| 1157 | + if (comp.type()==TagCompoundVariant::Type::Namespace) |
1156 | 1158 | {
|
1157 |
| - const TagNamespaceInfo *nd = TagNamespaceInfo::get(comp); |
| 1159 | + const TagNamespaceInfo *nd = comp.getNamespaceInfo(); |
1158 | 1160 |
|
1159 |
| - msg("namespace '%s'\n",qPrint(nd->name)); |
1160 |
| - msg(" filename '%s'\n",qPrint(nd->filename)); |
| 1161 | + Debug::print("namespace '%s'\n",qPrint(nd->name)); |
| 1162 | + Debug::print(" filename '%s'\n",qPrint(nd->filename)); |
1161 | 1163 | for (const auto &cls : nd->classList)
|
1162 | 1164 | {
|
1163 |
| - msg( " class: %s \n", cls.c_str() ); |
| 1165 | + Debug::print( " class: %s \n", cls.c_str() ); |
1164 | 1166 | }
|
1165 | 1167 |
|
1166 | 1168 | for (const auto &md : nd->members)
|
1167 | 1169 | {
|
1168 |
| - msg(" member:\n"); |
1169 |
| - msg(" kind: '%s'\n",qPrint(md.kind)); |
1170 |
| - msg(" name: '%s'\n",qPrint(md.name)); |
1171 |
| - msg(" anchor: '%s'\n",qPrint(md.anchor)); |
1172 |
| - msg(" arglist: '%s'\n",qPrint(md.arglist)); |
| 1170 | + Debug::print(" member:\n"); |
| 1171 | + Debug::print(" kind: '%s'\n",qPrint(md.kind)); |
| 1172 | + Debug::print(" name: '%s'\n",qPrint(md.name)); |
| 1173 | + Debug::print(" anchor: '%s'\n",qPrint(md.anchor)); |
| 1174 | + Debug::print(" arglist: '%s'\n",qPrint(md.arglist)); |
1173 | 1175 | }
|
1174 | 1176 | }
|
1175 | 1177 | }
|
1176 | 1178 |
|
1177 | 1179 | //============== FILES
|
1178 |
| - for (const auto &comp : m_tagFileCompounds) |
| 1180 | + for (auto &comp : m_tagFileCompounds) |
1179 | 1181 | {
|
1180 |
| - if (comp->compoundType()==TagCompoundInfo::CompoundType::File) |
| 1182 | + if (comp.type()==TagCompoundVariant::Type::File) |
1181 | 1183 | {
|
1182 |
| - const TagFileInfo *fd = TagFileInfo::get(comp); |
| 1184 | + const TagFileInfo *fd = comp.getFileInfo(); |
1183 | 1185 |
|
1184 |
| - msg("file '%s'\n",qPrint(fd->name)); |
1185 |
| - msg(" filename '%s'\n",qPrint(fd->filename)); |
| 1186 | + Debug::print("file '%s'\n",qPrint(fd->name)); |
| 1187 | + Debug::print(" filename '%s'\n",qPrint(fd->filename)); |
1186 | 1188 | for (const auto &ns : fd->namespaceList)
|
1187 | 1189 | {
|
1188 |
| - msg( " namespace: %s \n", ns.c_str() ); |
| 1190 | + Debug::print( " namespace: %s \n", ns.c_str() ); |
1189 | 1191 | }
|
1190 | 1192 | for (const auto &cs : fd->classList)
|
1191 | 1193 | {
|
1192 |
| - msg( " class: %s \n", cs.c_str() ); |
| 1194 | + Debug::print( " class: %s \n", cs.c_str() ); |
1193 | 1195 | }
|
1194 | 1196 |
|
1195 | 1197 | for (const auto &md : fd->members)
|
1196 | 1198 | {
|
1197 |
| - msg(" member:\n"); |
1198 |
| - msg(" kind: '%s'\n",qPrint(md.kind)); |
1199 |
| - msg(" name: '%s'\n",qPrint(md.name)); |
1200 |
| - msg(" anchor: '%s'\n",qPrint(md.anchor)); |
1201 |
| - msg(" arglist: '%s'\n",qPrint(md.arglist)); |
| 1199 | + Debug::print(" member:\n"); |
| 1200 | + Debug::print(" kind: '%s'\n",qPrint(md.kind)); |
| 1201 | + Debug::print(" name: '%s'\n",qPrint(md.name)); |
| 1202 | + Debug::print(" anchor: '%s'\n",qPrint(md.anchor)); |
| 1203 | + Debug::print(" arglist: '%s'\n",qPrint(md.arglist)); |
1202 | 1204 | }
|
1203 | 1205 |
|
1204 | 1206 | for (const auto &ii : fd->includes)
|
1205 | 1207 | {
|
1206 |
| - msg(" includes id: %s name: %s\n",qPrint(ii.id),qPrint(ii.name)); |
| 1208 | + Debug::print(" includes id: %s name: %s\n",qPrint(ii.id),qPrint(ii.name)); |
1207 | 1209 | }
|
1208 | 1210 | }
|
1209 | 1211 | }
|
1210 | 1212 |
|
1211 | 1213 | //============== GROUPS
|
1212 |
| - for (const auto &comp : m_tagFileCompounds) |
| 1214 | + for (auto &comp : m_tagFileCompounds) |
1213 | 1215 | {
|
1214 |
| - if (comp->compoundType()==TagCompoundInfo::CompoundType::Group) |
| 1216 | + if (comp.type()==TagCompoundVariant::Type::Group) |
1215 | 1217 | {
|
1216 |
| - const TagGroupInfo *gd = TagGroupInfo::get(comp); |
1217 |
| - msg("group '%s'\n",qPrint(gd->name)); |
1218 |
| - msg(" filename '%s'\n",qPrint(gd->filename)); |
| 1218 | + const TagGroupInfo *gd = comp.getGroupInfo(); |
| 1219 | + Debug::print("group '%s'\n",qPrint(gd->name)); |
| 1220 | + Debug::print(" filename '%s'\n",qPrint(gd->filename)); |
1219 | 1221 |
|
1220 | 1222 | for (const auto &ns : gd->namespaceList)
|
1221 | 1223 | {
|
1222 |
| - msg( " namespace: %s \n", ns.c_str() ); |
| 1224 | + Debug::print( " namespace: %s \n", ns.c_str() ); |
1223 | 1225 | }
|
1224 | 1226 | for (const auto &cs : gd->classList)
|
1225 | 1227 | {
|
1226 |
| - msg( " class: %s \n", cs.c_str() ); |
| 1228 | + Debug::print( " class: %s \n", cs.c_str() ); |
1227 | 1229 | }
|
1228 | 1230 | for (const auto &fi : gd->fileList)
|
1229 | 1231 | {
|
1230 |
| - msg( " file: %s \n", fi.c_str() ); |
| 1232 | + Debug::print( " file: %s \n", fi.c_str() ); |
1231 | 1233 | }
|
1232 | 1234 | for (const auto &sg : gd->subgroupList)
|
1233 | 1235 | {
|
1234 |
| - msg( " subgroup: %s \n", sg.c_str() ); |
| 1236 | + Debug::print( " subgroup: %s \n", sg.c_str() ); |
1235 | 1237 | }
|
1236 | 1238 | for (const auto &pg : gd->pageList)
|
1237 | 1239 | {
|
1238 |
| - msg( " page: %s \n", pg.c_str() ); |
| 1240 | + Debug::print( " page: %s \n", pg.c_str() ); |
1239 | 1241 | }
|
1240 | 1242 |
|
1241 | 1243 | for (const auto &md : gd->members)
|
1242 | 1244 | {
|
1243 |
| - msg(" member:\n"); |
1244 |
| - msg(" kind: '%s'\n",qPrint(md.kind)); |
1245 |
| - msg(" name: '%s'\n",qPrint(md.name)); |
1246 |
| - msg(" anchor: '%s'\n",qPrint(md.anchor)); |
1247 |
| - msg(" arglist: '%s'\n",qPrint(md.arglist)); |
| 1245 | + Debug::print(" member:\n"); |
| 1246 | + Debug::print(" kind: '%s'\n",qPrint(md.kind)); |
| 1247 | + Debug::print(" name: '%s'\n",qPrint(md.name)); |
| 1248 | + Debug::print(" anchor: '%s'\n",qPrint(md.anchor)); |
| 1249 | + Debug::print(" arglist: '%s'\n",qPrint(md.arglist)); |
1248 | 1250 | }
|
1249 | 1251 | }
|
1250 | 1252 | }
|
1251 | 1253 |
|
1252 | 1254 | //============== PAGES
|
1253 |
| - for (const auto &comp : m_tagFileCompounds) |
| 1255 | + for (auto &comp : m_tagFileCompounds) |
1254 | 1256 | {
|
1255 |
| - if (comp->compoundType()==TagCompoundInfo::CompoundType::Page) |
| 1257 | + if (comp.type()==TagCompoundVariant::Type::Page) |
1256 | 1258 | {
|
1257 |
| - const TagPageInfo *pd = TagPageInfo::get(comp); |
1258 |
| - msg("page '%s'\n",qPrint(pd->name)); |
1259 |
| - msg(" title '%s'\n",qPrint(pd->title)); |
1260 |
| - msg(" filename '%s'\n",qPrint(pd->filename)); |
| 1259 | + const TagPageInfo *pd = comp.getPageInfo(); |
| 1260 | + Debug::print("page '%s'\n",qPrint(pd->name)); |
| 1261 | + Debug::print(" title '%s'\n",qPrint(pd->title)); |
| 1262 | + Debug::print(" filename '%s'\n",qPrint(pd->filename)); |
1261 | 1263 | }
|
1262 | 1264 | }
|
1263 | 1265 |
|
1264 | 1266 | //============== DIRS
|
1265 |
| - for (const auto &comp : m_tagFileCompounds) |
| 1267 | + for (auto &comp : m_tagFileCompounds) |
1266 | 1268 | {
|
1267 |
| - if (comp->compoundType()==TagCompoundInfo::CompoundType::Dir) |
| 1269 | + if (comp.type()==TagCompoundVariant::Type::Dir) |
1268 | 1270 | {
|
1269 |
| - const TagDirInfo *dd = TagDirInfo::get(comp); |
| 1271 | + const TagDirInfo *dd = comp.getDirInfo(); |
1270 | 1272 | {
|
1271 |
| - msg("dir '%s'\n",qPrint(dd->name)); |
1272 |
| - msg(" path '%s'\n",qPrint(dd->path)); |
| 1273 | + Debug::print("dir '%s'\n",qPrint(dd->name)); |
| 1274 | + Debug::print(" path '%s'\n",qPrint(dd->path)); |
1273 | 1275 | for (const auto &fi : dd->fileList)
|
1274 | 1276 | {
|
1275 |
| - msg( " file: %s \n", fi.c_str() ); |
| 1277 | + Debug::print( " file: %s \n", fi.c_str() ); |
1276 | 1278 | }
|
1277 | 1279 | for (const auto &sd : dd->subdirList)
|
1278 | 1280 | {
|
1279 |
| - msg( " subdir: %s \n", sd.c_str() ); |
| 1281 | + Debug::print( " subdir: %s \n", sd.c_str() ); |
1280 | 1282 | }
|
1281 | 1283 | }
|
1282 | 1284 | }
|
1283 | 1285 | }
|
1284 | 1286 | }
|
1285 |
| -#endif |
1286 | 1287 |
|
1287 | 1288 | void TagFileParser::addDocAnchors(const std::shared_ptr<Entry> &e,const std::vector<TagAnchorInfo> &l)
|
1288 | 1289 | {
|
@@ -1703,7 +1704,5 @@ void parseTagFile(const std::shared_ptr<Entry> &root,const char *fullName)
|
1703 | 1704 | parser.parse(fullName,inputStr.data(),Debug::isFlagSet(Debug::Lex));
|
1704 | 1705 | tagFileParser.buildLists(root);
|
1705 | 1706 | tagFileParser.addIncludes();
|
1706 |
| -#if DUMP_OUTPUT |
1707 |
| - tagFileParser.dump(); |
1708 |
| -#endif |
| 1707 | + if (Debug::isFlagSet(Debug::Tag)) tagFileParser.dump(); |
1709 | 1708 | }
|
0 commit comments