QString QFSFileEngine::owner(FileOwner own) const { #ifndef Q_OS_SYMBIAN if (own == OwnerUser) return QFileSystemEngine::resolveUserName(ownerId(own)); return QFileSystemEngine::resolveGroupName(ownerId(own)); #else Q_UNUSED(own) return QString(); #endif }
const std::string toString() const { std::ostringstream oss; oss << "<RunInstancesResponse>\n" << " <requestId>" << requestId() << "</requestId>\n" << " <reservationId>" << reservationId() << "</reservationId>\n" << " <ownerId>" << ownerId() << "</ownerId>\n" ; oss << " <groupSet>\n"; for ( std::vector<groupSet_t>::const_iterator item (_groupSet.begin()) ; item != _groupSet.end() ; ++item ) { oss<< " <item>\n " << *item << " </item>\n"; } oss << " </groupSet>\n" << " <instancesSet>\n"; for ( std::vector<instancesSet_t>::const_iterator item (_instancesSet.begin()) ; item != _instancesSet.end() ; ++item ) { oss<< " <item>\n " << *item << " </item>\n"; } oss << " </instancesSet>\n" << "</RunInstancesResponse>\n" ; return oss.str(); }
QString QFileInfo::owner() const { passwd *pw = getpwuid( ownerId() ); if ( pw ) return QFile::decodeName( pw->pw_name ); return QString::null; }
QString QFSFileEngine::owner(FileOwner own) const { #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) int size_max = sysconf(_SC_GETPW_R_SIZE_MAX); if (size_max == -1) size_max = 1024; QVarLengthArray<char, 1024> buf(size_max); #endif if (own == OwnerUser) { struct passwd *pw = 0; #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) struct passwd entry; getpwuid_r(ownerId(own), &entry, buf.data(), buf.size(), &pw); #else pw = getpwuid(ownerId(own)); #endif if (pw) return QFile::decodeName(QByteArray(pw->pw_name)); } else if (own == OwnerGroup) { struct group *gr = 0; #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) size_max = sysconf(_SC_GETGR_R_SIZE_MAX); if (size_max == -1) size_max = 1024; buf.resize(size_max); struct group entry; getgrgid_r(ownerId(own), &entry, buf.data(), buf.size(), &gr); #else gr = getgrgid(ownerId(own)); #endif if (gr) return QFile::decodeName(QByteArray(gr->gr_name)); } return QString(); }
// Files data out to a DWG file. // Acad::ErrorStatus AsdkOwnerDemo::dwgOutFields(AcDbDwgFiler* filer) const { assertReadEnabled(); AcDbObject::dwgOutFields(filer); // Since objects of this class will be in the Named // Objects Dictionary tree and may be hard referenced // by some other object, to support wblock we need to // file out our owner as a hard pointer Id so that it // will be added to the list of objects to be wblocked // if (filer->filerType() == AcDb::kWblockCloneFiler) filer->writeHardPointerId((AcDbHardPointerId)ownerId()); filer->writeItem(mIntval); filer->writeItem(mObjId); return filer->filerStatus(); }
const QString Audio::file() const { return CoreSettings::getAudioDir() + ownerId() + QString("-") + objectId() + QString(".mp3"); }
Acad::ErrorStatus ArxDbgDbEntity::deepClone(AcDbObject* pOwner, AcDbObject*& pClonedObject, AcDbIdMapping& idMap, Adesk::Boolean isPrimary) const { // You should always pass back pClonedObject == NULL // if, for any reason, you do not actually clone it // during this call. The caller should pass it in // as NULL, but to be safe, we set it here as well. pClonedObject = NULL; if (ArxDbgOptions::m_instance.m_showDeepCloneDetails) { CString titleStr, tmpStr; titleStr.Format(_T("Beginning -- deepClone: %s"), ArxDbgUtils::objToClassAndHandleStr(const_cast<ArxDbgDbEntity*>(this), tmpStr)); ArxDbgUiTdmIdMap dbox(&idMap, acedGetAcadDwgView(), titleStr); dbox.DoModal(); } AcDb::DeepCloneType type = idMap.deepCloneContext(); // if we know everything will be cloned for us, just let // the base class do everything for us. if ((type == AcDb::kDcInsert) || (type == AcDb::kDcInsertCopy) || (type == AcDb::kDcExplode)) return AcDbEntity::deepClone(pOwner, pClonedObject, idMap, isPrimary); // following case happens when doing a AcDbDatabase::deepCloneObjects() // and the owner happens to be the same... then its really like a // kDcCopy, otherwise deepCloneObjects() is like a kDcBlock if (type == AcDb::kDcObjects) { if (ownerId() == pOwner->objectId()) type = AcDb::kDcCopy; else type = AcDb::kDcBlock; } // now ask derived classes what references they want cloned for them AcDbObjectIdArray refEntIds; AcDbIntArray refTypes; getCloneReferences(type, refEntIds, refTypes); ASSERT(refEntIds.length() == refTypes.length()); // if derived class doesn't have any references to take care of, then // we will just let the AcDbEntity::deepClone() take care of things. if (refEntIds.isEmpty()) return AcDbEntity::deepClone(pOwner, pClonedObject, idMap, isPrimary); // If this object is in the idMap and is already // cloned, then return. bool tmpIsPrimary = isPrimary ? true : false; // get around compiler performance warning AcDbIdPair idPair(objectId(), AcDbObjectId::kNull, false, tmpIsPrimary); if (idMap.compute(idPair) && (idPair.value() != NULL)) return Acad::eOk; // STEP 1: // Create the clone // AcDbObject *pClone = (AcDbObject*)isA()->create(); if (pClone != NULL) pClonedObject = pClone; // set the return value else return Acad::eOutOfMemory; // STEP 2: // Append the clone to its new owner. In this example, // we know that we are derived from AcDbEntity, so we // can expect our owner to be an AcDbBlockTableRecord, // unless we have set up an ownership relationship with // another of our objects. In that case, we need to // establish how we connect to that owner in our own // way. This sample shows a generic method using // setOwnerId(). // AcDbBlockTableRecord *pBTR = AcDbBlockTableRecord::cast(pOwner); if (pBTR != NULL) { AcDbEntity* ent = AcDbEntity::cast(pClone); pBTR->appendAcDbEntity(ent); } else { if (isPrimary) return Acad::eInvalidOwnerObject; // Some form of this code is only necessary if // anyone has set up an ownership for our object // other than with an AcDbBlockTableRecord. // pOwner->database()->addAcDbObject(pClone); pClone->setOwnerId(pOwner->objectId()); } // STEP 3: // Now we copy our contents to the clone. This is done // using an AcDbDeepCloneFiler. This filer keeps a // list of all AcDbHardOwnershipIds and // AcDbSoftOwnershipIds we, and any classes we derive // from, have. This list is then used to know what // additional, "owned" objects need to be cloned below. // AcDbDeepCloneFiler filer; dwgOut(&filer); // STEP 4: // Rewind the filer and read the data into the clone. // filer.seek(0L, AcDb::kSeekFromStart); pClone->dwgIn(&filer); // STEP 5: // This must be called for all newly created objects // in deepClone. It is turned off by endDeepClone() // after it has translated the references to their // new values. // pClone->setAcDbObjectIdsInFlux(); // STEP 6: // Add the new information to the idMap. We can use // the idPair started above. // idPair.setValue(pClonedObject->objectId()); idPair.setIsCloned(Adesk::kTrue); idMap.assign(idPair); // STEP 7: // Using the filer list created above, find and clone // any owned objects. // AcDbObject *pSubObject; AcDbObject *pClonedSubObject; AcDbObjectId id; Acad::ErrorStatus es; while (filer.getNextOwnedObject(id)) { // Open the object and clone it. Note that we now // set "isPrimary" to kFalse here because the object // is being cloned, not as part of the primary set, // but because it is owned by something in the // primary set. es = acdbOpenAcDbObject(pSubObject, id, AcDb::kForRead); if (es != Acad::eOk) continue; // could have been NULL or erased pClonedSubObject = NULL; pSubObject->deepClone(pClonedObject, pClonedSubObject, idMap, Adesk::kFalse); // If this is a kDcInsert context, the objects // may be "cheapCloned". In this case, they are // "moved" instead of cloned. The result is that // pSubObject and pClonedSubObject will point to // the same object. So, we only want to close // pSubObject if it really is a different object // than its clone. if (pSubObject != pClonedSubObject) pSubObject->close(); // The pSubObject may either already have been // cloned, or for some reason has chosen not to be // cloned. In that case, the returned pointer will // be NULL. Otherwise, since we have no immediate // use for it now, we can close the clone. if (pClonedSubObject != NULL) pClonedSubObject->close(); } // clone the referenced entities AcDbObject* ent; int len = refEntIds.length(); for (int i=0; i<len; i++) { if (refTypes[i] == kClone) { es = acdbOpenAcDbObject(ent, refEntIds[i], AcDb::kForRead); if (es == Acad::eOk) { pClonedSubObject = NULL; es = ent->deepClone(pOwner, pClonedSubObject, idMap, Adesk::kTrue); if (es == Acad::eOk) { // see comment above about cheap clone if (ent != pClonedSubObject) ent->close(); if (pClonedSubObject != NULL) pClonedSubObject->close(); } } } // this case is needed for RefEdit so we can pass its validation // test when editing a blockReference. We don't actually clone it // but we add it to the map so it thinks it got cloned and is therefore // a valid "Closed Set" of objects. else if (refTypes[i] == kFakeClone) { AcDbIdPair idPair(refEntIds[i], refEntIds[i], false, false, true); idMap.assign(idPair); } } if (ArxDbgOptions::m_instance.m_showDeepCloneDetails) { CString titleStr, tmpStr; titleStr.Format(_T("End -- deepClone: %s"), ArxDbgUtils::objToClassAndHandleStr(const_cast<ArxDbgDbEntity*>(this), tmpStr)); ArxDbgUiTdmIdMap dbox(&idMap, acedGetAcadDwgView(), titleStr); dbox.DoModal(); } // Leave pClonedObject open for the caller return Acad::eOk; }
QString QFSFileEngine::owner(FileOwner own) const { if (own == OwnerUser) return QFileSystemEngine::resolveUserName(ownerId(own)); return QFileSystemEngine::resolveGroupName(ownerId(own)); }
wxThread::ExitCode PFMMonitorThread::Entry() { const int timeoutMSecs = 50; long long startChangeInstance = 0, nextChangeInstance = 0; PfmApi *pfmApi = PFMProxy::getInstance().getPfmApi(); // Get the main frame window EncFSMPMainFrame *pMainFrame = NULL; wxWindow *pTopWindow = wxTheApp->GetTopWindow(); if(pTopWindow != NULL) { pMainFrame = dynamic_cast<EncFSMPMainFrame *>(pTopWindow); } while(!TestDestroy()) { int retVal = pfmMonitor_->Wait(nextChangeInstance, timeoutMSecs); bool sendEvents = true; { wxMutexLocker lock(mutex_); sendEvents = sendEvents_; } if(sendEvents) { PfmIterator *iter = NULL; pfmApi->MountIterate(startChangeInstance, &nextChangeInstance, &iter); long long curChangeInstance = 0; int mountId = iter->Next(&curChangeInstance); while(mountId > 0) { if(curChangeInstance >= startChangeInstance) { PfmMount *curMount = NULL; int err = pfmApi->MountIdOpen(mountId, &curMount); if(err == 0 && curMount != NULL) { int statusFlags = curMount->GetStatusFlags(); std::wstring formatterName(curMount->GetFormatterName()); std::wstring fileName(curMount->GetMountSourceName()); wchar_t driveLetter = curMount->GetDriveLetter(); #if !defined(EFS_WIN32) driveLetter = L' '; #endif std::wstring ownerName(curMount->GetOwnerName()); std::wstring ownerId(curMount->GetOwnerId()); std::wstring mountPoint(curMount->GetMountPoint()); if(formatterName == EncFSMPStrings::formatterName_) { if((statusFlags & (pfmStatusFlagReady | pfmStatusFlagDisconnected | pfmStatusFlagClosed)) != 0) { bool isMountEvent = ((statusFlags & (pfmStatusFlagDisconnected | pfmStatusFlagClosed)) == 0); pMainFrame->addNewMountEvent(isMountEvent, false, fileName, driveLetter, mountPoint); } } curMount->Release(); } } mountId = iter->Next(&curChangeInstance); } iter->Release(); startChangeInstance = nextChangeInstance; } } return 0; }