8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Configuration MACRO ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
17#if !defined ( _WIN32 )
27 import ALib.Characters.Functions;
31 import ALib.ALox.Impl;
34 import ALib.Expressions;
69 "FILES",
"Given node is not a directory or symbolic link." )
73 "FILES",
"Error in symbolic link parameter" )
77 bool isAllocated= v.GetExtendedInfo();
79 auto pool= node.Tree<
FTree>().Pool();
97 v.SetLinkTarget( node.Tree<
FTree>(), symLinkDest, symLinkRealPath);
107 v.SetLinkTarget( node.Tree<
FTree>(), symLinkDest, symLinkRealPath);
143 if( node.data.custom ) {
147 "CustomData not deleted before destruction of class FTree.\n"
148 " First node found: {}.\n"
149 " Attached data type: {}" , path, node.data.dbgCustomType )
174 ALIB_ASSERT_ERROR( file ==
nullptr || &file->AsCursor().Tree() ==
this,
"FILES",
"Given file does not belong to this FTree." )
175 ALIB_ASSERT_ERROR( subTree ==
nullptr || subTree->IsValid() ,
"FILES",
"Invalid cursor given." )
176 ALIB_ASSERT_ERROR( subTree ==
nullptr || &subTree ->Tree() ==
this,
"FILES",
"Given cursor does not belong to this FTree." )
182 (file ? file->AsCursor().Export() : ConstCursorHandle()),
183 (subTree ? subTree-> Export() : ConstCursorHandle()),
188 listeners.back().pathPrefix << pathPrefix;
189 listeners.back().pathSubstring<< pathSubstring;
196 if( it->listener == listener
197 && it->event == event
198 && it->file == ( file ? file->AsCursor().Export() : ConstCursorHandle() )
199 && it->subTree == ( subTree ? subTree ->Export() : ConstCursorHandle() )
200 && it->fileName .Equals( fileName )
201 && it->pathPrefix .Equals( pathPrefix )
202 && it->pathSubstring.Equals( pathSubstring ) )
208 ALIB_WARNING(
"FILES",
"Listener with matching set of parameters not found with deregistration.")
220 if( it->listener == listener ) {
228 Log_If(cnt==0, Verbosity::Warning,
"No listener found to be removed." )
239 if( event == it->event ) {
242 && ( it->fileName .IsNotEmpty()
243 || it->pathPrefix .IsNotEmpty()
244 || it->pathSubstring.IsNotEmpty() ) )
247 : file.
AsCursor().Parent() ).AssemblePath(filePathBuffer);
248 filePath= &filePathBuffer;
251 if( ( it->file .IsValid() && ( it->file == file.
AsCursor().Export() ) )
253 || ( it->fileName .IsNotEmpty() && it->fileName.Equals(file.
AsCursor().Name()) )
254 || ( it->pathPrefix .IsNotEmpty() && filePath->
StartsWith(it->pathPrefix) )
255 || ( it->pathSubstring.IsNotEmpty() && filePath->
IndexOf(it->pathSubstring) >= 0 )
258 Log_Verbose(
"Notifying listener. Event=", event == FTreeListener::Event::CreateNode
259 ?
"CreateNode" :
"DeleteNode" )
260 it->listener->Notify( file, event );
268 "FILES",
"Given node is not a directory." )
272 directory.GoToFirstChild();
273 while( directory.IsValid()) {
274 FInfo& v= *directory;
279 directory.GoToNextSibling();
286#if ALIB_DEBUG && !DOXYGEN
289 A_CHAR(
"{:ta h{2,r} on{10,r} gn{10,r} s(IEC){10,r} dm qqq FxFa (rd{3r}' D' rf{3r}' F' re{2r}' EA' rb{2r}'BL) 'nx l b }\n");
296 if( startNode.IsInvalid() )
311 if( includedTypes.
Test(stit.
Node()->Type()))
#define ALIB_ALLOW_SPARSE_ENUM_SWITCH
#define ALIB_WARNING(domain,...)
#define ALIB_ERROR(domain,...)
#define ALIB_LOCK_RECURSIVE_WITH(lock)
#define ALIB_POP_ALLOWANCE
#define ALIB_ASSERT_ERROR(cond, domain,...)
#define Log_SetDomain(...)
void SetMaxDepth(unsigned int newMaxDepth=(std::numeric_limits< unsigned >::max)())
void Initialize(CursorType startNode, lang::Inclusion includeStartNode)
void SetPathGeneration(lang::Switch pathGeneration)
Cursor ImportCursor(CursorHandle handle)
Cursor createCursor(baseNode &node)
void DbgSetDCSName(const char *name) const
StringTree(AllocatorType &allocator, CharacterType pathSeparator)
void ConstructRootValue(TArgs &&... args)
The entry type which is embedded in each tree node.
constexpr Types Type() const noexcept
constexpr ExtendedEntryInfo * GetExtendedInfo() const
constexpr bool IsDirectory() const noexcept
@ DIRECTORY
Directory/folder.
constexpr DirectorySums & Sums() const
FTree(MonoAllocator &allocator)
NumberFormat numberFormat
OwnerAndGroupResolver ogResolver
void notifyListeners(FTreeListener::Event event, const File &file, const system::PathString &filePath)
int MonitorStop(FTreeListener *listener)
void registerListener(FTreeListener *listener, lang::ContainerOp insertOrRemove, FTreeListener::Event event, const File *file, const StringTree::Cursor *subTree, const system::PathString &fileName, const system::PathString &pathPrefix, const system::PathString &pathSubstring)
ListMA< ListenerRecord > listeners
The list of registered listeners.
static void FixSums(Cursor directory)
constexpr bool Test(TInterface bit) noexcept
constexpr bool IsEmpty() const
integer IndexOf(TChar needle, integer startIdx=0) const
bool StartsWith(const TString &needle) const
This namespace implements internals of namespace #"alib::files;2".
AString & DbgDump(AString &target, FTree &tree, EnumBitSet< FInfo::Types > includedTypes=EnumBitSet< FInfo::Types >(true), FTree::Cursor startNode=FTree::Cursor(), unsigned depth=(std::numeric_limits< unsigned int >::max)())
ContainerOp
Denotes standard container operations.
@ Insert
Denotes insertions.
@ Off
Switch it off, switched off, etc.
@ Exclude
Chooses exclusion.
strings::TString< PathCharType > PathString
The string-type used with this ALib Module.
strings::TAString< PathCharType, PoolAllocator > PathStringPA
A pool-allocated string representing a path.
constexpr PathCharType DIRECTORY_SEPARATOR
The standard path separator character. Defaults to '\' on Windows OS, '/' else.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
format::Formatter Formatter
Type alias in namespace alib.
files::File File
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
system::Path Path
Type alias in namespace alib.
lang::TBitSet< TEnum, enumops::IterableTraits< TEnum >::End, enumops::IterableTraits< TEnum >::Begin > EnumBitSet
files::FilesCamp FILES
The singleton instance of ALib Camp class #"FilesCamp".
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
containers::StringTreeIterator< TTree > StringTreeIterator
Type alias in namespace alib.
HashTable< TAllocator, typename NodeKey::ValueDescriptor, typename NodeKey::Hash, typename NodeKey::EqualTo, lang::Caching::Enabled, TRecycling > nodeTable
Recursively accumulated values for directories.
std::array< uint32_t, size_t(Types::MARKER_TYPES_END)> TypeCounters
Per-type counters.
Event
The type of change that imposes the notification of a listener.
Record used to manage registered listeners.
static void AllocateExtendedInfo(StringTree< MonoAllocator, FInfo, detail::FTreeNodeHandler >::Cursor &node, const system::PathString &symLinkDest, const system::PathString &symLinkRealPath)