當前位置: 首頁>>代碼示例>>C++>>正文


C++ DirectoryEntry類代碼示例

本文整理匯總了C++中DirectoryEntry的典型用法代碼示例。如果您正苦於以下問題:C++ DirectoryEntry類的具體用法?C++ DirectoryEntry怎麽用?C++ DirectoryEntry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DirectoryEntry類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: lock

void DirectoryListingClient::receive(void* object, Message* msg) {
	ServiceStub::receive(object, msg);

	if (msg->getMeta().find("operation") != msg->getMeta().end()) {
		ScopeLock lock(_mutex);
		string op = msg->getMeta("operation");
		DirectoryEntry* dirEntry = new DirectoryEntry(*(DirectoryEntry*)object);
		string key = dirEntry->path() + ":" + dirEntry->name();
		if (op.compare("added") == 0) {
			if (_knownEntries.find(key) == _knownEntries.end())
				_knownEntries[key] = shared_ptr<DirectoryEntry>(dirEntry);
			if (_listener != NULL)
				_listener->added(_knownEntries[key]);
		} else if (op.compare("modified") == 0) {
			if (_knownEntries.find(key) != _knownEntries.end()) {
				if (_listener != NULL)
					_listener->changed(_knownEntries[key]);
			} else {
				UM_LOG_ERR("Unknown directory entry reported as modified");
			}
		} else if (op.compare("removed") == 0) {
			if (_knownEntries.find(key) != _knownEntries.end()) {
				if (_listener != NULL)
					_listener->removed(_knownEntries[key]);
			} else {
				UM_LOG_ERR("Unknown directory entry reported as removed");
			}
		}
	}
}
開發者ID:0790486,項目名稱:umundo,代碼行數:30,代碼來源:DirectoryListingClient.cpp

示例2: jsDirectoryEntryPrototypeFunctionRemoveRecursively

EncodedJSValue JSC_HOST_CALL jsDirectoryEntryPrototypeFunctionRemoveRecursively(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSDirectoryEntry::s_info))
        return throwVMTypeError(exec);
    JSDirectoryEntry* castedThis = static_cast<JSDirectoryEntry*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDirectoryEntry::s_info);
    DirectoryEntry* imp = static_cast<DirectoryEntry*>(castedThis->impl());
    RefPtr<VoidCallback> successCallback;
    if (exec->argumentCount() > 0 && !exec->argument(0).isNull() && !exec->argument(0).isUndefined()) {
        if (!exec->argument(0).isObject()) {
            setDOMException(exec, TYPE_MISMATCH_ERR);
            return JSValue::encode(jsUndefined());
        }
        successCallback = JSCustomVoidCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
    }
    RefPtr<ErrorCallback> errorCallback;
    if (exec->argumentCount() > 1 && !exec->argument(1).isNull() && !exec->argument(1).isUndefined()) {
        if (!exec->argument(1).isObject()) {
            setDOMException(exec, TYPE_MISMATCH_ERR);
            return JSValue::encode(jsUndefined());
        }
        errorCallback = JSErrorCallback::create(asObject(exec->argument(1)), castedThis->globalObject());
    }

    imp->removeRecursively(successCallback, errorCallback);
    return JSValue::encode(jsUndefined());
}
開發者ID:mulriple,項目名稱:Webkit-Projects,代碼行數:28,代碼來源:JSDirectoryEntry.cpp

示例3: RETURN_NULL_IF_FALSE

FileEntry* FileStorage::FindOrCreateFileEntry(const StringRef& path, DirectoryEntry* parent /*= nullptr*/)
{
	if (parent == nullptr)
	{
		parent = &mRootDir;
	}

	FileEntry* fileEntry = nullptr;
	if (Path::IsPath(path))
	{
		List<HeapString> paths;
		RETURN_NULL_IF_FALSE(Path::Split(path, paths));

		DirectoryEntry* dir = parent;
		for (uint i = 0; i < paths.Count() - 1; ++i)
		{
			dir = dir->FindOrCreateDirectoryEntry(paths[i]);
			RETURN_NULL_IF_NULL(dir);
		}

		fileEntry = dir->FindOrCreateFileEntry(paths.Last());
	}
	else
	{
		fileEntry = parent->FindOrCreateFileEntry(path);
	}

	return fileEntry;
}
開發者ID:johndpope,項目名稱:Medusa,代碼行數:29,代碼來源:FileStorage.cpp

示例4: parseAvailableServices

