mirror of
https://github.com/jorenchik/mdemory.git
synced 2026-03-22 00:26:21 +00:00
functions in camelcase
This commit is contained in:
@@ -21,31 +21,31 @@ struct QuestionElement {
|
||||
std::string content;
|
||||
};
|
||||
|
||||
std::string MultiElementQuestion::ToString() const {
|
||||
std::string MultiElementQuestion::toString() const {
|
||||
std::stringstream ss;
|
||||
for (const auto& choice : Choices) {
|
||||
for (const auto& choice : choices) {
|
||||
char opener;
|
||||
if (type == MultiElementType::Order) {
|
||||
opener = '^';
|
||||
} else if (choice.IsCorrect) {
|
||||
} else if (choice.isCorrect) {
|
||||
opener = '+';
|
||||
} else {
|
||||
opener = '-';
|
||||
}
|
||||
ss << opener << " " << choice.Answer << "; ";
|
||||
ss << opener << " " << choice.answer << "; ";
|
||||
}
|
||||
return std::format(
|
||||
"<Multiple element>\nsection:{}\nid:{}\n{}\n{}",
|
||||
Section,
|
||||
Cooldown,
|
||||
QuestionText,
|
||||
section,
|
||||
cooldown,
|
||||
questionText,
|
||||
ss.str()
|
||||
);
|
||||
}
|
||||
|
||||
std::string GroupQuestion::ToString() const {
|
||||
std::string GroupQuestion::toString() const {
|
||||
std::stringstream ss;
|
||||
for (auto group: Groups) {
|
||||
for (auto group: groups) {
|
||||
ss << group.name << ": ";
|
||||
for (auto el: group.elements) {
|
||||
ss << el << ", ";
|
||||
@@ -54,9 +54,9 @@ std::string GroupQuestion::ToString() const {
|
||||
}
|
||||
return std::format(
|
||||
"<GroupQuestion>\nsection:{}\nid:{}\n{}\n{}",
|
||||
Section,
|
||||
Cooldown,
|
||||
QuestionText,
|
||||
section,
|
||||
cooldown,
|
||||
questionText,
|
||||
ss.str()
|
||||
);
|
||||
}
|
||||
@@ -326,9 +326,9 @@ Result<ParseInfo> parseQuestions(const std::vector<Token>& tokens) {
|
||||
if (questionElements.size() > 0) {
|
||||
if (isGroupQuestion) {
|
||||
auto *question = new GroupQuestion();
|
||||
question->Cooldown = cooldown;
|
||||
question->QuestionText = questionText;
|
||||
question->Section = section;
|
||||
question->cooldown = cooldown;
|
||||
question->questionText = questionText;
|
||||
question->section = section;
|
||||
int32_t k = -1;
|
||||
for (size_t i = 0; i < questionElements.size(); ++i) {
|
||||
auto questionElement = questionElements[i];
|
||||
@@ -336,10 +336,10 @@ Result<ParseInfo> parseQuestions(const std::vector<Token>& tokens) {
|
||||
++k;
|
||||
auto group = Group();
|
||||
group.name = cleanContent(questionElement.content);
|
||||
question->Groups.push_back(group);
|
||||
question->groups.push_back(group);
|
||||
} else {
|
||||
if (k >= 0) {
|
||||
question->Groups[k].elements.push_back(
|
||||
question->groups[k].elements.push_back(
|
||||
cleanContent(
|
||||
questionElement.content
|
||||
)
|
||||
@@ -349,18 +349,18 @@ Result<ParseInfo> parseQuestions(const std::vector<Token>& tokens) {
|
||||
}
|
||||
questions.push_back(question);
|
||||
if (debug) {
|
||||
std::cout << question->ToString() << "\n";
|
||||
std::cout << question->toString() << "\n";
|
||||
}
|
||||
} else {
|
||||
auto *question = new MultiElementQuestion();
|
||||
question->Cooldown = cooldown;
|
||||
question->QuestionText = cleanContent(questionText);
|
||||
question->Section = section;
|
||||
question->cooldown = cooldown;
|
||||
question->questionText = cleanContent(questionText);
|
||||
question->section = section;
|
||||
for (const auto& elem : questionElements) {
|
||||
Choice choice;
|
||||
choice.Answer = cleanContent(elem.content);
|
||||
choice.IsCorrect = !elem.isDash;
|
||||
question->Choices.push_back(choice);
|
||||
choice.answer = cleanContent(elem.content);
|
||||
choice.isCorrect = !elem.isDash;
|
||||
question->choices.push_back(choice);
|
||||
}
|
||||
questions.push_back(question);
|
||||
if (isPlusQuestion) {
|
||||
@@ -371,7 +371,7 @@ Result<ParseInfo> parseQuestions(const std::vector<Token>& tokens) {
|
||||
question->type = MultiElementType::Regular;
|
||||
}
|
||||
if (debug) {
|
||||
std::cout << question->ToString() << "\n";
|
||||
std::cout << question->toString() << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user