本文整理汇总了C++中Card::getColor方法的典型用法代码示例。如果您正苦于以下问题:C++ Card::getColor方法的具体用法?C++ Card::getColor怎么用?C++ Card::getColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Card
的用法示例。
在下文中一共展示了Card::getColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createDecksReport
void FilesManager::createDecksReport() {
readFromFile("decks.dat");
std::ofstream fileStream;
fileStream.open("report.txt", std::ios::out | std::ios::app);
if(fileStream) {
Colors colors[] = { Red, Black, Blue, White, Green };
int decksSize = getDecksNumber();
for(int i = 0; i < COLORS_COUNT; i++) {
fileStream << getColorName(matchColorByInteger(i)) << std::endl;
for(int j = 0; j < decksSize; j++) {
if(decks[j].getColor() == colors[i]) {
fileStream << "Owner: " << getPlayerNameById(decks[j].getDeckOwnerId()) << " ";
fileStream << "Card: " << decks[j].getCards()[0].getCardName() << " ";
fileStream << "Color: " << decks[j].getCards()[0].getColor() << std::endl;
}
}
}
Card mostCommonCard = getMostCommonCardIdInAllDecks();
fileStream << "Most common card: " << mostCommonCard.getCardName() << " ";
fileStream << "Color:" << mostCommonCard.getColor() << std::endl;
} else {
fileStream.clear();
fileStream.close();
throw serializable_exception;
}
}
示例2:
bool operator==(const Card& lhs, const Card& rhs) {
return lhs.getValue() == rhs.getValue() && lhs.getColor() == rhs.getColor();
}
示例3:
TEST (CardTest, defaultValueOfColorAndFigureShouldBeNone )
{
Card card;
EXPECT_EQ (card.getColor(), Card_Color::None);
EXPECT_EQ (card.getFigure(), Card_Figure::None);
}