void StreamDialog::parseAvailableServices(QStringList directory)
{
	DirectoryEntry de;
	QString servicePath;
	QString streamName;
	QString streamSource;

	for (int i = 0; i < directory.count(); i++) {
		de.setLine(directory.at(i));

		if (!de.isValid())
			continue;
	
		QStringList services = de.multicastServices();

		for (int i = 0; i < services.count(); i++) {
			servicePath = de.appName() + SYNTRO_SERVICEPATH_SEP + services.at(i);

			SyntroUtils::removeStreamNameFromPath(servicePath, streamSource, streamName);
 
			if (m_currentStreams.contains(streamSource))
				continue;

			if (streamName == SYNTRO_STREAMNAME_AVMUX)
				m_availableStreams.append(streamSource);
		}
	}		
}
開發者ID:robotage,項目名稱:SyntroApps,代碼行數:28,代碼來源:StreamDialog.cpp

示例5: error_code

ErrorOr<Entry *> VFSFromYAML::lookupPath(sys::path::const_iterator Start,
                                         sys::path::const_iterator End,
                                         Entry *From) {
  if (Start->equals("."))
    ++Start;

  // FIXME: handle ..
  if (CaseSensitive ? !Start->equals(From->getName())
                    : !Start->equals_lower(From->getName()))
    // failure to match
    return error_code(errc::no_such_file_or_directory, system_category());

  ++Start;

  if (Start == End) {
    // Match!
    return From;
  }

  DirectoryEntry *DE = dyn_cast<DirectoryEntry>(From);
  if (!DE)
    return error_code(errc::not_a_directory, system_category());

  for (DirectoryEntry::iterator I = DE->contents_begin(),
                                E = DE->contents_end();
       I != E; ++I) {
    ErrorOr<Entry *> Result = lookupPath(Start, End, *I);
    if (Result || Result.getError() != errc::no_such_file_or_directory)
      return Result;
  }
  return error_code(errc::no_such_file_or_directory, system_category());
}
開發者ID:VanirLLVM,項目名稱:toolchain_clang,代碼行數:32,代碼來源:VirtualFileSystem.cpp

示例6: extractLine

 int
 BrepHandler::extractLine(const Pointer& ptr)
 {
   DirectoryEntry* de = _iges->getDirectoryEntry(ptr);
   ParameterData params;
   _iges->getParameter(de->paramData(), params);
   return extractLine(de, params);
 }
開發者ID:cciechad,項目名稱:brlcad,代碼行數:8,代碼來源:BrepHandler.cpp

示例7: getFileIndexSize

WORD RsfsFormatter::getFileIndexSize(const DirectoryEntry& rootDir)
{
	const std::vector<DirectoryEntry>& dirs = rootDir.getDirectories();

	WORD wDataRegionOffset = rootDir.getFiles().size() * RSFS_FILEENTRY_SIZE + dirs.size() * RSFS_DIRECTORYENTRY_SIZE;

	for(std::vector<DirectoryEntry>::const_iterator it = dirs.begin(); it != dirs.end(); it++)
		wDataRegionOffset += getFileIndexSize(*it);
	
	return wDataRegionOffset;
}
開發者ID:JeremyWildsmith,項目名稱:DCPUOS,代碼行數:11,代碼來源:RsfsFormatter.cpp

示例8: getDirectoryEntryCount

int LafsFlat::getDirectoryEntryCount(const DirectoryEntry& dir)
{
	int iEntryCount = 2; //2 for root entry 1 (root directory) + 1 (jump directory)
	std::vector<DirectoryEntry> it = dir.getDirectories();
	
	for(std::vector<DirectoryEntry>::const_iterator it = dir.getDirectories().begin();
		it != dir.getDirectories().end(); 
		it++)
		iEntryCount += getDirectoryEntryCount(*it);

	return iEntryCount;
}
開發者ID:JeremyWildsmith,項目名稱:DCPUOS,代碼行數:12,代碼來源:LafsFlat.cpp

示例9: jsDirectoryEntryPrototypeFunctionCreateReader

EncodedJSValue JSC_HOST_CALL jsDirectoryEntryPrototypeFunctionCreateReader(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSDirectoryEntry::s_info))
        return throwVMTypeError(exec);
    JSDirectoryEntry* castedThis = static_cast<JSDirectoryEntry*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDirectoryEntry::s_info);
    DirectoryEntry* imp = static_cast<DirectoryEntry*>(castedThis->impl());


    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createReader()));
    return JSValue::encode(result);
}
開發者ID:mulriple,項目名稱:Webkit-Projects,代碼行數:13,代碼來源:JSDirectoryEntry.cpp

