17 "FILETREE",
"Given node is not a directory or symbolic link." )
21 "FILETREE",
"Error in symbolic link parameter" )
25 bool isAllocated= v.GetExtendedInfo();
27 auto pool= node.Tree<
FTree>().Pool();
45 v.SetLinkTarget( node.Tree<
FTree>(), symLinkDest, symLinkRealPath);
55 v.SetLinkTarget( node.Tree<
FTree>(), symLinkDest, symLinkRealPath);
91 if( node.data.custom ) {
95 "CustomData not deleted before destruction of class FTree.\n"
96 " First node found: {}.\n"
97 " Attached data type: {}" , path, node.data.dbgCustomType )
122 ALIB_ASSERT_ERROR( file ==
nullptr || &file->AsCursor().Tree() ==
this,
"FILETREE",
"Given file does not belong to this FTree." )
123 ALIB_ASSERT_ERROR( subTree ==
nullptr || subTree->IsValid() ,
"FILETREE",
"Invalid cursor given." )
124 ALIB_ASSERT_ERROR( subTree ==
nullptr || &subTree ->Tree() ==
this,
"FILETREE",
"Given cursor does not belong to this FTree." )
130 (file ? file->AsCursor().Export() : ConstCursorHandle()),
131 (subTree ? subTree-> Export() : ConstCursorHandle()),
136 listeners.back().pathPrefix << pathPrefix;
137 listeners.back().pathSubstring<< pathSubstring;
144 if( it->listener == listener
145 && it->event == event
146 && it->file == ( file ? file->AsCursor().Export() : ConstCursorHandle() )
147 && it->subTree == ( subTree ? subTree ->Export() : ConstCursorHandle() )
148 && it->fileName .Equals( fileName )
149 && it->pathPrefix .Equals( pathPrefix )
150 && it->pathSubstring.Equals( pathSubstring ) )
156 ALIB_WARNING(
"FILETREE",
"Listener with matching set of parameters not found with deregistration.")
168 if( it->listener == listener ) {
176 Log_If(cnt==0, Verbosity::Warning,
"No listener found to be removed." )
187 if( event == it->event ) {
190 && ( it->fileName .IsNotEmpty()
191 || it->pathPrefix .IsNotEmpty()
192 || it->pathSubstring.IsNotEmpty() ) )
195 : file.
AsCursor().Parent() ).AssemblePath(filePathBuffer);
196 filePath= &filePathBuffer;
199 if( ( it->file .IsValid() && ( it->file == file.
AsCursor().Export() ) )
201 || ( it->fileName .IsNotEmpty() && it->fileName.Equals(file.
AsCursor().Name()) )
202 || ( it->pathPrefix .IsNotEmpty() && filePath->
StartsWith(it->pathPrefix) )
203 || ( it->pathSubstring.IsNotEmpty() && filePath->
IndexOf(it->pathSubstring) >= 0 )
206 Log_Verbose(
"Notifying listener. Event=", event == FTreeListener::Event::CreateNode
207 ?
"CreateNode" :
"DeleteNode" )
208 it->listener->Notify( file, event );
216 "FILETREE",
"Given node is not a directory." )
220 directory.GoToFirstChild();
221 while( directory.IsValid()) {
227 directory.GoToNextSibling();
234#if ALIB_DEBUG && !DOXYGEN
237 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");
244 if( startNode.IsInvalid() )
250DOX_MARKER( [DOX_FILETREE_ITERATION])
259 if( includedTypes.
Test(stit.
Node()->Type()))
263DOX_MARKER( [DOX_FILETREE_ITERATION])
#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)
constexpr ExtendedEntryInfo * GetExtendedInfo() const
constexpr DirectorySums & Sums() const
OwnerAndGroupResolver ogResolver
void registerListener(FTreeListener *listener, lang::ContainerOp insertOrRemove, FTreeListener::Event event, const FTFile *file, const StringTree::Cursor *subTree, const PathString &fileName, const PathString &pathPrefix, const PathString &pathSubstring)
FTree(MonoAllocator &allocator)
NumberFormat numberFormat
void notifyListeners(FTreeListener::Event event, FTFile &file, const PathString &filePath)
int MonitorStop(FTreeListener *listener)
static void FixSums(Cursor directory)
ListMA< ListenerRecord > listeners
The list of registered listeners.
constexpr bool Test(TInterface bit) noexcept
constexpr bool IsEmpty() const
integer IndexOf(TChar needle, integer startIdx=0) const
bool StartsWith(const TString &needle) const
@ DIRECTORY
Directory/folder.
constexpr Types Type() const noexcept
constexpr bool IsDirectory() const noexcept
This namespace implements internals of namespace #"alib::filetree;2".
AString & DbgDump(AString &target, FTree &tree, EnumBitSet< FileStatus::Types > includedTypes=EnumBitSet< FileStatus::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.
@ Include
Chooses inclusion.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
format::Formatter Formatter
Type alias in namespace #"%alib".
filetree::FilesCamp FILETREE
The singleton instance of ALib Camp class #"FilesCamp".
strings::TString< character > String
Type alias in namespace #"%alib".
system::Path Path
Type alias in namespace #"%alib".
strings::TAString< PathCharType, PoolAllocator > PathStringPA
A pool-allocated string representing a path.
strings::TString< PathCharType > PathString
The string-type used with this ALib Module.
lang::TBitSet< TEnum, enumops::IterableTraits< TEnum >::End, enumops::IterableTraits< TEnum >::Begin > EnumBitSet
filetree::FTFile FTFile
Type alias in namespace #"%alib".
constexpr PathCharType DIRECTORY_SEPARATOR
The standard path separator character. Defaults to '\' on Windows OS, '/' else.
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, FTValue, FTreeNodeHandler >::Cursor &node, const PathString &symLinkDest, const PathString &symLinkRealPath)