Anklang-0.3.0.dev797+g4e3241f3 anklang-0.3.0.dev797+g4e3241f3
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
crawler.hh
Go to the documentation of this file.
1 // This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
2#ifndef __ASE_CRAWLER_HH__
3#define __ASE_CRAWLER_HH__
4
5#include <ase/gadget.hh>
6
7namespace Ase {
8
10class FileCrawler final : public ObjectImpl, public virtual ResourceCrawler {
11 String cwd_;
12 const uint constraindir_ : 1;
13 [[maybe_unused]]
14 const uint constrainfile_ : 1;
15 FileCrawler (const String &cwd, bool constraindir = false, bool constrainfile = false);
16protected:
17 String2 assign_ (const String &utf8path, bool existingfile, bool notify = true);
18 Resource folder () const override;
19 void folder (const Resource &newfolder) override;
20 ResourceS entries () const override;
21 void entries (const ResourceS &newentries) override;
22public:
24 ResourceS list_entries ();
26 String2 assign (const String &utf8path,
27 bool existingfile) override { return assign_ (utf8path, existingfile, true); }
28 Resource canonify (const String &utf8cwd, const String &utf8fragment, bool constraindir, bool constrainfile) override;
29 String canonify_fspath (const String &fspath, const String &fsfragment, bool constraindir, bool constrainfile);
30 String expand_fsdir (const String &fsdir);
31};
32
33} // Ase
34
35#endif // __ASE_CRAWLER_HH__
Class implementing a file system crawler.
Definition crawler.hh:10
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.
Definition crawler.cc:189
ResourceS list_entries()
List all entries in the current folder.
Definition crawler.cc:35
String2 assign(const String &utf8path, bool existingfile) override
Move to a different path.
Definition crawler.hh:26
String expand_fsdir(const String &fsdir)
Expand directory name (file system encoding) to absolute folder path.
Definition crawler.cc:75
Resource current_folder()
Return the current folder.
Definition crawler.cc:89
String2 assign_(const String &utf8path, bool existingfile, bool notify=true)
Open a new folder and make it the current folder.
Definition crawler.cc:131
ResourceS entries() const override
List entries of a folder.
Definition crawler.cc:118
Resource folder() const override
Describe current folder.
Definition crawler.cc:106
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.
Definition crawler.cc:225
Implementation type for classes with Property interfaces.
Definition object.hh:41
Helper to crawl hierarchical resources.
Definition api.hh:362
#define ASE_DEFINE_MAKE_SHARED(CLASS)
Define a member function static shared_ptr<CLASS> make_shared(ctorargs...);.
Definition cxxaux.hh:274
The Anklang C++ API namespace.
Definition api.hh:9
uint32_t uint
Provide 'uint' as convenience type.
Definition cxxaux.hh:18
Description of a resource, possibly nested.
Definition api.hh:353