示例#1
0
ccColorScale::ccColorScale(QString name, QString uuid/*=QString()*/)
	: m_name(name)
	, m_uuid(uuid)
	, m_updated(false)
	, m_relative(true)
	, m_locked(false)
	, m_absoluteMinValue(0.0)
	, m_absoluteRange(1.0)
{
	if (m_uuid.isNull())
		generateNewUuid();
}
示例#2
0
std::string generateHostUuid() {
#ifdef __APPLE__
  // Use the hardware uuid available on OSX to identify this machine
  uuid_t id;
  // wait at most 5 seconds for gethostuuid to return
  const timespec wait = {5, 0};
  int result = gethostuuid(id, &wait);
  if (result == 0) {
    char out[128];
    uuid_unparse(id, out);
    std::string uuid_string = std::string(out);
    boost::algorithm::trim(uuid_string);
    return uuid_string;
  } else {
    // unable to get the hardware uuid, just return a new uuid
    return generateNewUuid();
  }
#else
  return generateNewUuid();
#endif
}