本文整理汇总了C++中UUID::fromString方法的典型用法代码示例。如果您正苦于以下问题:C++ UUID::fromString方法的具体用法?C++ UUID::fromString怎么用?C++ UUID::fromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UUID
的用法示例。
在下文中一共展示了UUID::fromString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
/** Loads a plaintext file that was created by MyPasswordSafe.
*/
Safe::Error PlainTextLizer::load(Safe &safe, const QString &path, const EncryptedString &passphrase, const QString &)
{
QFile file(path);
if(file.open(QIODevice::ReadOnly)) {
QTextStream stream(&file);
stream.setEncoding(QTextStream::UnicodeUTF8);
QString line;
line = stream.readLine();
if(EncryptedString(line.utf8()) != passphrase)
return Safe::Failed; // passphrase was invalid
while(!stream.atEnd()) {
line = stream.readLine();
QStringList items = QStringList::split('\t', line, true);
DBGOUT("items.count = " << items.count());
if(items.count() == 9) {
SafeGroup *group = findOrCreateGroup(&safe, field(items, 3));
if(group == NULL)
group = &safe;
SafeEntry *item = new SafeEntry(group);
item->setName(field(items, 0));
item->setUser(field(items, 1));
item->setPassword(field(items, 2).utf8());
item->setCreationTime(QDateTime::fromString(field(items, 4), Qt::ISODate));
item->setModifiedTime(QDateTime::fromString(field(items, 5), Qt::ISODate));
item->setAccessTime(QDateTime::fromString(field(items, 6), Qt::ISODate));
item->setLifetime(QTime::fromString(field(items, 7), Qt::ISODate));
UUID uuid;
uuid.fromString(field(items, 8));
item->setUUID(uuid);
line = stream.readLine();
line.replace("\\n", "\n");
item->setNotes(line);
}
else {
file.close();
return Safe::BadFile;
}
}
file.close();
return Safe::Success;
}
return Safe::BadFile;
#if 0
ifstream file(path);
if(file.is_open()) {
string line;
getline(file, line, '\n');
while(!file.eof()) {
getline(file, line, '\n');
//if(items.size() == 4)
// safe_item.setGroup(items[3]);
}
file.close();
return Safe::Success;
}
#endif
return Safe::Failed;
}