MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / extractTopStyleSheetComments

Function extractTopStyleSheetComments

src/moapplication.cpp:564–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562namespace
563{
564QStringList extractTopStyleSheetComments(QFile& stylesheet)
565{
566 if (!stylesheet.open(QFile::ReadOnly)) {
567 log::error("failed to open stylesheet file {}", stylesheet.fileName());
568 return {};
569 }
570 ON_BLOCK_EXIT([&stylesheet]() {
571 stylesheet.close();
572 });
573
574 QStringList topComments;
575
576 while (true) {
577 const auto byteLine = stylesheet.readLine();
578 if (byteLine.isNull()) {
579 break;
580 }
581
582 const auto line = QString(byteLine).trimmed();
583
584 // skip empty lines
585 if (line.isEmpty()) {
586 continue;
587 }
588
589 // only handle single line comments
590 if (!line.startsWith("/*")) {
591 break;
592 }
593
594 topComments.push_back(line.mid(2, line.size() - 4).trimmed());
595 }
596
597 return topComments;
598}
599
600QString extractBaseStyleFromStyleSheet(QFile& stylesheet, const QString& defaultStyle)
601{

Callers 1

Calls 5

QStringClass · 0.85
openMethod · 0.80
closeMethod · 0.45
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected