本文整理汇总了C++中DataManager::getList方法的典型用法代码示例。如果您正苦于以下问题:C++ DataManager::getList方法的具体用法?C++ DataManager::getList怎么用?C++ DataManager::getList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager::getList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_date
bool set_date(int id)
{
if(id < 0)
return false;
DataManager* data = DataManager::instanceOf();
for(int i = 0; i < 3; ++i)
{
string tmp;
int day, month, year;
cout << "podaj date" << endl;
cout << "teraz podaj: dzien" << endl;
day = get_from_stdin();
cout << "podaj: miesiac" << endl;
month = get_from_stdin();
cout << "podaj: rok" << endl;
year = get_from_stdin();
try{
if( data->getList().find(id)->setDate(day,month,year) )
{
return true;
}
}
catch(invalid_argument e)
{
cerr << "bledna data" << endl;
}
}
return false;
}
示例2: set_time
bool set_time(int id)
{
if(id < 0)
return false;
DataManager* data = DataManager::instanceOf();
for(int i = 0; i < 3; ++i)
{
string tmp;
int hour, min, sec;
cout << "podaj dokladny czas" << endl;
cout << "teraz podaj: godzine" << endl;
hour = get_from_stdin();
cout << "podaj: minute" << endl;
min = get_from_stdin();
cout << "podaj: sekunde" << endl;
sec = get_from_stdin();
try{
if( data->getList().find(id)->setTime(hour,min,sec) )
{
return true;
}
}
catch(invalid_argument e)
{
cerr << "bledny czas" << endl;
}
}
return false;
}
示例3: get_task_by_id
Todos::iterator get_task_by_id()
{
int i;
string input;
Todos::iterator it;
DataManager* data = DataManager::instanceOf();
cout << "podaj id" << endl;
i = get_from_stdin();
if(i < 0)
{
it = data->getList().end();
cerr << "blad: nie ma takiego id" << endl;
}
else
{
it = data->find(i);
if(it == data->getList().end())
{
cerr << "blad: Zadanie o podanym id nie istnieje" << endl;
}
}
return it;
}
示例4: main
int main(int argc, char** argv)
{
DataManager* data = DataManager::instanceOf();
if(argc >=2)
{
if(strcmp(argv[1],"-o")==0)
{
string file_name(argv[2]);
data->loadFile(file_name);
}
}
string input;
do
{
cout << endl;
if(data->getList().size() > 0)
{
data->getList().getTaskList();
cout << endl;
}
cout << "opcje do wyboru:" << endl;
cout << "open" << endl;
cout << "create" << endl;
cout << "exit" << endl;
if(data->getList().size() > 0)
{
cout << "save" << endl;
cout << "setdate" << endl;
cout << "settime" << endl;
cout << "setdescription" << endl;
cout << "settitle" << endl;
cout << "setpriority" << endl;
cout << "setseverity" << endl;
}
cout << endl << "->";
getline(cin,input);
if(input == "open")
{
getline(cin,input);
data->loadFile(input);
if(data->auth_required())
{
for(int i = 0; i < 3; ++i)
{
cout << "password:" << endl;
getline(cin,input);
if(data->auth(input))
cout << "Welcome" << endl;
else
cout << "access danied" << endl;
input = "";
}
continue;
}
}
int i = 0;
if(input == "save")
{
cout << "Podaj nazwe pliku:" << endl;
getline(cin,input);
if( data->saveToFile(input) )
{
cout << "Zapisano" << endl;
}
else
{
cerr << "Nie udało się zapisać" << endl;
}
}
string tmp;
if(input == "create")
{
cout << "podaj tytul" << endl;
getline(cin,tmp);
int id = data->addTask(tmp);
data->getList();
set_date(id);
set_time(id);
}
if(input == "setpass")
{
bool fine = true;
string opass, npass;
if(data->auth_required())
{
cout << "podaj aktualne haslo:" << endl;
getline(cin,opass);
fine = data->auth(opass);
if(!fine)
cout << "haslo nieprawidlowe" << endl;
}
if(fine)
{
cout << "podaj nowe haslo" << endl;
getline(cin,npass);
data->setPasscode(opass,npass);
}
//.........这里部分代码省略.........