本文整理汇总了C++中UUID::toAscii方法的典型用法代码示例。如果您正苦于以下问题:C++ UUID::toAscii方法的具体用法?C++ UUID::toAscii怎么用?C++ UUID::toAscii使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UUID
的用法示例。
在下文中一共展示了UUID::toAscii方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateUuid
//**************************************************************************
//**************************************************************************
// Get the UUID
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
std::string Uuid::CreateUuid(void)
{
#ifdef FC_OS_WIN32
RPC_STATUS rstat;
UUID uuid;
unsigned char *uuidStr;
rstat = UuidCreate(&uuid);
if (rstat != RPC_S_OK) throw Base::Exception("Cannot convert a unique Windows UUID to a string");
rstat = UuidToString(&uuid, &uuidStr);
if (rstat != RPC_S_OK) throw Base::Exception("Cannot convert a unique Windows UUID to a string");
std::string Uuid((char *)uuidStr);
/* convert it from rcp memory to our own */
//container = nssUTF8_Duplicate(uuidStr, NULL);
RpcStringFree(&uuidStr);
#elif 1
std::string Uuid;
QString uuid = QUuid::createUuid().toString();
uuid = uuid.mid(1);
uuid.chop(1);
Uuid = (const char*)uuid.toAscii();
#else
// use Python's implemententation
std::string Uuid;
PyGILStateLocker lock;
try {
Py::Module module(PyImport_ImportModule("uuid"),true);
Py::Callable method(module.getAttr("uuid4"));
Py::Tuple arg;
Py::Object guid = method.apply(arg);
Uuid = guid.as_string();
}
catch (Py::Exception& e) {
e.clear();
throw Base::Exception("Creation of UUID failed");
}
#endif
return Uuid;
}