本文整理汇总了C++中Student::getApplications方法的典型用法代码示例。如果您正苦于以下问题:C++ Student::getApplications方法的具体用法?C++ Student::getApplications怎么用?C++ Student::getApplications使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student::getApplications方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleAssignPressed
void MenuStartAdmin::handleAssignPressed(Button *pButton) {
MenuStartAdmin::instance()->erase();
//Get a course selection from user
//Get course list
const std::string* courses;
int count;
Database::instance()->getCourses(&courses, count);
//Show dialog
DialogListSelector *pCourseSelector = new DialogListSelector("Assign TA: Select a Course", courses, count);
if (pCourseSelector->show() != STATE_SUCCESS) {
delete pCourseSelector;
MenuStartAdmin::instance()->draw();
return;
}
std::string strCourse = pCourseSelector->getSelectedValue();
delete pCourseSelector;
//Show list of applications
Queue<TaApplication*>* pApplications = Database::instance()->getApplications(strCourse);
if (pApplications == 0 || pApplications->isEmpty()) {
DialogYesNo* pMsg = new DialogYesNo("No applicants available for " + strCourse, DIALOG_MESSAGE);
pMsg->show();
delete pMsg;
MenuStartAdmin::instance()->draw();
return;
}
//Create str[] from queue for listDialog
std::string* pStrApplications = new std::string[pApplications->getSize()];
Node<TaApplication*>* pCur = pApplications->front();
int i = 0;
while (pCur != 0) {
if (pCur->value->getStatus() == STATUS_PENDING) {
pStrApplications[i] = pCur->value->getStudentID();
i++;
}
pCur = pCur->m_pNext;
}
if (i == 0) {
//No applicants pending
DialogYesNo* pMsg = new DialogYesNo("No applicants available for " + strCourse, DIALOG_MESSAGE);
pMsg->show();
delete pMsg;
MenuStartAdmin::instance()->draw();
return;
}
//Show the dialog
DialogListSelector *pDia = new DialogListSelector("Assign TA: Select an Applicant", pStrApplications, i);
if (pDia->show() != STATE_SUCCESS) {
delete pDia;
delete [] pStrApplications;
MenuStartAdmin::instance()->draw();
return;
}
std::string strApplication = pDia->getSelectedValue();
delete [] pStrApplications;
delete pDia;
//Get the selected application
TaApplication* pApp = 0;
pCur = pApplications->front();
while (pCur != 0) {
if (strApplication.find(pCur->value->getStudentID()) != std::string::npos) {
pApp = pCur->value;
}
pCur = pCur->m_pNext;
}
if (pApp == 0) {
MenuStartAdmin::instance()->draw();
return;
}
Student *pStu = Database::instance()->getStudent(pApp->getStudentID());
if (pStu == 0) {
return;
}
if (pStu->getApplications() != 0 && pStu->getApplications()->getSize() > 1) {
pCur = pStu->getApplications()->front();
while (pCur != 0) {
if (pCur->value != pApp) {
pCur->value->setStatus(STATUS_CLOSED);
pCur->value->saveToFile();
}
pCur = pCur->m_pNext;
}
}
pApp->setStatus(STATUS_ACCEPTED);
pApp->saveToFile();
DialogYesNo* pMsg = new DialogYesNo("Student " + pApp->getStudentID() + " has been assigned as TA.", DIALOG_MESSAGE);
pMsg->show();
delete pMsg;
MenuStartAdmin::instance()->draw();
}