ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
FileExpressions Class Reference

Description:

This class implements an ALib Expression Compiler Plugin and thus enables "run-time expressions" to work with nodes of FTree

Unless multithreaded use is planned, an application should create one singleton of this class.

Method CreateFilter creates an object of inner type FileExpressions::Filter, which implements the FFilter interface used with scan parameters of function ScanFiles. This allows run-time evaluation of filter rules, for example rules coming from the command line, from configuration files or from interactive end-user input (hence from an UX/UI).

Of course the expression compiler can also be used directly without using the inner Filter class for evaluation and expressions do not need return a boolean "yes/no" result.

See also
For a quick tutorial, see the Programmer's Manual.

Implemented Expression Features

Compiler plug-in that provides expressions on filesystem entries, stored in nodes of class FTree.

All identifier and function names are defined case insensitive. Furthermore, the tokens are not hard-coded but resourced with ALib Camp singleton alib::FILES. With that, for example language translations might be performed.

Types:


This plug-in introduces the following types to the expression compiler:

Each types are auto-cast to Integer to allow all common operators, especially bitwise boolean operators.

Constants:


Type Name Min. Abbreviation Description
Permissions OwnerRead ore Used test result of function Permission.
Permissions OwnerWrite ow Used test result of function Permission.
Permissions OwnerExecute oe Used test result of function Permission.
Permissions GroupRead gr Used test result of function Permission.
Permissions GroupWrite gw Used test result of function Permission.
Permissions GroupExecute ge Used test result of function Permission.
Permissions OthersRead otr Used test result of function Permission.
Permissions OthersWrite otw Used test result of function Permission.
Permissions OthersExecute ote Used test result of function Permission.
Types Directory dir Used to compare the result of function Type.
Types SymbolicLinkDir sld Used to compare the result of function Type.
Types Regular reg Used to compare the result of function Type.
Types SymbolicLink sl Used to compare the result of function Type.
Types Block block Used to compare the result of function Type.
Types Character character Used to compare the result of function Type.
Types Fifo fifo Used to compare the result of function Type.
Types Socket socket Used to compare the result of function Type.


Constant Constructor Functions:


Return Type Name Min. Abbreviation Signature Description
Integer KiloBytes KB int Returns the given number multiplied with 2^10.
Integer MegaBytes MB int Returns the given number multiplied with 2^20.
Integer GigaBytes GB int Returns the given number multiplied with 2^30.
Integer TeraBytes TB int Returns the given number multiplied with 2^40.
Integer PetaBytes PB int Returns the given number multiplied with 2^50.
Integer ExaBytes EB int Returns the given number multiplied with 2^60.


Functions:


Return Type Name Min. Abbreviation Signature Description
String Name name ./. Returns the file name.
Types Type ty ./. Returns the result of Type.
Boolean IsDirectory isdir ./. Returns the result of IsDirectory.
Boolean IsSymbolicLink issl ./. Returns the result of IsSymbolicLink.
Integer Size size ./. Returns the result of Size.
DateTime Date timestamp ./. Returns the result of MDate.
DateTime MDate md ./. Returns the result of MDate.
DateTime BDate bd ./. Returns the result of BDate.
DateTime CDate cd ./. Returns the result of CDate.
DateTime ATime ad ./. Returns the result of ADate.
Permissions Permissions perm ./. Returns the result of Permissions.
TOwnerAndGroupID Owner owner ./. Returns the result of Owner.
TOwnerAndGroupID Group group ./. Returns the result of Group.
TOwnerAndGroupID UserID uid ./. Returns the current user's ID (calls posix getuid()).
TOwnerAndGroupID GroupID gid ./. Returns the current user's group ID (calls posix getgid()).

Definition at line 111 of file fileexpressions.hpp.

#include <fileexpressions.hpp>

Collaboration diagram for FileExpressions:
[legend]

Inner Type Index:

struct  FexScope
 
class  Filter
 
struct  Plugin
 

Public Field Index:

Compiler compiler
 The expression compiler.
 
Plugin plugin
 The file expression Plugin.
 

Public Method Index:

ALIB_API FileExpressions ()
 Default constructor.
 
ALIB_API SPFileFilter CreateFilter (const String &expressionString)
 

Field Details:

◆ compiler

Compiler compiler

The expression compiler.

Definition at line 180 of file fileexpressions.hpp.

◆ plugin

Plugin plugin

The file expression Plugin.

Definition at line 181 of file fileexpressions.hpp.

Constructor(s) / Destructor Details:

◆ FileExpressions()

Default constructor.

Definition at line 220 of file fileexpressions.cpp.

Here is the call graph for this function:

Method Details:

◆ CreateFilter()

SPFileFilter CreateFilter ( const String & expressionString)

Creates a file filter using the expression compiler of this instance.

Parameters
expressionStringThe expression string to filter files and directories.
Returns
A shared pointer to the dynamically allocated filter object.

Definition at line 228 of file fileexpressions.cpp.


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