本文整理汇总了C++中ListNode::getContent方法的典型用法代码示例。如果您正苦于以下问题:C++ ListNode::getContent方法的具体用法?C++ ListNode::getContent怎么用?C++ ListNode::getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListNode
的用法示例。
在下文中一共展示了ListNode::getContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: manageList
void VocaEngine::manageList(int index) {
int tag = 1; // new index
ListNode <Voca*> *cur = list->getNode(index);
bool hasPrev = (index != 0) ? true : false;
bool hasNext = false;
if (!cur) { // empty list
cout << "#" << endl;
cout << "# EMPTY LIST" << endl;
cout << "#" << endl;
return;
}
cout << "# [ LIST ]" << endl;
while (cur != list->getHead() && tag <= 10) {
Voca *curVoca = cur->getContent();
cout << "# [" << tag++ << "] ";
cout << curVoca->getWord() << " - " << curVoca->getMean() << endl;
cur = cur->getNext();
}
if (cur != list->getHead() && tag == 11)
hasNext = true;
cout << "#" << endl;
cout << "# [ LIST MENU ]" << endl;
cout << "# (1) DELETE" << endl;
cout << "# (2) INITIALIZATION" << endl;
cout << "# (3) CANCEL" << endl;
if (hasPrev && hasNext) {
cout << "# (4) <=" << endl;
cout << "# (5) =>" << endl;
cout << "#" << endl;
} else if (hasPrev) {
cout << "# (4) <=" << endl;
} else if (hasNext) {
cout << "# (4) =>" << endl;
}
cout << "#" << endl;
cout << "# SELECT : ";
char input[100];
cin >> input;
if (input[0] < '1' || input[0] > '3') {
if (!hasPrev && !hasNext) {
cout << "# ERROR : WRONG INPUT" << endl;
cout << "#" << endl;
return;
}
else if (input[0] == '5' && (!hasPrev || !hasNext)) {
cout << "# ERROR : WRONG INPUT" << endl;
cout << "#" << endl;
return;
}
}
switch(input[0]) {
case '1':
int choice;
cout << "# SELECT INDEX [NUMBER] : ";
cin >> choice;
if (choice < 1 || choice > tag-1) {
cout << "# ERROR : WRONG INDEX" << endl;
cout << "#" << endl;
} else {
list->delNode(index + choice - 1);
if (!dirty)
dirty = true;
cout << "# DATA DELETE" << endl;
cout << "#" << endl;
}
break;
case '2':
char answer[100];
cout << "# Are you sure ? (y,N) : ";
cin >> answer;
if (answer[0] == 'Y' || answer[0] == 'y') {
cout << "# LIST INITIIALIZATION" << endl;
cout << "#" << endl;
initList();
}
break;
case '3':
cout << "#" << endl;
break;
case '4':
cout << "#" << endl;
if (!hasPrev)
manageList(index + 10);
else
manageList(index - 10);
break;
case '5':
cout << "#" << endl;
manageList(index + 10);
break;
//.........这里部分代码省略.........