From 375607d9969896c894fa2642ce4a0b8b519a2adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 2 Sep 2017 15:34:07 +0200 Subject: Use QString and QVector instead of std ones and more --- qtmips_machine/instructions/arithmetic.cpp | 9 ++++----- qtmips_machine/instructions/arithmetic.h | 4 ++-- qtmips_machine/instructions/jumpbranch.cpp | 8 ++++---- qtmips_machine/instructions/jumpbranch.h | 6 +++--- qtmips_machine/instructions/loadstore.cpp | 8 ++++---- qtmips_machine/instructions/loadstore.h | 4 ++-- qtmips_machine/instructions/nop.cpp | 6 +++--- qtmips_machine/instructions/nop.h | 2 +- qtmips_machine/instructions/shift.cpp | 8 ++++---- qtmips_machine/instructions/shift.h | 4 ++-- 10 files changed, 29 insertions(+), 30 deletions(-) (limited to 'qtmips_machine/instructions') diff --git a/qtmips_machine/instructions/arithmetic.cpp b/qtmips_machine/instructions/arithmetic.cpp index 8c8f40e..a620436 100644 --- a/qtmips_machine/instructions/arithmetic.cpp +++ b/qtmips_machine/instructions/arithmetic.cpp @@ -1,13 +1,12 @@ #include "instructions/arithmetic.h" -#include InstructionArithmetic::InstructionArithmetic(enum InstructionArithmeticT type, std::uint8_t rs, std::uint8_t rd, std::uint8_t rt) : InstructionR(rs, rd, rt, 0) { this->type = type; } -std::vector InstructionArithmetic::to_strs() { - std::vector str = this->InstructionR::to_strs(); +QVector InstructionArithmetic::to_strs() { + QVector str = this->InstructionR::to_strs(); str.erase(str.begin() + 4); // Drop sa field switch (this->type) { case IAT_ADD: @@ -52,8 +51,8 @@ InstructionArithmeticImmediate::InstructionArithmeticImmediate(enum InstructionA this->type = type; } -std::vector InstructionArithmeticImmediate::to_strs() { - std::vector str = this->InstructionI::to_strs(); +QVector InstructionArithmeticImmediate::to_strs() { + QVector str = this->InstructionI::to_strs(); switch (this->type) { case IAT_ADDI: str[0] = "addi"; diff --git a/qtmips_machine/instructions/arithmetic.h b/qtmips_machine/instructions/arithmetic.h index 29f89d2..19f1df5 100644 --- a/qtmips_machine/instructions/arithmetic.h +++ b/qtmips_machine/instructions/arithmetic.h @@ -19,7 +19,7 @@ enum InstructionArithmeticT { class InstructionArithmetic : public InstructionR { public: InstructionArithmetic(enum InstructionArithmeticT type, std::uint8_t rs, std::uint8_t rd, std::uint8_t rt); - std::vector to_strs(); + QVector to_strs(); private: enum InstructionArithmeticT type; }; @@ -38,7 +38,7 @@ enum InstructionArithmeticImmediateT { class InstructionArithmeticImmediate : public InstructionI { public: InstructionArithmeticImmediate(enum InstructionArithmeticImmediateT type, std::uint8_t rs, std::uint8_t rt, std::uint16_t value); - std::vector to_strs(); + QVector to_strs(); private: enum InstructionArithmeticImmediateT type; }; diff --git a/qtmips_machine/instructions/jumpbranch.cpp b/qtmips_machine/instructions/jumpbranch.cpp index 2ede399..6579c2b 100644 --- a/qtmips_machine/instructions/jumpbranch.cpp +++ b/qtmips_machine/instructions/jumpbranch.cpp @@ -5,8 +5,8 @@ InstructionJump::InstructionJump(bool link, std::uint32_t address) this->link = link; } -std::vector InstructionJump::to_strs() { - std::vector str = this->InstructionJ::to_strs(); +QVector InstructionJump::to_strs() { + QVector str = this->InstructionJ::to_strs(); if (link) str[0] = "j"; else @@ -19,8 +19,8 @@ InstructionJumpRegister::InstructionJumpRegister(bool link, std::uint8_t rs) this->link = link; } -std::vector InstructionJumpRegister::to_strs() { - std::vector str = this->InstructionR::to_strs(); +QVector InstructionJumpRegister::to_strs() { + QVector str = this->InstructionR::to_strs(); str.erase(str.begin() + 2, str.end()); // Drop every field after rs if (link) str[0] = "j"; diff --git a/qtmips_machine/instructions/jumpbranch.h b/qtmips_machine/instructions/jumpbranch.h index b8dee5c..762ad95 100644 --- a/qtmips_machine/instructions/jumpbranch.h +++ b/qtmips_machine/instructions/jumpbranch.h @@ -6,7 +6,7 @@ class InstructionJump : InstructionJ { public: InstructionJump(bool link, std::uint32_t address); - std::vector to_strs(); + QVector to_strs(); private: bool link; }; @@ -14,7 +14,7 @@ private: class InstructionJumpRegister : InstructionR { public: InstructionJumpRegister(bool link, std::uint8_t rs); - std::vector to_strs(); + QVector to_strs(); private: bool link; }; @@ -26,7 +26,7 @@ enum InstructionBranchT { class InstructionBranch : InstructionI { public: InstructionBranch(); - std::vector to_strs(); + QVector to_strs(); private: // TODO }; diff --git a/qtmips_machine/instructions/loadstore.cpp b/qtmips_machine/instructions/loadstore.cpp index c83eae4..27c6402 100644 --- a/qtmips_machine/instructions/loadstore.cpp +++ b/qtmips_machine/instructions/loadstore.cpp @@ -5,8 +5,8 @@ InstructionLoad::InstructionLoad(enum InstructionLoadStoreT type, std::uint8_t r this->type = type; } -std::vector InstructionLoad::to_strs() { - std::vector str = this->InstructionI::to_strs(); +QVector InstructionLoad::to_strs() { + QVector str = this->InstructionI::to_strs(); switch (this->type) { case ILST_B: str[0] = "lb"; @@ -41,8 +41,8 @@ InstructionStore::InstructionStore(enum InstructionLoadStoreT type, std::uint8_t this->type = type; } -std::vector InstructionStore::to_strs() { - std::vector str = this->InstructionI::to_strs(); +QVector InstructionStore::to_strs() { + QVector str = this->InstructionI::to_strs(); switch (this->type) { case ILST_B: str[0] = "sb"; diff --git a/qtmips_machine/instructions/loadstore.h b/qtmips_machine/instructions/loadstore.h index 9741bd7..6f028fd 100644 --- a/qtmips_machine/instructions/loadstore.h +++ b/qtmips_machine/instructions/loadstore.h @@ -16,7 +16,7 @@ enum InstructionLoadStoreT { class InstructionLoad : public InstructionI { public: InstructionLoad(enum InstructionLoadStoreT type, std::uint8_t rs, std::uint8_t rt, std::uint16_t offset); - std::vector to_strs(); + QVector to_strs(); private: enum InstructionLoadStoreT type; }; @@ -24,7 +24,7 @@ private: class InstructionStore : public InstructionI { public: InstructionStore(enum InstructionLoadStoreT type, std::uint8_t rs, std::uint8_t rt, std::uint16_t offset); - std::vector to_strs(); + QVector to_strs(); private: enum InstructionLoadStoreT type; }; diff --git a/qtmips_machine/instructions/nop.cpp b/qtmips_machine/instructions/nop.cpp index 5fd5e47..7623dff 100644 --- a/qtmips_machine/instructions/nop.cpp +++ b/qtmips_machine/instructions/nop.cpp @@ -1,7 +1,7 @@ #include "nop.h" -std::vector InstructionNop::to_strs() { - std::vector str; - str.push_back("nop"); +QVector InstructionNop::to_strs() { + QVector str; + str << QString("nop"); return str; } diff --git a/qtmips_machine/instructions/nop.h b/qtmips_machine/instructions/nop.h index b098b11..5c019fd 100644 --- a/qtmips_machine/instructions/nop.h +++ b/qtmips_machine/instructions/nop.h @@ -5,7 +5,7 @@ class InstructionNop : public Instruction { public: - std::vector to_strs(); + QVector to_strs(); }; #endif // NOP_H diff --git a/qtmips_machine/instructions/shift.cpp b/qtmips_machine/instructions/shift.cpp index a8c6e41..34bc1c9 100644 --- a/qtmips_machine/instructions/shift.cpp +++ b/qtmips_machine/instructions/shift.cpp @@ -5,8 +5,8 @@ InstructionShift::InstructionShift(enum InstructionShiftT type, std::uint8_t rt, this->type = type; } -std::vector InstructionShift::to_strs() { - std::vector str = this->InstructionR::to_strs(); +QVector InstructionShift::to_strs() { + QVector str = this->InstructionR::to_strs(); str.erase(str.begin() + 1); // Drop rs field switch (this->type) { case IST_LL: @@ -30,8 +30,8 @@ InstructionShiftVariable::InstructionShiftVariable(enum InstructionShiftT type, this->type = type; } -std::vector InstructionShiftVariable::to_strs() { - std::vector str = this->InstructionR::to_strs(); +QVector InstructionShiftVariable::to_strs() { + QVector str = this->InstructionR::to_strs(); str.erase(str.begin() + 4); // Drop sa field switch (this->type) { case IST_LL: diff --git a/qtmips_machine/instructions/shift.h b/qtmips_machine/instructions/shift.h index 9ce29e0..69e2e1e 100644 --- a/qtmips_machine/instructions/shift.h +++ b/qtmips_machine/instructions/shift.h @@ -12,7 +12,7 @@ enum InstructionShiftT { class InstructionShift : public InstructionR { public: InstructionShift(enum InstructionShiftT type, std::uint8_t rt, std::uint8_t rd, std::uint8_t sa); - std::vector to_strs(); + QVector to_strs(); private: enum InstructionShiftT type; }; @@ -20,7 +20,7 @@ private: class InstructionShiftVariable : public InstructionR { public: InstructionShiftVariable(enum InstructionShiftT type, std::uint8_t rs, std::uint8_t rt, std::uint8_t rd); - std::vector to_strs(); + QVector to_strs(); private: enum InstructionShiftT type; }; -- cgit v1.2.3