Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
Ase::FileCrawler Class Referencefinal

Class implementing a file system crawler. More...

#include "crawler.hh"

Inheritance diagram for Ase::FileCrawler:
[legend]

Public Member Functions

 ASE_DEFINE_MAKE_SHARED (FileCrawler)
 
ResourceS list_entries ()
 List all entries in the current folder.
 
Resource current_folder ()
 Return the current folder.
 
String2 assign (const String &utf8path, bool existingfile) override
 
Resource canonify (const String &utf8cwd, const String &utf8fragment, bool constraindir, bool constrainfile) override
 Canonify a UTF-8 path name, optionally constraining it to a folder or file.
 
String canonify_fspath (const String &fspath, const String &fsfragment, bool constraindir, bool constrainfile)
 Canonify a path (file system encoding), optionally constraining it to a directory or file.
 
String expand_fsdir (const String &fsdir)
 Expand directory name (file system encoding) to absolute folder path.
 
- Public Member Functions inherited from Ase::EmittableImpl
ASE_USE_RESULT Connection on_event (const String &eventselector, const EventHandler &eventhandler) override
 
void emit_event (const String &type, const String &detail, const ValueR fields={}) override
 
void emit_notify (const String &detail) override
 Emit notify:detail, multiple notifications maybe coalesced if a CoalesceNotifies instance exists.
 
- Public Member Functions inherited from Ase::Emittable
void js_trigger (const String &eventselector, JsTrigger callback)
 
- Public Member Functions inherited from std::enable_shared_from_this< SharedBase >
enable_shared_from_this (T... args)
 
operator= (T... args)
 
shared_from_this (T... args)
 
weak_from_this (T... args)
 
~enable_shared_from_this (T... args)
 

Protected Member Functions

String2 assign_ (const String &utf8path, bool existingfile, bool notify=true)
 Open a new folder and make it the current folder.
 
Resource get_folder () const override
 Describe current folder.
 
void set_folder (const Resource &newfolder) override
 
ResourceS get_entries () const override
 List entries of a folder.
 
void set_entries (const ResourceS &newentries) override
 

Additional Inherited Members

- Public Types inherited from Ase::ResourceCrawler
using String2 = std::pair< String, String >
 
- Public Attributes inherited from Ase::Emittable
const EventHandlereventhandler
 
- Public Attributes inherited from Ase::ResourceCrawler
Member<&ResourceCrawler::get_folder,&ResourceCrawler::set_folder > folder
 The folder currently being browsed, UTF-8 encoded.
 
Member<&ResourceCrawler::get_entries,&ResourceCrawler::set_entries > entries
 The entries in the current folder, UTF-8 encoded.
 

Detailed Description

Class implementing a file system crawler.

Definition at line 10 of file crawler.hh.

Member Function Documentation

◆ assign()

String2 Ase::FileCrawler::assign ( const String utf8path,
bool  existingfile 
)
overridevirtual

Move to a different path.

Implements Ase::ResourceCrawler.

Definition at line 26 of file crawler.hh.

References assign_().

◆ assign_()

FileCrawler::String2 Ase::FileCrawler::assign_ ( const String utf8path,
bool  existingfile,
bool  notify = true 
)
protected

◆ canonify()

Resource Ase::FileCrawler::canonify ( const String utf8cwd,
const String utf8fragment,
bool  constraindir,
bool  constrainfile 
)
overridevirtual

Canonify a UTF-8 path name, optionally constraining it to a folder or file.

Implements Ase::ResourceCrawler.

Definition at line 227 of file crawler.cc.

References Ase::decodefs(), Ase::displayfs(), Ase::encodefs(), Ase::string_endswith(), and Ase::Resource::type.

◆ canonify_fspath()

String Ase::FileCrawler::canonify_fspath ( const String fspath,
const String fsfragment,
bool  constraindir,
bool  constrainfile 
)

Canonify a path (file system encoding), optionally constraining it to a directory or file.

Definition at line 191 of file crawler.cc.

References std::filesystem::path::filename(), std::filesystem::path::is_absolute(), std::filesystem::path::lexically_normal(), std::filesystem::path::parent_path(), and std::filesystem::path::relative_path().

◆ current_folder()

Resource Ase::FileCrawler::current_folder ( )

Return the current folder.

Definition at line 91 of file crawler.cc.

References Ase::displayfs(), Ase::encodefs(), lstat(), stat(), and Ase::Resource::type.

Referenced by get_folder().

◆ expand_fsdir()

String Ase::FileCrawler::expand_fsdir ( const String fsdir)

Expand directory name (file system encoding) to absolute folder path.

Definition at line 77 of file crawler.cc.

References Ase::anklang_runpath(), std::string::empty(), and Ase::string_toupper().

◆ get_entries()

ResourceS Ase::FileCrawler::get_entries ( ) const
overrideprotectedvirtual

List entries of a folder.

Implements Ase::ResourceCrawler.

Definition at line 120 of file crawler.cc.

References list_entries().

◆ get_folder()

Resource Ase::FileCrawler::get_folder ( ) const
overrideprotectedvirtual

Describe current folder.

Implements Ase::ResourceCrawler.

Definition at line 108 of file crawler.cc.

References current_folder().

◆ list_entries()

ResourceS Ase::FileCrawler::list_entries ( )

List all entries in the current folder.

Definition at line 37 of file crawler.cc.

References closedir(), dirfd(), Ase::displayfs(), Ase::encodefs(), errno(), fstatat(), opendir(), readdir(), return_unless, std::string::size(), ssize_t, stat(), strerror(), and Ase::Resource::type.

Referenced by get_entries().

◆ set_entries()

void Ase::FileCrawler::set_entries ( const ResourceS &  newentries)
overrideprotectedvirtual

Implements Ase::ResourceCrawler.

Definition at line 126 of file crawler.cc.

◆ set_folder()

void Ase::FileCrawler::set_folder ( const Resource newfolder)
overrideprotectedvirtual

Implements Ase::ResourceCrawler.

Definition at line 114 of file crawler.cc.


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