示例10: queue

            /*!
            *  \brief Enqueue a work descriptor in the readyQueue of the passed thread
            *  \param thread pointer to the thread to which readyQueue the task must be appended
            *  \param wd a reference to the work descriptor to be enqueued
            *  \sa ThreadData, WD and BaseThread
            */
            virtual void queue ( BaseThread *thread, WD &wd )
            {
                ThreadData &data = ( ThreadData & ) *thread->getTeamData()->getScheduleData();
                if ( !data._init ) {
                   data._cacheId = thread->runningOn()->getMemorySpaceId();
                   data._init = true;
                }
                TeamData &tdata = (TeamData &) *thread->getTeam()->getScheduleData();

                if ( wd.isTied() ) {
                    unsigned int index = wd.isTiedTo()->runningOn()->getMemorySpaceId();
                    tdata._readyQueues[index].push_front ( &wd );
                    return;
                }
                if ( wd.getNumCopies() > 0 ){
                   unsigned int numCaches = sys.getCacheMap().getSize();
                   unsigned int ranks[numCaches];
                   for (unsigned int i = 0; i < numCaches; i++ ) {
                      ranks[i] = 0;
                   }
                   CopyData * copies = wd.getCopies();
                   for ( unsigned int i = 0; i < wd.getNumCopies(); i++ ) {
                      if ( !copies[i].isPrivate() ) {
                         WorkDescriptor* parent = wd.getParent();
                         if ( parent != NULL ) {
                            Directory *dir = parent->getDirectory();
                            if ( dir != NULL ) {
                               DirectoryEntry *de = dir->findEntry(copies[i].getAddress());
                               if ( de != NULL ) {
                                  for ( unsigned int j = 0; j < numCaches; j++ ) {
                                     ranks[j]+=((unsigned int)(de->getAccess( j+1 ) > 0))*copies[i].getSize();
                                  }
                               }
                            }
                         }
                      }
                   }
                   unsigned int winner = 0;
                   unsigned int maxRank = 0;
                   for ( unsigned int i = 0; i < numCaches; i++ ) {
                      if ( ranks[i] > maxRank ) {
                         winner = i+1;
                         maxRank = ranks[i];
                      }
                   }
                   tdata._readyQueues[winner].push_front( &wd );
                } else {
                   tdata._readyQueues[0].push_front ( &wd );
                }
            }
開發者ID:robbriggs,項目名稱:masters-project-nanosxx,代碼行數:56,代碼來源:affinity_sched.cpp

示例11: RemoveAllFiles

bool FileStorage::RemoveAllFiles(DirectoryEntry& parent)
{
#ifdef MEDUSA_SAFE_CHECK
	if (parent.Storage() != this)
	{
		Log::AssertFailed("Invalid operate on different storage.");
		return false;
	}
#endif
	auto filesCopy = parent.Files();
	for (auto file : filesCopy)
	{
		RETURN_FALSE_IF_FALSE(RemoveFile(file));
	}
	return true;
}
開發者ID:johndpope,項目名稱:Medusa,代碼行數:16,代碼來源:FileStorage.cpp

示例12: findEntryByNameAndNumber

int DirectoryEntryManager::findEntryByNameAndNumber(const QString &name, const QString &number) const
{
    for (int i = 0; i < m_directory_entries.size(); i++) {
        DirectoryEntry *entry = m_directory_entries[i];
        if (! entry) {
            continue;
        }
        if (entry->name().isEmpty()) {
            continue;
        }
        if (entry->name() == name && entry->number() == number) {
            return i;
        }
    }
    return -1;
}
開發者ID:namjae,項目名稱:xivo-client-qt,代碼行數:16,代碼來源:directory_entry_manager.cpp

示例13: saveLoadOrder

