12#if ( defined(__GLIBCXX__) \
13 || defined(__APPLE__) \
14 || defined(__ANDROID_NDK__) ) && !defined(ALIB_TESTSTDFS)
31 #define ES ExpressionScope
32 #define FS dynamic_cast<FileExpressions::FexScope&>(scope)
33 #define AI ArgIterator
36 #define INTARG0 args->Unbox<integer>()
37 Box getType (ES& scope, AI , AI) {
return VAL->Type(); }
38 Box isDirectory(ES& scope, AI , AI) {
return VAL->IsDirectory(); }
39 Box isSymLink (ES& scope, AI , AI) {
return VAL->IsSymbolicLink(); }
40 Box getSize (ES& scope, AI , AI) {
return integer(VAL->Size()); }
41 Box getTime (ES& scope, AI , AI) {
return VAL->MDate(); }
42 Box getBTime (ES& scope, AI , AI) {
return VAL->BDate(); }
43 Box getCTime (ES& scope, AI , AI) {
return VAL->CDate(); }
44 Box getATime (ES& scope, AI , AI) {
return VAL->ADate(); }
45 Box getPerms (ES& scope, AI , AI) {
return VAL->Perms(); }
46 Box getOwner (ES& scope, AI , AI) {
return VAL->Owner(); }
47 Box getGroup (ES& scope, AI , AI) {
return VAL->Group(); }
48#if ( (defined(__GLIBCXX__) && !defined(__MINGW32__)) \
49 || defined(__APPLE__) \
50 || defined(__ANDROID_NDK__) ) && !defined(ALIB_TESTSTDFS)
57 Box kiloBytes (ES& , AI args, AI) {
return INTARG0 *
integer(1024); }
58 Box megaBytes (ES& , AI args, AI) {
return INTARG0 *
integer(1024) *
integer(1024); }
65#if ALIB_PATH_CHARACTERS_WIDE == ALIB_CHARACTERS_WIDE
66 Box getName (ES& scope, AI , AI) {
return NODE.Name(); }
67 Box getPath (ES& scope, AI , AI) {
return FS.ParentPath; }
70 Box getName (ES& scope, AI , AI) {
return String(scope.Allocator,
String256(NODE.Name() )); }
71 Box getPath (ES& scope, AI , AI) {
return String(scope.Allocator,
String256(FS.ParentPath)); }
81 extern Box constOwnRead ;
Box constOwnRead ;
82 extern Box constOwnWrite ;
Box constOwnWrite;
83 extern Box constOwnExec ;
Box constOwnExec ;
84 extern Box constGrpRead ;
Box constGrpRead ;
85 extern Box constGrpWrite ;
Box constGrpWrite;
86 extern Box constGrpExec ;
Box constGrpExec ;
87 extern Box constOthRead ;
Box constOthRead ;
88 extern Box constOthWrite ;
Box constOthWrite;
89 extern Box constOthExec ;
Box constOthExec ;
91 extern Box constTDirectory ;
Box constTDirectory ;
92 extern Box constTSymbolicLinkDir ;
Box constTSymbolicLinkDir;
93 extern Box constTRegular ;
Box constTRegular ;
94 extern Box constTSymbolicLink ;
Box constTSymbolicLink ;
95 extern Box constTBlock ;
Box constTBlock ;
96 extern Box constTCharacter ;
Box constTCharacter ;
97 extern Box constTFifo ;
Box constTFifo ;
98 extern Box constTSocket ;
Box constTSocket ;
100 extern Box TypeUsrGrpID ;
Box TypeUsrGrpID ;
102#if ALIB_CHARACTERS_WIDE
118 constOwnRead = FInfo::Permissions::OWNER_READ ;
140 constexpr int tableSize= 39;
141 Token functionNames[tableSize];
145 Token* descriptor= functionNames;
147#if ALIB_CHARACTERS_WIDE
160 { *descriptor++, constOwnRead },
161 { *descriptor++, constOwnWrite },
162 { *descriptor++, constOwnExec },
163 { *descriptor++, constGrpRead },
164 { *descriptor++, constGrpWrite },
165 { *descriptor++, constGrpExec },
166 { *descriptor++, constOthRead },
167 { *descriptor++, constOthWrite },
168 { *descriptor++, constOthExec },
170 { *descriptor++, constTDirectory },
171 { *descriptor++, constTSymbolicLinkDir },
172 { *descriptor++, constTRegular },
173 { *descriptor++, constTSymbolicLink },
174 { *descriptor++, constTBlock },
175 { *descriptor++, constTCharacter },
176 { *descriptor++, constTFifo },
177 { *descriptor++, constTSocket },
238, scope( pFex.compiler.CfgFormatter )
241 if( !
expression->ResultType().IsType<
bool>() )
242 throw std::runtime_error(
"Expression result type mismatch: expecting boolean result!" );
virtual ALIB_API Expression Compile(const String &expressionString)
ALIB_API void AddType(Type sample, const NString &name)
ALIB_API void SetupDefaults()
static constexpr TOwnerAndGroupID UnknownID
Constant value for owner and group IDs to denote that the field was not determined.
uint32_t TOwnerAndGroupID
Type definition for owner and group ids.
@ GROUP_READ
< S_IRWXU File owner has read, write, and execute/search permissions Equivalent to owner_read | owner...
@ GROUP_EXEC
< S_IWGRP The file's user group has write permission
@ OTHERS_EXEC
S_IXOTH Other users have execute/search permission.
@ GROUP_WRITE
< S_IRGRP The file's user group has read permission
@ OWNER_EXEC
< S_IWUSR File owner has write permission
@ OWNER_WRITE
< S_IRUSR File owner has read permission
@ OTHERS_READ
< S_IRWXG The file's user group has read, write, and execute/search permissions Equivalent to group_r...
@ OTHERS_WRITE
S_IWOTH Other users have write permission.
@ DIRECTORY
Directory/folder.
@ CHARACTER
A character special file.
@ BLOCK
A block special file.
@ FIFO
A FIFO (also known as pipe) file.
FileExpressions & fex
The scope used with this filter.
Expression expression
The compiled expression.
Plugin plugin
The file expression Plugin.
Compiler compiler
The expression compiler.
ALIB_API FileExpressions()
Default constructor.
ALIB_API SPFileFilter CreateFilter(const String &expressionString)
const String & GetResource(const NString &name)
void InsertPlugin(TPlugin *plugin, lang::Responsibility responsibility=lang::Responsibility::KeepWithSender)
static ALIB_API void LoadResourcedTokens(lang::resources::ResourcePool &resourcePool, const NString &resourceCategory, const NString &resourceName, strings::util::Token *target, int dbgSizeVerifier, character outerSeparator=',', character innerSeparator=' ')
#define CALCULUS_DEFAULT_AUTOCAST
#define CALCULUS_CALLBACK(func)
#define CALCULUS_SIGNATURE(BoxPointerArray)
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
std::shared_ptr< FFilter > SPFileFilter
A shared pointer to a filter.
This is the reference documentation of sub-namespace system of module ALib BaseCamp.
files::FilesCamp FILES
The singleton instance of ALib Camp class FilesCamp.
strings::TString< character > String
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
static ALIB_API Box * I[1]
Function accepts one integral argument.
static ALIB_API Box DateTime
Sample type-box for date and time values of type DateTime).
static ALIB_API Box Integer
Sample type-box for integer types. (Precisely for type integer.)
static ALIB_API Box Boolean
Sample type-box for C++ type bool.
static ALIB_API Box String
std::vector< ConstantIdentifierEntry > ConstantIdentifiers
List of identifiers that return constant values to be compiled by this plug-in.
std::vector< FunctionEntry > Functions
List of functions to be compiled by this plug-in.
static constexpr CTInvokable ETI
std::vector< AutoCastEntry > AutoCasts
List of auto-casts to be compiled by this plug-in.
static constexpr CTInvokable CTI