void CourseManager::delCourse(const std::string & name) { int index = FindCourse(name); if(index > 0) courseList.erase(courseList.begin() + index); else std::cout << "Not Found" << std::endl; }
void CourseManager::PrintInfo(size_t id) { int loc = FindCourse(id); if(loc >0) std::cout << vecCourse_[loc] << std::endl; else std::cout << "No Course" << std::endl; }
void CourseManager::PrintInfo(std::string & name) { int loc = FindCourse(name); if(loc>0) std::cout << vecCourse_[loc] << std::endl; else std::cout << "No Course" << std::endl; }
void CourseManager::RemoveCourse(size_t id) { int loc = FindCourse(id); if( loc > 0) vecCourse_.erase(vecCourse_.begin()+loc); else std::cout << "Not Found" << std::endl; }
void CourseManager::RemoveCourse(std::string & name) { int loc = FindCourse(name); if (loc > 0) vecCourse_.erase(vecCourse_.begin() + loc); else std::cout << "Not Found" << std::endl; }
void CourseManager::PrintCourse(const std::string & name) { int index = FindCourse(name); if(index > 0) { std::cout << "Information of Course " << name << ": "; std::cout << courseList[index] << std::endl; } else std::cout << "This course is not in the courselist." << std::endl; }
//print the course, parameter is id or name void CourseManager::PrintCourse(const int id) { int index = FindCourse(id); if( index > 0 ) { std::cout << "Information of ID " << id << ": " ; std::cout << courseList[index] << std::endl; } else std::cout << "This ID is not available." << std::endl; }
bool UnlockSystem::CourseIsLocked( const Course *course ) const { if( !PREFSMAN->m_bUseUnlockSystem ) return false; const UnlockEntry *p = FindCourse( course ); if( p == NULL ) return false; return p->IsLocked(); }
int UnlockManager::FindCode( const CString &sName ) const { const UnlockEntry *pEntry = NULL; const Song *pSong = SONGMAN->FindSong( sName ); if( pSong != NULL ) pEntry = FindSong( pSong ); const Course *pCourse = SONGMAN->FindCourse( sName ); if( pCourse != NULL ) pEntry = FindCourse( pCourse ); if( pEntry == NULL ) pEntry = FindModifier( sName ); if( pEntry == NULL ) { LOG->Warn( "Couldn't find locked entry \"%s\"", sName.c_str() ); return -1; } return pEntry->m_iCode; }