bool PluginList::saveLoadOrder(DirectoryEntry &directoryStructure)
{
  if (m_GamePlugin->loadOrderMechanism() != IPluginGame::LoadOrderMechanism::FileTime) {
    // nothing to do
    return true;
  }

  qDebug("setting file times on esps");

  for (ESPInfo &esp : m_ESPs) {
    std::wstring espName = ToWString(esp.m_Name);
    const FileEntry::Ptr fileEntry = directoryStructure.findFile(espName);
    if (fileEntry.get() != nullptr) {
      QString fileName;
      bool archive = false;
      int originid = fileEntry->getOrigin(archive);
      fileName = QString("%1\\%2").arg(QDir::toNativeSeparators(ToQString(directoryStructure.getOriginByID(originid).getPath()))).arg(esp.m_Name);

      HANDLE file = ::CreateFile(ToWString(fileName).c_str(), GENERIC_READ | GENERIC_WRITE,
                                 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
      if (file == INVALID_HANDLE_VALUE) {
        if (::GetLastError() == ERROR_SHARING_VIOLATION) {
          // file is locked, probably the game is running
          return false;
        } else {
          throw windows_error(QObject::tr("failed to access %1").arg(fileName).toUtf8().constData());
        }
      }

      ULONGLONG temp = 0;
      temp = (145731ULL + esp.m_Priority) * 24 * 60 * 60 * 10000000ULL;

      FILETIME newWriteTime;

      newWriteTime.dwLowDateTime  = (DWORD)(temp & 0xFFFFFFFF);
      newWriteTime.dwHighDateTime = (DWORD)(temp >> 32);
      esp.m_Time = newWriteTime;
      fileEntry->setFileTime(newWriteTime);
      if (!::SetFileTime(file, nullptr, nullptr, &newWriteTime)) {
        throw windows_error(QObject::tr("failed to set file time %1").arg(fileName).toUtf8().constData());
      }

      CloseHandle(file);
    }
  }
開發者ID:TanninOne,項目名稱:modorganizer,代碼行數:45,代碼來源:pluginlist.cpp

示例14: getDirectory

JSValue JSDirectoryEntry::getDirectory(ExecState* exec)
{
    DirectoryEntry* imp = static_cast<DirectoryEntry*>(impl());
    const String& path = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
    if (exec->hadException())
        return jsUndefined();

    int argsCount = exec->argumentCount();
    if (argsCount <= 1) {
        imp->getDirectory(path);
        return jsUndefined();
    }

    RefPtr<Flags> flags;
    if (!exec->argument(1).isNull() && !exec->argument(1).isUndefined() && exec->argument(1).isObject() && !exec->argument(1).inherits(&JSFlags::s_info)) {
        JSObject* object = exec->argument(1).getObject();
        flags = Flags::create();
        JSValue jsCreate = object->get(exec, Identifier(exec, "create"));
        flags->setCreate(jsCreate.toBoolean(exec));
        JSValue jsExclusive = object->get(exec, Identifier(exec, "exclusive"));
        flags->setExclusive(jsExclusive.toBoolean(exec));
    } else
        flags = toFlags(exec->argument(1));
    if (exec->hadException())
        return jsUndefined();
    RefPtr<EntryCallback> successCallback;
    if (exec->argumentCount() > 2 && !exec->argument(2).isNull() && !exec->argument(2).isUndefined()) {
        if (!exec->argument(2).isObject()) {
            setDOMException(exec, TYPE_MISMATCH_ERR);
            return jsUndefined();
        }
        successCallback = JSEntryCallback::create(asObject(exec->argument(2)), globalObject());
    }
    RefPtr<ErrorCallback> errorCallback;
    if (exec->argumentCount() > 3 && !exec->argument(3).isNull() && !exec->argument(3).isUndefined()) {
        if (!exec->argument(3).isObject()) {
            setDOMException(exec, TYPE_MISMATCH_ERR);
            return jsUndefined();
        }
        errorCallback = JSErrorCallback::create(asObject(exec->argument(3)), globalObject());
    }

    imp->getDirectory(path, flags, successCallback, errorCallback);
    return jsUndefined();
}
開發者ID:NewDreamUser2,項目名稱:webkit-webcl,代碼行數:45,代碼來源:JSDirectoryEntryCustom.cpp

示例15: sd_findEntry

void stk500SaveFiles::run() {
    if (this->sourceFile.endsWith('/')) {
        // Saving a full directory
        // First navigate to this directory
        QString dirPath = this->sourceFile;
        dirPath.remove(dirPath.length() - 1, 1);
        QString destDirPath = this->destFile;
        if (destDirPath.endsWith('/')) {
            destDirPath.remove(destDirPath.length() - 1, 1);
        }

        DirectoryEntryPtr dirStartPtr;
        if (dirPath.isEmpty()) {
            dirStartPtr = protocol->sd().getRootPtr();
        } else {
            DirectoryEntryPtr dirEntryPtr = sd_findEntry(dirPath, true, false);
            if (isCancelled()) {
                return;
            }
            if (!dirEntryPtr.isValid()) {
                // Should not happen, but just in case...
                throw ProtocolException("Folder not found");
            }
            DirectoryEntry folderEntry = protocol->sd().readDirectory(dirEntryPtr);
            if (folderEntry.firstCluster()) {
                dirStartPtr = protocol->sd().getDirPtrFromCluster(folderEntry.firstCluster());
            } else {
                dirStartPtr = DirectoryEntryPtr(0, 0);
            }
        }
        saveFolder(dirStartPtr, dirPath, destDirPath, 0.0, 1.0);
    } else {
        // Saving a single file
        DirectoryEntryPtr filePtr = sd_findEntry(this->sourceFile, false, false);
        if (isCancelled()) {
            return;
        }
        if (!filePtr.isValid()) {
            throw ProtocolException("File not found");
        }
        DirectoryEntry fileEntry = protocol->sd().readDirectory(filePtr);
        saveFile(fileEntry, this->sourceFile, this->destFile, 0.0, 1.0);
    }
}
開發者ID:Phoenard,項目名稱:Phoenard-Toolkit,代碼行數:44,代碼來源:stk500savefiles.cpp


注:本文中的DirectoryEntry類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。