Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Private Member Functions | Friends | List of all members
dart::bin::AsyncDirectoryListing Class Reference

#include <directory.h>

Inheritance diagram for dart::bin::AsyncDirectoryListing:
dart::bin::ReferenceCounted< AsyncDirectoryListing > dart::bin::DirectoryListing

Public Types

enum  Response {
  kListFile = 0 , kListDirectory = 1 , kListLink = 2 , kListError = 3 ,
  kListDone = 4
}
 

Public Member Functions

 AsyncDirectoryListing (Namespace *namespc, const char *dir_name, bool recursive, bool follow_links)
 
virtual bool HandleDirectory (const char *dir_name)
 
virtual bool HandleFile (const char *file_name)
 
virtual bool HandleLink (const char *file_name)
 
virtual bool HandleError ()
 
virtual void HandleDone ()
 
void SetArray (CObjectArray *array, intptr_t length)
 
intptr_t index () const
 
- Public Member Functions inherited from dart::bin::ReferenceCounted< AsyncDirectoryListing >
 ReferenceCounted ()
 
virtual ~ReferenceCounted ()
 
void Retain ()
 
void Release ()
 
- Public Member Functions inherited from dart::bin::DirectoryListing
 DirectoryListing (Namespace *namespc, const char *dir_name, bool recursive, bool follow_links)
 
virtual ~DirectoryListing ()
 
virtual bool HandleDirectory (const char *dir_name)=0
 
virtual bool HandleFile (const char *file_name)=0
 
virtual bool HandleLink (const char *link_name)=0
 
virtual bool HandleError ()=0
 
virtual void HandleDone ()
 
void Push (DirectoryListingEntry *directory)
 
void Pop ()
 
bool IsEmpty () const
 
void PopAll ()
 
Namespacenamespc () const
 
DirectoryListingEntrytop () const
 
bool recursive () const
 
bool follow_links () const
 
const char * CurrentPath ()
 
PathBufferpath_buffer ()
 
bool error () const
 

Private Member Functions

virtual ~AsyncDirectoryListing ()
 

Friends

class ReferenceCounted< AsyncDirectoryListing >
 

Detailed Description

Definition at line 156 of file directory.h.

Member Enumeration Documentation

◆ Response

Enumerator
kListFile 
kListDirectory 
kListLink 
kListError 
kListDone 

Definition at line 159 of file directory.h.

Constructor & Destructor Documentation

◆ AsyncDirectoryListing()

dart::bin::AsyncDirectoryListing::AsyncDirectoryListing ( Namespace namespc,
const char *  dir_name,
bool  recursive,
bool  follow_links 
)
inline

Definition at line 167 of file directory.h.

173 array_(nullptr),
174 index_(0),
175 length_(0) {}
Namespace * namespc() const
Definition: directory.h:133
DirectoryListing(Namespace *namespc, const char *dir_name, bool recursive, bool follow_links)
Definition: directory.h:93

Member Function Documentation

◆ HandleDirectory()

bool dart::bin::AsyncDirectoryListing::HandleDirectory ( const char *  dir_name)
virtual

Implements dart::bin::DirectoryListing.

Definition at line 397 of file directory.cc.

397 {
398 return AddFileSystemEntityToResponse(kListDirectory, dir_name);
399}

◆ HandleDone()

void dart::bin::AsyncDirectoryListing::HandleDone ( )
virtual

Reimplemented from dart::bin::DirectoryListing.

Definition at line 409 of file directory.cc.

409 {
410 AddFileSystemEntityToResponse(kListDone, nullptr);
411}

◆ HandleError()

bool dart::bin::AsyncDirectoryListing::HandleError ( )
virtual

Implements dart::bin::DirectoryListing.

Definition at line 413 of file directory.cc.

413 {
414 CObject* err = CObject::NewOSError();
415 array_->SetAt(index_++, new CObjectInt32(CObject::NewInt32(kListError)));
416 CObjectArray* response = new CObjectArray(CObject::NewArray(3));
417 response->SetAt(0, new CObjectInt32(CObject::NewInt32(kListError)));
418 // Delay calling CurrentPath() until after CObject::NewOSError() in case
419 // CurrentPath() pollutes the OS error code.
420 response->SetAt(1, new CObjectString(CObject::NewString(
421 error() ? "Invalid path" : CurrentPath())));
422 response->SetAt(2, err);
423 array_->SetAt(index_++, response);
424 return index_ < length_;
425}
void SetAt(intptr_t index, CObject *value)
Definition: dartutils.h:548
static Dart_CObject * NewString(const char *str)
Definition: dartutils.cc:927
static Dart_CObject * NewArray(intptr_t length)
Definition: dartutils.cc:936
static Dart_CObject * NewInt32(int32_t value)
Definition: dartutils.cc:902
static CObject * NewOSError()
Definition: dartutils.cc:1038
const char * CurrentPath()
Definition: directory.h:141

◆ HandleFile()

bool dart::bin::AsyncDirectoryListing::HandleFile ( const char *  file_name)
virtual

Implements dart::bin::DirectoryListing.

Definition at line 401 of file directory.cc.

401 {
402 return AddFileSystemEntityToResponse(kListFile, file_name);
403}

◆ HandleLink()

bool dart::bin::AsyncDirectoryListing::HandleLink ( const char *  file_name)
virtual

Implements dart::bin::DirectoryListing.

Definition at line 405 of file directory.cc.

405 {
406 return AddFileSystemEntityToResponse(kListLink, link_name);
407}

◆ index()

intptr_t dart::bin::AsyncDirectoryListing::index ( ) const
inline

Definition at line 190 of file directory.h.

190{ return index_; }

◆ SetArray()

void dart::bin::AsyncDirectoryListing::SetArray ( CObjectArray array,
intptr_t  length 
)
inline

Definition at line 183 of file directory.h.

183 {
184 ASSERT(length % 2 == 0);
185 array_ = array;
186 index_ = 0;
187 length_ = length;
188 }
#define ASSERT(E)
size_t length

◆ ~AsyncDirectoryListing()

virtual dart::bin::AsyncDirectoryListing::~AsyncDirectoryListing ( )
inlineprivatevirtual

Definition at line 193 of file directory.h.

193{}

Friends And Related Function Documentation

◆ ReferenceCounted< AsyncDirectoryListing >

friend class ReferenceCounted< AsyncDirectoryListing >
friend

Definition at line 197 of file directory.h.


The documentation for this class was generated from the following files: