本文整理汇总了C++中UUID类的典型用法代码示例。如果您正苦于以下问题:C++ UUID类的具体用法?C++ UUID怎么用?C++ UUID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UUID类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getTaskInfoPath
inline std::string getTaskInfoPath(
const std::string& rootDir,
const SlaveID& slaveId,
const FrameworkID& frameworkId,
const ExecutorID& executorId,
const UUID& executorUUID,
const TaskID& taskId)
{
return strings::format(
TASK_INFO_PATH,
rootDir,
slaveId,
frameworkId,
executorId,
executorUUID.toString(),
taskId).get();
}
开发者ID:luisborges,项目名称:mesos,代码行数:17,代码来源:paths.hpp
示例2: finalHeader
void ASIOSocketWrapper::sendProtocolHeader(const MultiplexedSocketPtr&parentMultiSocket, const Address& address, const UUID&value, unsigned int numConnections) {
// if (paerntMultiSocket->isZeroDelim()) {
std::stringstream header;
header << "GET /" << value.toString() << " HTTP/1.1\r\n";
header << "Upgrade: WebSocket\r\n";
header << "Connection: Upgrade\r\n";
std::string hostname=address.getHostName();
for (std::string::iterator hi=hostname.begin(),he=hostname.end(); hi!=he; ++hi) {
*hi=std::tolower(*hi);
}
header << "Host: " << hostname;
if (address.getService()!="80")
header << ":" << address.getService();
header << "\r\n";
header << "Origin: " << address.getHostName() << "\r\n";
if (parentMultiSocket->getStreamType()!= TCPStream::RFC_6455) {
header << "Sec-WebSocket-Key1: x!|6 j9 U 1 guf 36Y04 | 4\r\n";
header << "Sec-WebSocket-Key2: 3 59 2 E4 _11 x80 \r\n";
} else {
header << "Sec-WebSocket-Version: 13\r\n";
header << "Sec-WebSocket-Key: MTIzNDU2Nzg5MGFiY2RlZg==\r\n";
}
header << "Sec-WebSocket-Protocol: "
<< (parentMultiSocket->getStreamType()==TCPStream::BASE64_ZERODELIM?"wssst":"sst")
<< numConnections << "\r\n";
header << "\r\n";
if (parentMultiSocket->getStreamType()!= TCPStream::RFC_6455) {
header << "abcdefgh";
}
std::string finalHeader(header.str());
Chunk * headerData= new Chunk(finalHeader.begin(),finalHeader.end());
rawSend(parentMultiSocket,headerData,true);
/*
}else {
UUID return_value=(parentMultiSocket->isZeroDelim()?massageUUID(UUID::random()):UUID::random());
Chunk *headerData=new Chunk(TCPStream::TcpSstHeaderSize);
copyHeader(&*headerData->begin(),parentMultiSocket->isZeroDelim()?TCPStream::WEBSOCKET_STRING_PREFIX():TCPStream::STRING_PREFIX(),value,numConnections);
rawSend(parentMultiSocket,headerData,true);
}
*/
}
开发者ID:namwkim,项目名称:sirikata,代码行数:46,代码来源:ASIOSocketWrapper.cpp
示例3: addMigratedObject
/*
This is the function that we use to add an object. generateAck is true if you want to generate an ack message to server idServerAckTo
If you're initially adding an object to the world, you should use the newObjectAdd function instead.
*/
void CraqObjectSegmentation::addMigratedObject(const UUID& obj_id, float radius, ServerID idServerAckTo, bool generateAck)
{
if (mStopping)
return;
if (generateAck)
{
CraqDataKey cdk;
convert_obj_id_to_dht_key(obj_id,cdk);
CraqDataSetGet cdSetGet(cdk, CraqEntry(mContext->id(),radius) ,true,CraqDataSetGet::SET);
receivingObjects_m.lock();
mReceivingObjects.insert(ObjectSet::value_type(obj_id,CraqEntry(mContext->id(),radius)));
receivingObjects_m.unlock();
TrackedSetResultsData tsrd;
tsrd.migAckMsg = generateAcknowledgeMessage(obj_id, radius, idServerAckTo);
tsrd.dur = Time::local() - Time::epoch();
int trackID = getUniqueTrackID();
craqDhtSet.set(cdSetGet,trackID);
trackingMessages[trackID] = tsrd;
}
else
{
//potentially clean up: we should really only be adding objects without generating acks using the newObjectAdd interface
CraqDataKey cdk;
convert_obj_id_to_dht_key(obj_id,cdk);
CraqDataSetGet cdSetGet(cdk, CraqEntry(mContext->id(),radius) ,false,CraqDataSetGet::SET);
int trackID = getUniqueTrackID();
craqDhtSet.set(cdSetGet, trackID);
std::pair<ObjectSet::iterator, bool> inserted = mObjects.insert(ObjectSet::value_type(obj_id,CraqEntry(mContext->id(),radius)));
if (inserted.second)
{
std::cout<<"\n\nAdding object: "<<obj_id.toString()<<"\n";
}
}
}
开发者ID:pathorn,项目名称:sirikata,代码行数:48,代码来源:CraqObjectSegmentation.cpp
示例4: GetSpellById
void SpellData::GetSpellById(const UUID &id, std::function<void(SpellDataPtr)> success, APIFailureCallback failure)
{
APIRequestManager *manager = APIRequestManager::GetDefaultManager();
std::stringstream url;
url << "/spell/" << id.toString();
manager->Send(url.str(), "GET", "", [success](std::istream &stream) {
Poco::JSON::Parser parser;
auto object = parser.parse(stream).extract<JSONObject::Ptr>();
auto data = std::make_shared<SpellData>();
data->FromJSON(object);
success(data);
}, [failure](const std::string &error) {
failure(error);
});
}
开发者ID:metsfan,项目名称:dungeon-raider,代码行数:19,代码来源:SpellData.cpp
示例5: make_pair
std::pair<BSONObj, RecordId> RollbackTest::makeCRUDOp(OpTypeEnum opType,
Timestamp ts,
UUID uuid,
StringData nss,
BSONObj o,
boost::optional<BSONObj> o2,
int recordId) {
invariant(opType != OpTypeEnum::kCommand);
BSONObjBuilder bob;
bob.append("ts", ts);
bob.append("op", OpType_serializer(opType));
uuid.appendToBuilder(&bob, "ui");
bob.append("ns", nss);
bob.append("o", o);
if (o2) {
bob.append("o2", *o2);
}
return std::make_pair(bob.obj(), RecordId(recordId));
}
开发者ID:hanumantmk,项目名称:mongo,代码行数:21,代码来源:rollback_test_fixture.cpp
示例6: locker
ModuleSP
ModuleList::FindModule (const UUID &uuid) const
{
ModuleSP module_sp;
if (uuid.IsValid())
{
Mutex::Locker locker(m_modules_mutex);
collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
{
if ((*pos)->GetUUID() == uuid)
{
module_sp = (*pos);
break;
}
}
}
return module_sp;
}
开发者ID:AlexShiLucky,项目名称:swift-lldb,代码行数:21,代码来源:ModuleList.cpp
示例7: performUpdate
void SQLitePersistedObjectSet::performUpdate(const UUID& internal_id, const String& script_type, const String& script_args, const String& script_contents, RequestCallback cb) {
bool success = true;
int rc;
char* remain;
String value_insert;
value_insert = "INSERT OR REPLACE INTO ";
value_insert += "\"" TABLE_NAME "\"";
value_insert += " (object, script_type, script_args, script_contents) VALUES(?, ?, ?, ?)";
sqlite3_stmt* value_insert_stmt;
rc = sqlite3_prepare_v2(mDB->db(), value_insert.c_str(), -1, &value_insert_stmt, (const char**)&remain);
success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error preparing value insert statement");
String id_str = internal_id.rawHexData();
rc = sqlite3_bind_text(value_insert_stmt, 1, id_str.c_str(), (int)id_str.size(), SQLITE_TRANSIENT);
success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error binding object internal ID to value insert statement");
rc = sqlite3_bind_text(value_insert_stmt, 2, script_type.c_str(), (int)script_type.size(), SQLITE_TRANSIENT);
success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error binding script_type name to value insert statement");
rc = sqlite3_bind_blob(value_insert_stmt, 3, script_args.c_str(), (int)script_args.size(), SQLITE_TRANSIENT);
success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error binding script_args to value insert statement");
rc = sqlite3_bind_blob(value_insert_stmt, 4, script_contents.c_str(), (int)script_contents.size(), SQLITE_TRANSIENT);
success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error binding script_contents to value insert statement");
int step_rc = SQLITE_OK;
while(step_rc == SQLITE_OK) {
step_rc = sqlite3_step(value_insert_stmt);
}
if (step_rc != SQLITE_OK && step_rc != SQLITE_DONE) {
success = false;
sqlite3_reset(value_insert_stmt); // allow this to be cleaned
// up
}
rc = sqlite3_finalize(value_insert_stmt);
success = success && !SQLite::check_sql_error(mDB->db(), rc, NULL, "Error finalizing value insert statement");
if (cb != 0)
mContext->mainStrand->post(std::tr1::bind(cb, success), "SQLitePersistedObjectSet::performUpdate callback");
}
开发者ID:yinlei,项目名称:sirikata,代码行数:40,代码来源:SQLitePersistedObjectSet.cpp
示例8: setupVariadicParameters
void SubgraphNode::setupParameters(Parameterizable& params)
{
setupVariadicParameters(params);
params.addParameter(param::factory::declareBool("iterate_containers", param::ParameterDescription("When true, input vectors will be iterated internally"), false));
std::map<std::string, std::pair<int, bool> > flags;
iterated_inputs_param_ = std::dynamic_pointer_cast<param::BitSetParameter>(param::factory::declareParameterBitSet("iterated_containers", flags).build());
params.addConditionalParameter(iterated_inputs_param_, [this]() { return readParameter<bool>("iterate_containers"); },
[this](param::Parameter* p) {
for (auto& pair : relay_to_external_input_) {
UUID id = pair.second;
InputPtr i = node_handle_->getInput(id);
apex_assert_hard(i);
bool iterate = iterated_inputs_param_->isSet(id.getFullName());
setIterationEnabled(id, iterate);
}
});
}
开发者ID:cogsys-tuebingen,项目名称:csapex,代码行数:22,代码来源:subgraph_node.cpp
示例9: JoinPath
ModuleLock::ModuleLock(const FileSpec &root_dir_spec, const UUID &uuid,
Error &error) {
const auto lock_dir_spec = JoinPath(root_dir_spec, kLockDirName);
error = MakeDirectory(lock_dir_spec);
if (error.Fail())
return;
m_file_spec = JoinPath(lock_dir_spec, uuid.GetAsString().c_str());
m_file.Open(m_file_spec.GetCString(), File::eOpenOptionWrite |
File::eOpenOptionCanCreate |
File::eOpenOptionCloseOnExec);
if (!m_file) {
error.SetErrorToErrno();
return;
}
m_lock.reset(new lldb_private::LockFile(m_file.GetDescriptor()));
error = m_lock->WriteLock(0, 1);
if (error.Fail())
error.SetErrorStringWithFormat("Failed to lock file: %s",
error.AsCString());
}
开发者ID:karwa,项目名称:swift-lldb,代码行数:22,代码来源:ModuleCache.cpp
示例10: equals
bool UUID::equals( const UUID& value ) const {
return this->getMostSignificantBits() == value.getMostSignificantBits() &&
this->getLeastSignificantBits() == value.getLeastSignificantBits();
}
开发者ID:WilliamDrewAeroNomos,项目名称:muthur,代码行数:4,代码来源:UUID.cpp
示例11: compareTo
int UUID::compareTo( const UUID& value ) const {
return apr_strnatcmp( this->toString().c_str(), value.toString().c_str() );
}
开发者ID:WilliamDrewAeroNomos,项目名称:muthur,代码行数:3,代码来源:UUID.cpp
示例12: m_name
//.........这里部分代码省略.........
// "definition.default_uint_value" is the default enumeration value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the default
// value.
{
OptionValueEnumeration *enum_value = new OptionValueEnumeration(definition.enum_values, definition.default_uint_value);
m_value_sp.reset (enum_value);
if (definition.default_cstr_value)
{
if (enum_value->SetValueFromCString(definition.default_cstr_value).Success())
{
enum_value->SetDefaultValue(enum_value->GetCurrentValue());
// Call Clear() since we don't want the value to appear as
// having been set since we called SetValueFromCString() above.
// Clear will set the current value to the default and clear
// the boolean that says that the value has been set.
enum_value->Clear();
}
}
}
break;
case OptionValue::eTypeFileSpec:
// "definition.default_uint_value" represents if the "definition.default_cstr_value" should
// be resolved or not
m_value_sp.reset (new OptionValueFileSpec(FileSpec(definition.default_cstr_value, definition.default_uint_value != 0)));
break;
case OptionValue::eTypeFileSpecList:
// "definition.default_uint_value" is not used for a OptionValue::eTypeFileSpecList
m_value_sp.reset (new OptionValueFileSpecList());
break;
case OptionValue::eTypeFormat:
// "definition.default_uint_value" is the default format enumeration value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the default
// value.
{
Format new_format = eFormatInvalid;
if (definition.default_cstr_value)
Args::StringToFormat (definition.default_cstr_value, new_format, nullptr);
else
new_format = (Format)definition.default_uint_value;
m_value_sp.reset (new OptionValueFormat(new_format));
}
break;
case OptionValue::eTypePathMap:
// "definition.default_uint_value" tells us if notifications should occur for
// path mappings
m_value_sp.reset (new OptionValuePathMappings(definition.default_uint_value != 0));
break;
case OptionValue::eTypeRegex:
// "definition.default_uint_value" is used to the regular expression flags
// "definition.default_cstr_value" the default regular expression value
// value.
m_value_sp.reset (new OptionValueRegex(definition.default_cstr_value, definition.default_uint_value));
break;
case OptionValue::eTypeSInt64:
// "definition.default_uint_value" is the default integer value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the default
// value.
m_value_sp.reset (new OptionValueSInt64(definition.default_cstr_value ? Args::StringToSInt64 (definition.default_cstr_value) : definition.default_uint_value));
break;
case OptionValue::eTypeUInt64:
// "definition.default_uint_value" is the default unsigned integer value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the default
// value.
m_value_sp.reset (new OptionValueUInt64(definition.default_cstr_value ? Args::StringToUInt64 (definition.default_cstr_value) : definition.default_uint_value));
break;
case OptionValue::eTypeUUID:
// "definition.default_uint_value" is not used for a OptionValue::eTypeUUID
// "definition.default_cstr_value" can contain a default UUID value
{
UUID uuid;
if (definition.default_cstr_value)
uuid.SetFromCString (definition.default_cstr_value);
m_value_sp.reset (new OptionValueUUID(uuid));
}
break;
case OptionValue::eTypeString:
// "definition.default_uint_value" can contain the string option flags OR'ed together
// "definition.default_cstr_value" can contain a default string value
{
OptionValueString *string_value = new OptionValueString(definition.default_cstr_value);
if (definition.default_uint_value != 0)
string_value->GetOptions().Reset(definition.default_uint_value);
m_value_sp.reset (string_value);
}
break;
}
}
开发者ID:BlueRiverInteractive,项目名称:lldb,代码行数:101,代码来源:Property.cpp
示例13: convert_obj_id_to_dht_key
void CraqObjectSegmentation::convert_obj_id_to_dht_key(const UUID& obj_id, CraqDataKey& returner) const
{
returner[0] = myUniquePrefixKey;
strncpy(returner+1,obj_id.rawHexData().c_str(),obj_id.rawHexData().size() + 1);
}
开发者ID:pathorn,项目名称:sirikata,代码行数:5,代码来源:CraqObjectSegmentation.cpp
示例14: CONTEXT_SPACETRACE
/*
If we get a message to move an object that our server holds, then we add the object's id to mInTransit.
Whatever calls this must verify that the object is on this server.
I can do the check in the function by querrying bambooDht as well
*/
void CraqObjectSegmentation::migrateObject(const UUID& obj_id, const OSegEntry& new_server_id)
{
if (mStopping)
return;
//log the message.
CONTEXT_SPACETRACE(objectBeginMigrate,
obj_id,mContext->id(),
new_server_id.server());
InTransitMap::const_iterator transIter = mInTransitOrLookup.find(obj_id);
TransLookup tmpTransLookup;
tmpTransLookup.sID = CraqEntry(new_server_id);
Duration tmpDurer = Time::local() - Time::epoch();
tmpTransLookup.timeAdmitted = (int)tmpDurer.toMilliseconds();
mInTransitOrLookup[obj_id] = tmpTransLookup;
//erases the local copy of obj_id
UUID tmp_id = obj_id; //note: can probably delete this line
//erase the local copy of the object.
size_t num_erased = mObjects.erase(obj_id);
#ifdef CRAQ_DEBUG
if (num_erased == 0)
{
std::cout<<"\n\nThe object clearly wasn't registered on this server. This is obj id: " << obj_id.toString() << ". This is time: " <<mContext->simTime().raw() << " Oh no. ";
if (clearToMigrate(obj_id))
std::cout<<" Likely a problem with clear to migrate\n\n";
else
std::cout<<"\n\n clear to migrate is fine migration is being called from somewhere besides server.cpp\n\n";
}
#endif
}
开发者ID:pathorn,项目名称:sirikata,代码行数:43,代码来源:CraqObjectSegmentation.cpp
示例15: tmp
dmz::Config
dmz::ArchivePluginObject::_archive_object (const Handle ObjectHandle) {
Config result;
ObjectModule *objMod (get_object_module ());
if (objMod) {
Config tmp ("object");
Boolean archiveObject (True);
const ObjectType Type (objMod->lookup_object_type (ObjectHandle));
if (Type) {
if (_currentFilterList) {
FilterStruct *filter = _currentFilterList->list;
while (filter) {
if (filter->mode & LocalExportMask) {
if (filter->exTypes.get_count () &&
filter->exTypes.contains_type (Type)) {
archiveObject = False;
filter = 0;
}
if (filter && filter->inTypes.get_count () &&
!filter->inTypes.contains_type (Type)) {
archiveObject = False;
filter = 0;
}
}
if (filter) { filter = filter->next; }
}
}
}
else { archiveObject = False; }
if (archiveObject) {
tmp.store_attribute ("type", Type.get_name ());
UUID uuid;
if (objMod->lookup_uuid (ObjectHandle, uuid)) {
tmp.store_attribute ("uuid", uuid.to_string ());
}
_currentConfig = result = tmp;
objMod->dump_all_object_attributes (ObjectHandle, *this);
}
}
_attrTable.empty ();
_currentConfig.set_config_context (0);
return result;
}
开发者ID:rdarken,项目名称:dmz,代码行数:68,代码来源:dmzArchivePluginObject.cpp
示例16: PRINTF
void BlueNRGGattClient::serviceCharByUUIDCB(Gap::Handle_t connectionHandle,
uint8_t event_data_length,
uint16_t attr_handle,
uint8_t *attr_value)
{
// Charac Properties(1), Charac Value Handle(2), Charac UUID(2/16)
GattAttribute::Handle_t declHandle, valueHandle;
UUID uuid;
PRINTF("serviceCharByUUIDCB\n\r");
// UUID Type
if (event_data_length == 7) {
PRINTF("Char UUID_TYPE_16\n\r");
uuid = attr_value[4]<<8|attr_value[3];
PRINTF("C UUID-%X\r\n", uuid.getShortUUID());
} else {
PRINTF("Char UUID_TYPE_128\n\r");
uuid.setupLong(attr_value+3);
PRINTF("C UUID-");
#ifdef DEBUG
const uint8_t *longUUIDBytes = uuid.getBaseUUID();
for (unsigned i = 0; i < UUID::LENGTH_OF_LONG_UUID; i++) {
PRINTF("%02X", longUUIDBytes[i]);
}
PRINTF("\r\n");
#endif
}
// Properties
DiscoveredCharacteristic::Properties_t p;
p._broadcast = (props_mask[0] & attr_value[0]);
p._read = (props_mask[1] & attr_value[0])>>1;
p._writeWoResp = (props_mask[2] & attr_value[0])>>2;
p._write = (props_mask[3] & attr_value[0])>>3;
p._notify = (props_mask[4] & attr_value[0])>>4;
p._indicate = (props_mask[5] & attr_value[0])>>5;
p._authSignedWrite = (props_mask[6] & attr_value[0])>>6;
PRINTF("p._broadcast=%d\n\r", p._broadcast);
PRINTF("p._read=%d\n\r", p._read);
PRINTF("p._writeWoResp=%d\n\r", p._writeWoResp);
PRINTF("p._write=%d\n\r", p._write);
PRINTF("p._notify=%d\n\r", p._notify);
PRINTF("p._indicate=%d\n\r", p._indicate);
PRINTF("p._authSignedWrite=%d\n\r", p._authSignedWrite);
/*
uint8_t props = attr_value[0];
PRINTF("CHAR PROPS: %d\n\r", props);
*/
// Handles
declHandle = attr_handle;
valueHandle = attr_value[1];
discoveredChar[_numChars].setup(this,
connectionHandle,
uuid,
p,
declHandle,
valueHandle);
if(characteristicDiscoveryCallback) {
characteristicDiscoveryCallback(&discoveredChar[_numChars]);
}
_numChars++;
}
开发者ID:ARMmbed,项目名称:apm-watch-tracker,代码行数:68,代码来源:BlueNRGGattClient.cpp
示例17: format_url
std::string format_url(const UUID& uuid, TPM_Storage_Type storage)
{
std::string storage_str = (storage == TPM_Storage_Type::User) ? "user" : "system";
return "tpmkey:uuid=" + uuid.to_string() + ";storage=" + storage_str;
}
开发者ID:fxdupont,项目名称:botan,代码行数:5,代码来源:tpm.cpp
示例18: file
/** 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;
}
开发者ID:adjustive,项目名称:mypasswordsafe,代码行数:70,代码来源:plaintextlizer.cpp
示例19: sizeof
bool DynamicLoaderMacOSXDYLD::GetSharedCacheInformation(
lldb::addr_t &base_address, UUID &uuid, LazyBool &using_shared_cache,
LazyBool &private_shared_cache) {
base_address = LLDB_INVALID_ADDRESS;
uuid.Clear();
using_shared_cache = eLazyBoolCalculate;
private_shared_cache = eLazyBoolCalculate;
if (m_process) {
addr_t all_image_infos = m_process->GetImageInfoAddress();
// The address returned by GetImageInfoAddress may be the address of dyld
// (don't want) or it may be the address of the dyld_all_image_infos
// structure (want). The first four bytes will be either the version field
// (all_image_infos) or a Mach-O file magic constant. Version 13 and higher
// of dyld_all_image_infos is required to get the sharedCacheUUID field.
Status err;
uint32_t version_or_magic =
m_process->ReadUnsignedIntegerFromMemory(all_image_infos, 4, -1, err);
if (version_or_magic != static_cast<uint32_t>(-1) &&
version_or_magic != llvm::MachO::MH_MAGIC &&
version_or_magic != llvm::MachO::MH_CIGAM &&
version_or_magic != llvm::MachO::MH_MAGIC_64 &&
version_or_magic != llvm::MachO::MH_CIGAM_64 &&
version_or_magic >= 13) {
addr_t sharedCacheUUID_address = LLDB_INVALID_ADDRESS;
int wordsize = m_process->GetAddressByteSize();
if (wordsize == 8) {
sharedCacheUUID_address =
all_image_infos + 160; // sharedCacheUUID <mach-o/dyld_images.h>
}
if (wordsize == 4) {
sharedCacheUUID_address =
all_image_infos + 84; // sharedCacheUUID <mach-o/dyld_images.h>
}
if (sharedCacheUUID_address != LLDB_INVALID_ADDRESS) {
uuid_t shared_cache_uuid;
if (m_process->ReadMemory(sharedCacheUUID_address, shared_cache_uuid,
sizeof(uuid_t), err) == sizeof(uuid_t)) {
uuid = UUID::fromOptionalData(shared_cache_uuid, 16);
if (uuid.IsValid()) {
using_shared_cache = eLazyBoolYes;
}
}
if (version_or_magic >= 15) {
// The sharedCacheBaseAddress field is the next one in the
// dyld_all_image_infos struct.
addr_t sharedCacheBaseAddr_address = sharedCacheUUID_address + 16;
Status error;
base_address = m_process->ReadUnsignedIntegerFromMemory(
sharedCacheBaseAddr_address, wordsize, LLDB_INVALID_ADDRESS,
error);
if (error.Fail())
base_address = LLDB_INVALID_ADDRESS;
}
return true;
}
//
// add
// NB: sharedCacheBaseAddress is the next field in dyld_all_image_infos
// after
// sharedCacheUUID -- that is, 16 bytes after it, if we wanted to fetch
// it.
}
}
return false;
}
开发者ID:llvm-project,项目名称:lldb,代码行数:71,代码来源:DynamicLoaderMacOSXDYLD.cpp
示例20: makeUUID
UUID makeUUID() {
UUID v;
auto u = boost::uuids::random_generator()();
std::copy(u.begin(), u.end(), v.begin());
return v;
}
开发者ID:alepez,项目名称:bmrk,代码行数:6,代码来源:UUID.cpp
注:本文中的UUID类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论