|
Pol
Revision:cb584c9
|
#include <fileaccess.h>
Public Member Functions | |
| FileAccess (Clib::ConfigElem &elem) | |
| bool | AllowsAccessTo (const Plib::Package *pkg, const Plib::Package *filepackage) const |
| bool | AppliesToPackage (const Plib::Package *pkg) const |
| bool | AppliesToPath (const std::string &path, const Plib::Package *filepkg) const |
| size_t | estimateSize () const |
Public Attributes | |
| bool | AllDirectories |
| bool | AllExtensions |
| bool | AllowAppend |
| bool | AllowRead |
| bool | AllowRemote |
| bool | AllowWrite |
| bool | AllPackages |
| std::vector< std::pair< const Plib::Package *, std::string > > | Directories |
| std::vector< std::string > | Extensions |
| std::set< const Plib::Package * > | Packages |
Definition at line 29 of file fileaccess.h.
|
explicit |
I'm thinking that, if anything, I'd want to present a VERY simple, high-level interface.
So no seeking / reading / writing. Something more like this:
WriteFile and AppendToFile would accept either a string or an array of lines. The string would be written verbatim, while the array of lines would be written with newlines appended.
WriteFile would be atomic for existing files - it would write a new file to a temporary location, then do the rename-rename-delete thing.
LogToFile would take a string as input, and append a newline. It's the equivalent of AppendToFile( filename, array { text } )
Probably a systemwide configuration file would dictate the types of files allowed to be written, and perhaps even name the packages allowed to do so. I could see a use for being able to write .src files, for example. And I'm having thoughts of integrating compile capability directly into pol, and adding something like CompileScript( scriptpath ) to polsys.em
config/fileaccess.cfg
Definition at line 112 of file filemod.cpp.
References AllDirectories, AllExtensions, AllPackages, Directories, ERROR_PRINT, Extensions, Pol::Plib::find_package(), Packages, Pol::Plib::pkgdef_split(), and Pol::Clib::ConfigElem::remove_prop().
Referenced by estimateSize().
| bool Pol::Module::FileAccess::AllowsAccessTo | ( | const Plib::Package * | pkg, |
| const Plib::Package * | filepackage | ||
| ) | const |
Definition at line 159 of file filemod.cpp.
References AllowRemote.
| bool Pol::Module::FileAccess::AppliesToPackage | ( | const Plib::Package * | pkg | ) | const |
Definition at line 170 of file filemod.cpp.
References AllPackages, and Packages.
| bool Pol::Module::FileAccess::AppliesToPath | ( | const std::string & | path, |
| const Plib::Package * | filepkg | ||
| ) | const |
Definition at line 184 of file filemod.cpp.
References AllDirectories, AllExtensions, Directories, Extensions, Pol::Clib::stringicmp(), and Pol::Clib::strip_one().
| size_t Pol::Module::FileAccess::estimateSize | ( | ) | const |
Definition at line 242 of file filemod.cpp.
References Directories, Extensions, FileAccess(), and Packages.
| bool Pol::Module::FileAccess::AllDirectories |
Definition at line 45 of file fileaccess.h.
Referenced by AppliesToPath(), and FileAccess().
| bool Pol::Module::FileAccess::AllExtensions |
Definition at line 46 of file fileaccess.h.
Referenced by AppliesToPath(), and FileAccess().
| bool Pol::Module::FileAccess::AllowAppend |
Definition at line 39 of file fileaccess.h.
| bool Pol::Module::FileAccess::AllowRead |
Definition at line 40 of file fileaccess.h.
| bool Pol::Module::FileAccess::AllowRemote |
Definition at line 42 of file fileaccess.h.
Referenced by AllowsAccessTo().
| bool Pol::Module::FileAccess::AllowWrite |
Definition at line 38 of file fileaccess.h.
| bool Pol::Module::FileAccess::AllPackages |
Definition at line 44 of file fileaccess.h.
Referenced by AppliesToPackage(), and FileAccess().
| std::vector<std::pair<const Plib::Package*, std::string> > Pol::Module::FileAccess::Directories |
Definition at line 49 of file fileaccess.h.
Referenced by AppliesToPath(), estimateSize(), and FileAccess().
| std::vector<std::string> Pol::Module::FileAccess::Extensions |
Definition at line 50 of file fileaccess.h.
Referenced by AppliesToPath(), estimateSize(), and FileAccess().
| std::set<const Plib::Package*> Pol::Module::FileAccess::Packages |
Definition at line 48 of file fileaccess.h.
Referenced by AppliesToPackage(), estimateSize(), and FileAccess().