Anklang 0.3.0-460-gc4ef46ba
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 get_folder () const override;
19 void set_folder (const Resource &newfolder) override;
20 ResourceS get_entries () const override;
21 void set_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:191
ResourceS list_entries()
List all entries in the current folder.
Definition crawler.cc:37
String2 assign(const String &utf8path, bool existingfile) override
Definition crawler.hh:26
String expand_fsdir(const String &fsdir)
Expand directory name (file system encoding) to absolute folder path.
Definition crawler.cc:77
Resource current_folder()
Return the current folder.
Definition crawler.cc:91
Resource get_folder() const override
Describe current folder.
Definition crawler.cc:108
String2 assign_(const String &utf8path, bool existingfile, bool notify=true)
Open a new folder and make it the current folder.
Definition crawler.cc:133
ResourceS get_entries() const override
List entries of a folder.
Definition crawler.cc:120
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:227
Implementation type for classes with Property interfaces.
Definition object.hh:41
Helper to crawl hierarchical resources.
Definition api.hh:368
#define ASE_DEFINE_MAKE_SHARED(CLASS)
Definition cxxaux.hh:269
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:359