MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / toCSV

Function toCSV

launcher/modplatform/helpers/ExportToModList.cpp:149–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149QString toCSV(QList<Mod*> mods, OptionalData extraData)
150{
151 QStringList lines;
152 for (auto mod : mods) {
153 QStringList data;
154 auto meta = mod->metadata();
155 auto modName = mod->name();
156
157 data << modName;
158 if (extraData & Url)
159 data << mod->metaurl();
160 if (extraData & Version) {
161 auto ver = mod->version();
162 if (ver.isEmpty() && meta != nullptr)
163 ver = meta->version().toString();
164 data << ver;
165 }
166 if (extraData & Authors) {
167 QString authors;
168 if (mod->authors().length() == 1)
169 authors = mod->authors().back();
170 else if (mod->authors().length() > 1)
171 authors = QString("\"%1\"").arg(mod->authors().join(","));
172 data << authors;
173 }
174 if (extraData & FileName)
175 data << mod->fileinfo().fileName();
176 lines << data.join(",");
177 }
178 return lines.join("\n");
179}
180
181QString exportToModList(QList<Mod*> mods, Formats format, OptionalData extraData)
182{

Callers 1

exportToModListFunction · 0.85

Calls 9

QStringClass · 0.85
metadataMethod · 0.80
metaurlMethod · 0.80
authorsMethod · 0.80
fileinfoMethod · 0.80
nameMethod · 0.45
versionMethod · 0.45
isEmptyMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected