Remove qucs::SkipEmptyParts

This commit is contained in:
Vadim Kuznetsov 2025-01-03 21:06:41 +03:00
parent c56bb4f966
commit 07970d566a
9 changed files with 35 additions and 45 deletions

View File

@ -437,7 +437,7 @@ void AbstractSpiceKernel::parseHBOutput(QString ngspice_file, QList<QList<double
continue;
}
if (lin.startsWith("Index")) { // CSV heading
QStringList vars1 = lin.split(" ",qucs::SkipEmptyParts);
QStringList vars1 = lin.split(" ",Qt::SkipEmptyParts);
vars1.removeFirst();
vars1.removeFirst();
QStringList norm_vars;
@ -450,7 +450,7 @@ void AbstractSpiceKernel::parseHBOutput(QString ngspice_file, QList<QList<double
var_list.append(norm_vars);
}
if ((lin.contains(QRegularExpression("\\d*\\.\\d+[+-]*[eE]*[\\d]*")))) { // CSV dataline
QStringList vals = lin.split(" ",qucs::SkipEmptyParts);
QStringList vals = lin.split(" ",Qt::SkipEmptyParts);
QList <double> sim_point;
sim_point.clear();
for (int i=1;i<vals.count();i++) {
@ -495,7 +495,7 @@ void AbstractSpiceKernel::parseFourierOutput(QString ngspice_file, QList<QList<d
QString lin = ngsp_data.readLine();
if (lin.isEmpty()) continue;
if (lin.contains("Fourier analysis for")) {
QStringList tokens = lin.split(sep,qucs::SkipEmptyParts);
QStringList tokens = lin.split(sep,Qt::SkipEmptyParts);
QString var; // TODO chech
for (const QString& var1 : tokens) {
if (var1.contains('(')&&var1.contains(')')) {
@ -717,8 +717,8 @@ void AbstractSpiceKernel::parseDC_OPoutputXY(QString xyce_file)
QTextStream ngsp_data(&ofile);
QStringList lines = ngsp_data.readAll().split("\n");
if (lines.count()>=2) {
QStringList nods = lines.at(0).split(QRegularExpression("\\s"),qucs::SkipEmptyParts);
QStringList vals = lines.at(1).split(QRegularExpression("\\s"),qucs::SkipEmptyParts);
QStringList nods = lines.at(0).split(QRegularExpression("\\s"), Qt::SkipEmptyParts);
QStringList vals = lines.at(1).split(QRegularExpression("\\s"), Qt::SkipEmptyParts);
QStringList::iterator n,v;
for(n = nods.begin(),v = vals.begin();n!=nods.end()||v!=vals.end();n++,v++) {
if ((*n).startsWith("I(")) {
@ -918,7 +918,7 @@ bool AbstractSpiceKernel::extractASCIISamples(QString &lin, QTextStream &ngsp_da
sim_point.append(indep_val);
for (int i=0;i<NumVars;i++) {
if (isComplex) {
QStringList lst = ngsp_data.readLine().split(sep,qucs::SkipEmptyParts);
QStringList lst = ngsp_data.readLine().split(sep, Qt::SkipEmptyParts);
if (lst.count()==2) {
double re_dep_val = lst.at(0).toDouble(); // for complex sim results
double im_dep_val = lst.at(1).toDouble(); // imaginary part follows
@ -969,7 +969,7 @@ void AbstractSpiceKernel::parseXYCESTDOutput(QString std_file, QList<QList<doubl
}
if (lin.startsWith("End of ")) continue;
if (lin.startsWith("Index ",Qt::CaseInsensitive)) {
var_list = lin.split(" ",qucs::SkipEmptyParts);
var_list = lin.split(" ", Qt::SkipEmptyParts);
var_list.removeFirst(); // Drop Index
for(int i = 0; i < var_list.count()-1; i++) {
QString var_re = var_list.at(i);
@ -986,7 +986,7 @@ void AbstractSpiceKernel::parseXYCESTDOutput(QString std_file, QList<QList<doubl
}
continue;
} else {
QStringList val_lst = lin.split(" ",qucs::SkipEmptyParts);
QStringList val_lst = lin.split(" ", Qt::SkipEmptyParts);
QList<double> sim_point;
for (int i = 1; i <= var_list.count(); i++ ) {
if (isComplex && i != 1) {
@ -1074,10 +1074,10 @@ void AbstractSpiceKernel::parseResFile(QString resfile, QString &var, QStringLis
while (!swp_data.atEnd()) {
QString lin = swp_data.readLine();
if (var_pattern.match(lin).hasMatch()) {
var = lin.split(sep,qucs::SkipEmptyParts).last();
var = lin.split(sep, Qt::SkipEmptyParts).last();
}
if (point_pattern.match(lin).hasMatch()) {
values.append(lin.split(sep,qucs::SkipEmptyParts).last());
values.append(lin.split(sep, Qt::SkipEmptyParts).last());
}
}
ofile.close();

View File

@ -222,7 +222,7 @@ void Ngspice::createNetlist(QTextStream &stream, int ,
spiceNetlist.append(pc->getSpiceNetlist());
nods = pc->Props.at(1)->Value;
nods.replace(';', ' ');
outputs.append(pc->Props.at(2)->Value.split(';', qucs::SkipEmptyParts));
outputs.append(pc->Props.at(2)->Value.split(';', Qt::SkipEmptyParts));
QRegularExpression ac_rx("^\\s*ac\\s.*", QRegularExpression::CaseInsensitiveOption);
QRegularExpression sp_rx("^\\s*sp\\s.*", QRegularExpression::CaseInsensitiveOption);

View File

@ -125,7 +125,7 @@ QString qucs2spice::convert_netlist(QString netlist, bool xyce)
QString qucs2spice::convert_rcl(const QString& line)
{
QString s="";
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QString s1 = lst.takeFirst();
s += s1.remove(':');
s += " " + lst.takeFirst();
@ -141,7 +141,7 @@ QString qucs2spice::convert_header(QString line)
{
QString s = line;
s.replace(".Def:",".SUBCKT ");
QStringList lst = s.split(' ',qucs::SkipEmptyParts);
QStringList lst = s.split(' ', Qt::SkipEmptyParts);
lst.insert(2," gnd "); // ground
s = lst.join(" ");
s += "\n";
@ -151,7 +151,7 @@ QString qucs2spice::convert_header(QString line)
QString qucs2spice::convert_diode(QString line,bool xyce)
{
QString s="";
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QString name = lst.takeFirst();
auto idx = name.indexOf(':');
name = name.right(name.size()-idx-1); // name
@ -168,7 +168,7 @@ QString qucs2spice::convert_diode(QString line,bool xyce)
QString qucs2spice::convert_mosfet(QString line, bool xyce)
{
QString s="";
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QString name = lst.takeFirst();
auto idx = name.indexOf(':');
name = name.right(name.size()-idx-1); // name
@ -210,7 +210,7 @@ QString qucs2spice::convert_mosfet(QString line, bool xyce)
QString qucs2spice::convert_jfet(const QString& line, bool xyce)
{
QString s="";
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QString name = lst.takeFirst();
auto idx = name.indexOf(':');
name = name.right(name.size()-idx-1); // name
@ -241,7 +241,7 @@ QString qucs2spice::convert_jfet(const QString& line, bool xyce)
QString qucs2spice::convert_bjt(const QString& line)
{
QString s="";
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QString name = lst.takeFirst();
auto idx = name.indexOf(':');
name = name.right(name.size()-idx-1); // name
@ -291,7 +291,7 @@ QString qucs2spice::convert_ccvs(const QString& line)
QString qucs2spice::convert_ccs(const QString& line, bool voltage)
{
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QString name = lst.takeFirst();
auto idx = name.indexOf(':');
name = name.right(name.size()-idx-1); // name
@ -323,7 +323,7 @@ QString qucs2spice::convert_vcvs(const QString& line)
QString qucs2spice::convert_vcs(const QString& line,bool voltage)
{
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QString name = lst.takeFirst();
auto idx = name.indexOf(':');
name = name.right(name.size()-idx-1); // name
@ -346,7 +346,7 @@ QString qucs2spice::convert_vcs(const QString& line,bool voltage)
QString qucs2spice::convert_dc_src(const QString& line)
{
QString s="";
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QString s1 = lst.takeFirst();
s += s1.remove(':');
s += " " + lst.takeFirst();
@ -361,7 +361,7 @@ QString qucs2spice::convert_dc_src(const QString& line)
QString qucs2spice::convert_edd(const QString& line, QStringList &EqnsAndVars)
{
QString s="";
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QStringList nods;
QString nam = lst.takeFirst().remove(':');
@ -406,7 +406,7 @@ QString qucs2spice::convert_edd(const QString& line, QStringList &EqnsAndVars)
QString qucs2spice::convert_subckt(QString line)
{
QString s="";
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QString s1 = lst.takeFirst();
s += "X" + s1.remove("Sub:") + " gnd ";
@ -440,7 +440,7 @@ QString qucs2spice::convert_subckt(QString line)
QString qucs2spice::convert_gyrator(QString line)
{
QString s="";
QStringList lst = line.split(" ",qucs::SkipEmptyParts);
QStringList lst = line.split(" ", Qt::SkipEmptyParts);
QString Name = lst.takeFirst();
Name = Name.section(':',1,1);
QString n1 = lst.takeFirst();

View File

@ -109,7 +109,7 @@ bool S2Spice::convertTouchstone(QTextStream *stream)
}
/* input impedances */
QStringList tmp_lst = next_line.split(" ",qucs::SkipEmptyParts);
QStringList tmp_lst = next_line.split(" ", Qt::SkipEmptyParts);
z[0] = tmp_lst.at(tmp_lst.count()-1).toDouble();
for (int i = 0; i < ports; i++ ) {
if ( a_z0 < 0 ) { /* takes the Z value from the input file */
@ -140,10 +140,10 @@ bool S2Spice::convertTouchstone(QTextStream *stream)
break;
}
if(next_line.at(0)=='!') continue;
tmp_lst = next_line.split(QRegularExpression("[ \\t]"), qucs::SkipEmptyParts);
tmp_lst = next_line.split(QRegularExpression("[ \\t]"), Qt::SkipEmptyParts);
if (tmp_lst.count() < 2*(ports*ports)+1) {
while (in_stream.readLineInto(&next_line)) { // line continuation
auto new_items = next_line.split(QRegularExpression("[ \\t]"), qucs::SkipEmptyParts);
auto new_items = next_line.split(QRegularExpression("[ \\t]"), Qt::SkipEmptyParts);
tmp_lst.append(new_items);
if (tmp_lst.count() >= 2*(ports*ports)+1 ) break;
}

View File

@ -305,7 +305,7 @@ int spicecompat::getPins(const QString &file, const QString &compname, QStringLi
}
if (subckt_header.match(lin).hasMatch()) {
QStringList lst2 = lin.split(sep,qucs::SkipEmptyParts);
QStringList lst2 = lin.split(sep, Qt::SkipEmptyParts);
QString name = lin.section(sep,1,1,QString::SectionSkipEmpty).toLower();
QString refname = compname.toLower();
if (name != refname) continue;

View File

@ -143,7 +143,7 @@ bool loadSettings()
QucsSettings.GraphAntiAliasing = _settings::Get().item<bool>("GraphAntiAliasing");
QucsSettings.TextAntiAliasing = _settings::Get().item<bool>("TextAntiAliasing");
QucsSettings.fullTraceName = _settings::Get().item<bool>("fullTraceName");
QucsSettings.RecentDocs = _settings::Get().item<QString>("RecentDocs").split("*",qucs::SkipEmptyParts);
QucsSettings.RecentDocs = _settings::Get().item<QString>("RecentDocs").split("*", Qt::SkipEmptyParts);
QucsSettings.numRecentDocs = QucsSettings.RecentDocs.count();
QucsSettings.spiceExtensions << "*.sp" << "*.cir" << "*.spc" << "*.spi";

View File

@ -26,16 +26,6 @@
#define Q_UINT32 uint32_t
namespace qucs {
#if QT_VERSION >= 0x050e00
const auto SkipEmptyParts = Qt::SkipEmptyParts;
#else
const auto SkipEmptyParts = QString::SkipEmptyParts;
#endif
}
class Schematic;
namespace misc {

View File

@ -1810,7 +1810,7 @@ int Schematic::adjustPortNumbers()
VInfo = VHDL_File_Info(Name, true);
if (!VInfo.PortNames.isEmpty())
Names = VInfo.PortNames.split(",", qucs::SkipEmptyParts);
Names = VInfo.PortNames.split(",", Qt::SkipEmptyParts);
for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next())
if (pp->Name == ".ID ") {
@ -1818,11 +1818,11 @@ int Schematic::adjustPortNumbers()
id->Prefix = VInfo.EntityName.toUpper();
id->Parameter.clear();
if (!VInfo.GenNames.isEmpty())
GNames = VInfo.GenNames.split(",", qucs::SkipEmptyParts);
GNames = VInfo.GenNames.split(",", Qt::SkipEmptyParts);
if (!VInfo.GenTypes.isEmpty())
GTypes = VInfo.GenTypes.split(",", qucs::SkipEmptyParts);
GTypes = VInfo.GenTypes.split(",", Qt::SkipEmptyParts);
if (!VInfo.GenDefs.isEmpty())
GDefs = VInfo.GenDefs.split(",", qucs::SkipEmptyParts);
GDefs = VInfo.GenDefs.split(",", Qt::SkipEmptyParts);
;
for (Number = 1, it = GNames.begin(); it != GNames.end(); ++it) {
id->Parameter.append(
@ -1871,7 +1871,7 @@ int Schematic::adjustPortNumbers()
else
VInfo = Verilog_File_Info(Name, true);
if (!VInfo.PortNames.isEmpty())
Names = VInfo.PortNames.split(",", qucs::SkipEmptyParts);
Names = VInfo.PortNames.split(",", Qt::SkipEmptyParts);
for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next())
if (pp->Name == ".ID ") {
@ -1918,7 +1918,7 @@ int Schematic::adjustPortNumbers()
VInfo = VerilogA_File_Info(Name, true);
if (!VInfo.PortNames.isEmpty())
Names = VInfo.PortNames.split(",", qucs::SkipEmptyParts);
Names = VInfo.PortNames.split(",", Qt::SkipEmptyParts);
for (pp = a_SymbolPaints.first(); pp != 0; pp = a_SymbolPaints.next())
if (pp->Name == ".ID ") {

View File

@ -299,7 +299,7 @@ int Schematic::savePropsJSON()
continue;
}
if (line.contains("parameter")) {
auto tokens = line.split(QRegularExpression("[\\s=;]"),qucs::SkipEmptyParts);
auto tokens = line.split(QRegularExpression("[\\s=;]"), Qt::SkipEmptyParts);
if (tokens.count() >= 4) {
for(int ic = 0; ic <= tokens.count(); ic++) {
if (tokens.at(ic) == "parameter") {