当前位置: 首页>>代码示例>>C++>>正文


C++ DirEntry类代码示例

本文整理汇总了C++中DirEntry的典型用法代码示例。如果您正苦于以下问题:C++ DirEntry类的具体用法?C++ DirEntry怎么用?C++ DirEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DirEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: copyFtr

bool copyFtr( const Path& src, const Path &tgt )
{
   VFSProvider* file = Engine::getVFS("file");
   fassert( file != 0 );
   DirEntry *entry = file->openDir( src.getFullLocation() );
   if( entry == 0 )
   {
      warning( "Can't open directory " + src.getFullLocation() );
      return false;
   }

   String fname;
   String module = src.getFile();
   Path orig( src );
   Path target( tgt );

   while( entry->read( fname ) )
   {
      if( fname.startsWith( module ) && fname.endsWith( ".ftt" ) )
      {
         orig.setFilename( fname );
         target.setFilename( fname );
         if( ! copyFile( orig.get(), target.get() ) )
         {
            warning( "Can't copy source FTT file " + orig.get() );
         }
      }
   }

   entry->close();
   delete entry;

   return true;
}
开发者ID:Klaim,项目名称:falcon,代码行数:34,代码来源:falpack.cpp

示例2: InitCheck

/*!	\brief Returns the next entry belonging to the directory.
    \param foundItem Pointer to a pre-allocated Item that shall be set
           to the found item.
    \param entryIndex Pointer to a pre-allocated int32 that shall be set
           to the found entry index.
    \param _entry Pointer to a pre-allocated DirEntry pointer that shall be set
           to the found entry. May be \c NULL.
    \return \c B_OK, if everything went fine, \c B_ENTRY_NOT_FOUND, if we're
            through.
*/
status_t
DirEntryIterator::GetNext(DirItem *foundItem, int32 *entryIndex,
                          DirEntry **_entry)
{
    status_t error = (foundItem && entryIndex ? InitCheck() : B_BAD_VALUE);
    // get the next DirItem, if necessary
    // the loop skips empty DirItems gracefully
    while (error == B_OK
           && (fIndex < 0 || fIndex >= fDirItem.GetEntryCount())) {
        error = fItemIterator.GetNext(&fDirItem, TYPE_DIRENTRY);
        if (error == B_OK) {
            if (fDirItem.Check() == B_OK)
                fIndex = 0;
            else	// bad data: skip the item
                fIndex = -1;
        }
    }
    // get the next entry and check whether it has the correct offset
    if (error == B_OK) {
        DirEntry *entry = fDirItem.EntryAt(fIndex);
        if (!fFixedHash
            || offset_hash_value(entry->GetOffset())
               == offset_hash_value(GetOffset())) {
            *foundItem = fDirItem;
            *entryIndex = fIndex;
            if (_entry)
                *_entry = entry;
            fIndex++;
        } else
            error = B_ENTRY_NOT_FOUND;
    }
    return error;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:43,代码来源:Iterators.cpp

示例3: addDirsAsGroups

static void addDirsAsGroups(Directory *root,GroupDef *parent,int level)
{
  GroupDef *gd=0;
  if (root->kind()==DirEntry::Dir)
  {
    gd = new GroupDef("[generated]",
                      1,
                      root->path(), // name
                      root->name()  // title
                     );
    if (parent) 
    {
      parent->addGroup(gd);
      gd->makePartOfGroup(parent);
    }
    else
    {
      Doxygen::groupSDict->append(root->path(),gd);
    }
  }
  QListIterator<DirEntry> dli(root->children());
  DirEntry *de;
  for (dli.toFirst();(de=dli.current());++dli)
  {
    if (de->kind()==DirEntry::Dir)
    {
      addDirsAsGroups((Directory *)de,gd,level+1);
    }
  }
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例4: writeDirTreeNode

static void writeDirTreeNode(QTextStream &t,Directory *root,int level)
{
  QCString indent;
  indent.fill(' ',level*2);
  QListIterator<DirEntry> dli(root->children());
  DirEntry *de;
  for (dli.toFirst();(de=dli.current());++dli)
  {
    t << indent << "<p>";
    generateIndent(t,de,0);
    if (de->kind()==DirEntry::Dir)
    {
      Directory *dir=(Directory *)de;
      //printf("%s [dir]: %s (last=%d,dir=%d)\n",indent.data(),dir->name().data(),dir->isLast(),dir->kind()==DirEntry::Dir);
      t << "<img " << FTV_IMGATTRIBS(folderclosed) << "/>";
      t << dir->name();
      t << "</p>\n";
      t << indent << "<div>\n";
      writeDirTreeNode(t,dir,level+1);
      t << indent << "</div>\n";
    }
    else
    {
      //printf("%s [file]: %s (last=%d,dir=%d)\n",indent.data(),de->file()->name().data(),de->isLast(),de->kind()==DirEntry::Dir);
      t << "<img " << FTV_IMGATTRIBS(doc) << "/>";
      t << de->file()->name();
      t << "</p>\n";
    }
  }
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例5: iterator

// _VerifyHashFunction
bool
Volume::_VerifyHashFunction(hash_function_t function)
{
    bool result = true;
    // iterate over the entries in the root dir until we find an entry, that
    // doesn't falsify the hash function
    DirEntryIterator iterator(fTree, fRootVNode->GetDirID(),
                              fRootVNode->GetObjectID(), DOT_DOT_OFFSET + 1);
    DirItem item;
    int32 index = 0;
    while (iterator.GetNext(&item, &index) == B_OK) {
        DirEntry *entry = item.EntryAt(index);
        uint64 offset = entry->GetOffset();
        // try the hash function
        size_t nameLen = 0;
        if (const char *name = item.EntryNameAt(index, &nameLen)) {
            uint64 testOffset = key_offset_for_name(function, name, nameLen);
            if (offset_hash_value(offset) != offset_hash_value(testOffset)) {
                result = false;
                break;
            }
        } // else: bad data
    }
    return result;
}
开发者ID:mmanley,项目名称:Antares,代码行数:26,代码来源:Volume.cpp

示例6: Directory

void Path::GetAllFiles(std::vector<std::string> &files,
                       const std::string &path,
                       const std::string &filter)
{
    Directory* pDir = new Directory();
    DirEnumerator* pDirEnum;

    result r = pDir->Construct(path.c_str());
    if (r != E_SUCCESS)
    {
        AppLog(GetErrorMessage(r));
        delete pDir;
        return;
    }

    pDirEnum = pDir->ReadN();

    while (pDirEnum->MoveNext() == E_SUCCESS)
    {
        DirEntry entry = pDirEnum->GetCurrentDirEntry();

        if (entry.IsDirectory())
            continue;

        Path fileName(StringUtils::ToNarrow(entry.GetName().GetPointer()));

        if (fileName.GetExt() == filter.substr(filter.size() - 3))
        {
            files.push_back(fileName.GetFilenameExt());
        }
    }

    delete pDir;
    delete pDirEnum;
}
开发者ID:asmCode,项目名称:PixItAllTizen,代码行数:35,代码来源:Path.cpp

示例7: lg2

int DirPage::deleteRecords(Where *where, int* attrType, int numOfAttr){
    if(DEcount == 0){
        lg2("@DirPage_"<<pageid<<" : No Records to delete.");
        return 0;
    }
    DataPage* datapage;

    long noOfRecs = 0;

    long dataPid;

    long maxTFS;

    DirEntry *de;
    //	dirEntries;
    for(vector<DirEntry*>::size_type i = 0;
            i<dirEntries.size() ; i++){
        //create DataPage for every entry and try retreiving records.
        de = dirEntries[i];
        dataPid = de->getPageID();
        datapage = new DataPage(dataPid);
        noOfRecs += datapage->deleteRecords(where,attrType,numOfAttr);
        maxTFS = datapage->getTotalFreeSize();
        de->setTFS(maxTFS);
        if(maxSpaceAvailable < maxTFS)
            maxSpaceAvailable = maxTFS;
        de->writeDE(p,i);
        writeToPage();
        delete datapage;
    }
    return noOfRecs;

}
开发者ID:lkshminarayanan,项目名称:OurSQL,代码行数:33,代码来源:DirPage.cpp

示例8: init

 void
 init(const DirEntry & src)
 {
   name = src.name();
   kind = src.kind();
   size = src.size();
   hasProps = src.hasProps();
   createdRev = src.createdRev();
   time = src.time();
   lastAuthor = src.lastAuthor();
   lockToken = src.lockToken();
   lockOwner = src.lockOwner();
   lockComment = src.lockComment();
 }
开发者ID:RapidSVN,项目名称:RapidSVN,代码行数:14,代码来源:dirent.cpp

示例9: DirEntry

FhgfsOpsErr MovingDirInsertMsgEx::insert()
{
   MetaStore* metaStore = Program::getApp()->getMetaStore();
   
   FhgfsOpsErr retVal;
   
   EntryInfo* toDirInfo = this->getToDirInfo();

   // reference parent
   DirInode* parentDir = metaStore->referenceDir(toDirInfo->getEntryID(), true);
   if(!parentDir)
      return FhgfsOpsErr_PATHNOTEXISTS;

   /* create dir-entry and add information about its inode from the given buffer */

   std::string newName = this->getNewName();
   const char* buf = this->getSerialBuf();
   DirEntry* newDirEntry = new DirEntry(newName);
   if (!newDirEntry->deserializeDentry(buf) )
   {
      LogContext("File rename").logErr("Bug: Deserialization of remote buffer failed. Are all "
         "meta servers running with the same version?" );
      delete newDirEntry;

      metaStore->releaseDir(toDirInfo->getEntryID() );

      return FhgfsOpsErr_INTERNAL;
   }

   FhgfsOpsErr mkRes = parentDir->makeDirEntry(newDirEntry);
   
   switch(mkRes)
   {
      case FhgfsOpsErr_SUCCESS:
      case FhgfsOpsErr_EXISTS:
         retVal = mkRes;
         break;

      default:
         retVal = FhgfsOpsErr_INTERNAL;
         break;
   }
   
   // clean-up
   metaStore->releaseDir(toDirInfo->getEntryID() );

   return retVal;
}
开发者ID:NingLeixueR,项目名称:BeeGFS,代码行数:48,代码来源:MovingDirInsertMsgEx.cpp

示例10: xmBadaReaddir

XMDirent* xmBadaReaddir ( XMDir* dirp )
{
    XMDirent*    ret = 0;

    if ( dirp->dir_enum->MoveNext ( ) == E_SUCCESS )
    {
        DirEntry    entry = dirp->dir_enum->GetCurrentDirEntry ( );
        String      name  = entry.GetName ( );
        ByteBuffer* utf8  = StringUtil::StringToUtf8N ( name );

        strcpy ( (KDchar *) dirp->dir_info.d_name, (const KDchar *) utf8->GetPointer ( ) );
        ret = &dirp->dir_info;
    }

    return ret;
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:16,代码来源:bada_file.c

示例11: getRoot

DirEntry* VirtualFileSystem::fromPath(const char* path) {
    DirEntry* root = getRoot();

    // we loop over each subfolder in the path
    while (true) {
        // first we skip as many slashes as we can
        while (*path == '/')
            path++;

        // then we get the length of the current folder, this is the length until the next / or the end
        int length = 0;
        while (path[length] != '/' && path[length] != '\0')
            length++;

        // if the length is zero, this was a trailing slash and we can stop here
        if (length == 0)
            break;

        // we get the folder name
        std::string cur(path, length);

        // and then try to find the directory that matches
        bool matched = false;
        while (root->valid()) {
            if (root->name() == cur) {
                auto next = root->openDir();
                delete root;
                root = next;
                matched = true;
                break;
            }
            root->advance();
        }

        if (!matched) {
            delete root;
            return nullptr;
        }

        path += length;
        if (*path == '\0')
            break;
    }

    return root;
}
开发者ID:citiral,项目名称:olliOS,代码行数:46,代码来源:virtualfilesystem.cpp

示例12: error

DataPage* DirPage::createDataPage(){
    //create a datapage.
    //get tfs and store it in DE
    if(DEcount == MAX_DE){
        error("No Free space to insert DE");
        return NULL;
    }
    DataPage *dp = new DataPage();
    long pid = dp->getPageid();
    long tfs = dp->getTotalFreeSize();
    DirEntry *de = new DirEntry(pid,tfs);
    dirEntries.push_back(de);
    de->writeDE(p,DEcount);
    DEcount++;
    if(tfs>maxSpaceAvailable)
        maxSpaceAvailable = tfs;
    writeToPage();
    return dp;
}
开发者ID:lkshminarayanan,项目名称:OurSQL,代码行数:19,代码来源:DirPage.cpp

示例13: AppLog

void ZLbadaPaintContext::collectFiles(std::map<std::string, std::string> &names, const char* path ) {
   //TODO collectFiles
     AppLog("ZLbadaPaintContext::collectFiles") ;
    Directory dir;
    DirEnumerator *pDirEnum = null;
    result r = E_SUCCESS;

    // Opens the directory
    r = dir.Construct(path);
     AppLog(" dir.Construct %s",path) ;
    if(IsFailed(r))  AppLog("IsFailed");

       //goto CATCH;

    // Reads all the directory entries
    pDirEnum = dir.ReadN();
  //  if(!pDirEnum)
  //      goto CATCH;
    while(pDirEnum->MoveNext() == E_SUCCESS)
    {
        DirEntry dirEntry = pDirEnum->GetCurrentDirEntry();
        Tizen::Base::String str = dirEntry.GetName();
       // AppLog("dirEntry name Length = %d",str.GetLength()) ;
        Utf8Encoding utf8;
       	ByteBuffer* pBB = utf8.GetBytesN(str);
        std::string  shortName((const char*)pBB->GetPointer());//,str.GetLength());
        AppLog("dirEntry name = %s",shortName.c_str()) ;
        if (shortName !="." && shortName !="..")	{
        	std::string fullName;
        	fullName = path + shortName;
        	AppLog("fullName = %s",fullName.c_str());
        	names.insert(std::make_pair(shortName,fullName));
        }
        delete pBB;
       // names.push_back(shortName);
    }

    // Deletes the enumerator
    delete pDirEnum;

    AppLog("Succeeded");
}
开发者ID:temper8,项目名称:FBReader-Tizen,代码行数:42,代码来源:ZLbadaPaintContext.cpp

示例14: FindVNode

/*!	\brief Searches an entry in a directory.

    \note Must not be called with \a entryName "." or ".."!

    \param dir The directory.
    \param entryName Name of the entry.
    \param foundNode pointer to a pre-allocated VNode to be initialized to
           the found entry.
    \param failIfHidden The method shall fail, if the entry is hidden.
    \return \c B_OK, if everything went fine.
*/
status_t
Volume::FindDirEntry(VNode *dir, const char *entryName, VNode *foundNode,
                     bool failIfHidden)
{
    status_t error = (dir && foundNode ? B_OK : B_BAD_VALUE);
    // find the DirEntry
    DirItem item;
    int32 entryIndex = 0;
    if (error == B_OK) {
        error = fTree->FindDirEntry(dir->GetDirID(), dir->GetObjectID(),
                                    entryName, &item, &entryIndex);
    }
    // find the child node
    if (error == B_OK) {
        DirEntry *entry = item.EntryAt(entryIndex);
        error = FindVNode(entry->GetDirID(), entry->GetObjectID(), foundNode);
        if (error == B_OK && failIfHidden && entry->IsHidden())
            error = B_ENTRY_NOT_FOUND;
    }
    return error;
}
开发者ID:mmanley,项目名称:Antares,代码行数:32,代码来源:Volume.cpp

示例15: lock

void CacheBase::FillReadDir(const char* path, void *buf, fuse_fill_dir_t filler,
            off_t offset, struct fuse_file_info *fi)
{
    BlockLockMutex lock(this);
    DirEntry* dir = dynamic_cast<DirEntry*>(Path2File(path));

    if(!dir)
        throw NoSuchFileOrDir();

    FileMap files = dir->GetFiles();
    for(FileMap::const_iterator it = files.begin(); it != files.end(); ++it)
    {
        if(it->second->IsRemoved())
            continue;

        struct stat st;
        memset(&st, 0, sizeof st);
        /*st.st_ino = de->d_ino;
        st.st_mode = de->d_type << 12;*/

        if(filler(buf, it->second->GetName().c_str(), &st, 0))
            break;
    }
}
开发者ID:TheArboreProject,项目名称:Arbore-DHT,代码行数:24,代码来源:cache_base.cpp


注:本文中的DirEntry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。