Skip to content

Commit

Permalink
rename getFirst and getLast to front,back.
Browse files Browse the repository at this point in the history
QList, std::vector etc. has front and back so this changes will reduce refactoring effort.
  • Loading branch information
dsm committed Jul 23, 2024
1 parent dedcd59 commit e6cecd8
Show file tree
Hide file tree
Showing 71 changed files with 121 additions and 120 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ __pycache__
.vscode/launch.json
.vscode/settings.json
.vscode/tasks.json
/cmake-build-debug/
2 changes: 1 addition & 1 deletion qucs/components/DLS_1ton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DLS_1ton::DLS_1ton()
Component * DLS_1ton::newOne()
{
DLS_1ton * p = new DLS_1ton();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/DLS_nto1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DLS_nto1::DLS_nto1()
Component * DLS_nto1::newOne()
{
DLS_nto1 * p = new DLS_nto1();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/MESFET.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ MESFET::MESFET()
Component * MESFET::newOne()
{
MESFET * p = new MESFET();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/andor4x2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ andor4x2::andor4x2()
Component * andor4x2::newOne()
{
andor4x2 * p = new andor4x2();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/andor4x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ andor4x3::andor4x3()
Component * andor4x3::newOne()
{
andor4x3 * p = new andor4x3();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/andor4x4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ andor4x4::andor4x4()
Component * andor4x4::newOne()
{
andor4x4 * p = new andor4x4();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/binarytogrey4bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ binarytogrey4bit::binarytogrey4bit()
Component * binarytogrey4bit::newOne()
{
binarytogrey4bit * p = new binarytogrey4bit();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
6 changes: 3 additions & 3 deletions qucs/components/bjt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ BJT::BJT()
Component* BJT::newOne()
{
BJT* p = new BJT();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down Expand Up @@ -85,7 +85,7 @@ Element* BJT::info_pnp(QString& Name, char* &BitmapFile, bool getNewOne)

if(getNewOne) {
BJT* p = new BJT();
p->Props.getFirst()->Value = "pnp";
p->Props.front()->Value = "pnp";
p->recreate(0);
return p;
}
Expand All @@ -102,7 +102,7 @@ void BJT::createSymbol()
Lines.append(new qucs::Line(-10, 5, 0, 15,QPen(Qt::darkBlue,2)));
Lines.append(new qucs::Line( 0, 15, 0, 30,QPen(Qt::darkBlue,2)));

if(Props.getFirst()->Value == "npn") {
if(Props.front()->Value == "npn") {
Lines.append(new qucs::Line( -6, 15, 0, 15,QPen(Qt::darkBlue,2)));
Lines.append(new qucs::Line( 0, 9, 0, 15,QPen(Qt::darkBlue,2)));
}
Expand Down
6 changes: 3 additions & 3 deletions qucs/components/bjtsub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ BJTsub::BJTsub()
Component* BJTsub::newOne()
{
BJTsub* p = new BJTsub();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand All @@ -161,7 +161,7 @@ Element* BJTsub::info_pnp(QString& Name, char* &BitmapFile, bool getNewOne)

if(getNewOne) {
BJTsub* p = new BJTsub();
p->Props.getFirst()->Value = "pnp";
p->Props.front()->Value = "pnp";
p->recreate(0);
return p;
}
Expand All @@ -181,7 +181,7 @@ void BJTsub::createSymbol()
Lines.append(new qucs::Line( 9, 0, 30, 0,QPen(Qt::darkBlue,2)));
Lines.append(new qucs::Line( 9, -7, 9, 7,QPen(Qt::darkBlue,3)));

if(Props.getFirst()->Value == "npn") {
if(Props.front()->Value == "npn") {
Lines.append(new qucs::Line( -6, 15, 0, 15,QPen(Qt::darkBlue,2)));
Lines.append(new qucs::Line( 0, 9, 0, 15,QPen(Qt::darkBlue,2)));
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/capacitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ QString Capacitor::va_code()

void Capacitor::createSymbol()
{
if(Props.getLast()->Value.at(0) == 'n') {
if(Props.back()->Value.at(0) == 'n') {
Lines.append(new qucs::Line( -4,-11, -4, 11,QPen(Qt::darkBlue,4)));
Lines.append(new qucs::Line( 4,-11, 4, 11,QPen(Qt::darkBlue,4)));
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/comp_1bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ comp_1bit::comp_1bit()
Component * comp_1bit::newOne()
{
comp_1bit * p = new comp_1bit();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/comp_2bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ comp_2bit::comp_2bit()
Component * comp_2bit::newOne()
{
comp_2bit * p = new comp_2bit();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/comp_4bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ comp_4bit::comp_4bit()
Component * comp_4bit::newOne()
{
comp_4bit * p = new comp_4bit();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
10 changes: 5 additions & 5 deletions qucs/components/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ bool Component::load(const QString &_s) {
if (z == 6)
if (counts == 6) // backward compatible
if (Model == "R") {
Props.getLast()->Value = n;
Props.back()->Value = n;
return true;
}
p1->Value = n;
Expand Down Expand Up @@ -1653,10 +1653,10 @@ QString GateComponent::verilogCode(int NumPorts) {

// -------------------------------------------------------
void GateComponent::createSymbol() {
int Num = Props.getFirst()->Value.toInt();
int Num = Props.front()->Value.toInt();
if (Num < 2) Num = 2;
else if (Num > 8) Num = 8;
Props.getFirst()->Value = QString::number(Num);
Props.front()->Value = QString::number(Num);

int xl, xr, y = 10 * Num, z;
x1 = -30;
Expand All @@ -1670,7 +1670,7 @@ void GateComponent::createSymbol() {
z = 0;
if (Model.at(0) == 'N') z = 1;

if (Props.getLast()->Value.at(0) == 'D') { // DIN symbol
if (Props.back()->Value.at(0) == 'D') { // DIN symbol
xl = -15;
xr = 15;
Lines.append(new qucs::Line(15, -y, 15, y, QPen(Qt::darkBlue, 2)));
Expand Down Expand Up @@ -1764,7 +1764,7 @@ Component *getComponentFromName(QString &Line, Schematic *p) {
else if (cstr.left(6) == "SPfile" && cstr != "SPfile") {
// backward compatible
c = new SParamFile();
c->Props.getLast()->Value = cstr.mid(6);
c->Props.back()->Value = cstr.mid(6);
} else
c = Module::getComponent(cstr);

Expand Down
2 changes: 1 addition & 1 deletion qucs/components/dff_SR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dff_SR::dff_SR()
Component * dff_SR::newOne()
{
dff_SR * p = new dff_SR();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/digi_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ QString Digi_Source::verilogCode(int NumPorts)
}
}
else { // truth table simulation
int Num = Props.getFirst()->Value.toInt() - 1;
int Num = Props.front()->Value.toInt() - 1;
s += " always begin\n";
s += " " + r + " = 0;\n";
s += " #"+ QString::number(1 << Num) + ";\n";
Expand Down
8 changes: 4 additions & 4 deletions qucs/components/diode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ Element* Diode::info(QString& Name, char* &BitmapFile, bool getNewOne)
// -------------------------------------------------------
void Diode::createSymbol()
{
if(Props.getLast()->Value.at(0) == 'V') {
if(Props.back()->Value.at(0) == 'V') {
Lines.append(new qucs::Line(-30, 0, -9, 0,QPen(Qt::darkBlue,2)));
Lines.append(new qucs::Line( -6, 0, 30, 0,QPen(Qt::darkBlue,2)));
Lines.append(new qucs::Line( -9, -9, -9, 9,QPen(Qt::darkBlue,2)));
}
else if(Props.getLast()->Value.at(0) == 'U') {
else if(Props.back()->Value.at(0) == 'U') {
Lines.append(new qucs::Line(-30, 0, -6, 0,QPen(Qt::darkBlue,2)));
Lines.append(new qucs::Line( 6, 0, 30, 0,QPen(Qt::darkBlue,2)));
}
Expand All @@ -184,11 +184,11 @@ void Diode::createSymbol()
Lines.append(new qucs::Line( -6, 0, 6, -9,QPen(Qt::darkBlue,2)));
Lines.append(new qucs::Line( -6, 0, 6, 9,QPen(Qt::darkBlue,2)));

if(Props.getLast()->Value.at(0) == 'S') {
if(Props.back()->Value.at(0) == 'S') {
Lines.append(new qucs::Line( -6, -9,-12,-12,QPen(Qt::darkBlue,2)));
Lines.append(new qucs::Line( -6, 9, 0, 12,QPen(Qt::darkBlue,2)));
}
else if(Props.getLast()->Value.at(0) == 'Z') {
else if(Props.back()->Value.at(0) == 'Z') {
Lines.append(new qucs::Line( -6, 9, -1, 9,QPen(Qt::darkBlue,2)));
}

Expand Down
2 changes: 1 addition & 1 deletion qucs/components/dmux2to4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dmux2to4::dmux2to4()
Component * dmux2to4::newOne()
{
dmux2to4 * p = new dmux2to4();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/dmux3to8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dmux3to8::dmux3to8()
Component * dmux3to8::newOne()
{
dmux3to8 * p = new dmux3to8();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/dmux4to16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dmux4to16::dmux4to16()
Component * dmux4to16::newOne()
{
dmux4to16 * p = new dmux4to16();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/fa1b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fa1b::fa1b()
Component * fa1b::newOne()
{
fa1b * p = new fa1b();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/fa2b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fa2b::fa2b()
Component * fa2b::newOne()
{
fa2b * p = new fa2b();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/gatedDlatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ gatedDlatch::gatedDlatch()
Component * gatedDlatch::newOne()
{
gatedDlatch * p = new gatedDlatch();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/greytobinary4bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ greytobinary4bit::greytobinary4bit()
Component * greytobinary4bit::newOne()
{
greytobinary4bit * p = new greytobinary4bit();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/ha1b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ha1b::ha1b()
Component * ha1b::newOne()
{
ha1b * p = new ha1b();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/hpribin4bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ hpribin4bit::hpribin4bit()
Component * hpribin4bit::newOne()
{
hpribin4bit * p = new hpribin4bit();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/ifile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Element* iFile::info(QString& Name, char* &BitmapFile, bool getNewOne)
QString iFile::getSubcircuitFile()
{
// construct full filename
QString FileName = Props.getFirst()->Value;
QString FileName = Props.front()->Value;
return misc::properAbsFileName(FileName);
}

Expand Down
6 changes: 3 additions & 3 deletions qucs/components/jfet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ JFET::JFET() {
Component* JFET::newOne()
{
JFET* p = new JFET();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down Expand Up @@ -147,7 +147,7 @@ Element* JFET::info_p(QString& Name, char* &BitmapFile, bool getNewOne)

if(getNewOne) {
JFET* p = new JFET();
p->Props.getFirst()->Value = "pfet";
p->Props.front()->Value = "pfet";
p->recreate(0);
return p;
}
Expand All @@ -166,7 +166,7 @@ void JFET::createSymbol()

Lines.append(new qucs::Line( -4, 24, 4, 20,QPen(Qt::darkBlue,2)));

if(Props.getFirst()->Value == "nfet") {
if(Props.front()->Value == "nfet") {
Lines.append(new qucs::Line(-16, -5,-11, 0,QPen(Qt::darkBlue,2)));
Lines.append(new qucs::Line(-16, 5,-11, 0,QPen(Qt::darkBlue,2)));
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/jkff_SR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jkff_SR::jkff_SR()
Component * jkff_SR::newOne()
{
jkff_SR * p = new jkff_SR();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/log_amp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ log_amp::log_amp()
Component * log_amp::newOne()
{
log_amp * p = new log_amp();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/logic_0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ logic_0::logic_0()
Component * logic_0::newOne()
{
logic_0 * p = new logic_0();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;
}
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/logic_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ logic_1::logic_1()
Component * logic_1::newOne()
{
logic_1 * p = new logic_1();
p->Props.getFirst()->Value = Props.getFirst()->Value;
p->Props.front()->Value = Props.front()->Value;
p->recreate(0);
return p;

Expand Down
Loading

0 comments on commit e6cecd8

Please sign in to comment.