📄 iteminfo.cpp
字号:
#include "ItemInfo.h"
ItemInfo::ItemInfo(string name) {
this->mName = name;
this->mCount = 1;
this->startNode = 0;
this->lastNode = 0;
}
ItemInfo::ItemInfo(string name, int count) {
this->mName = name;
this->mCount = count;
this->startNode = 0;
this->lastNode = 0;
}
string ItemInfo::getName() const {
return mName;
}
int ItemInfo::getCount() const {
return mCount;
}
void ItemInfo::incrementCount() {
mCount++;
}
void ItemInfo::incrementCount(int i) {
mCount += i;
}
void ItemInfo::resetCount() {
mCount = 0;
}
Node* ItemInfo::getStartNode() {
return startNode;
}
Node* ItemInfo::getLastNode() {
return lastNode;
}
void ItemInfo::setStartNode(Node* node) {
startNode = node;
}
void ItemInfo::setLastNode(Node* node) {
lastNode = node;
}
bool ItemInfo::operator<(const ItemInfo& anotherItemInfo) const {
if (this->getCount() == anotherItemInfo.getCount()) {
return (this->getName() < anotherItemInfo.getName());
} else {
return (this->getCount() < anotherItemInfo.getCount());
}
};
bool ItemInfo::operator>(const ItemInfo& anotherItemInfo) const {
if (this->getCount() == anotherItemInfo.getCount()) {
return (this->getName() > anotherItemInfo.getName());
} else {
return (this->getCount() > anotherItemInfo.getCount());
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -