15#if !defined ( _WIN32 )
36 "FILES",
"Given node is not a directory or symbolic link.")
40 "FILES",
"Error in symbolic link parameter" )
59 v.SetLinkTarget( node.
Tree<
FTree>(), symLinkDest, symLinkRealPath);
66 v.SetLinkTarget( node.
Tree<
FTree>(), symLinkDest, symLinkRealPath);
86, listeners ( allocator )
104 if( node.data.custom )
109 "CustomData not deleted before destruction of class FTree.\n"
110 " First node found: {}.\n"
111 " Attached data type: {}" , path, node.data.dbgCustomType )
137 ALIB_ASSERT_ERROR( file ==
nullptr || &file->AsCursor().Tree() ==
this,
"FILES",
"Given file does not belong to this FTree.")
139 ALIB_ASSERT_ERROR( subTree ==
nullptr || &subTree ->Tree() ==
this ,
"FILES",
"Given cursor does not belong to this FTree.")
152 listeners.Back().pathPrefix << pathPrefix;
153 listeners.Back().pathSubstring<< pathSubstring;
160 if( it->listener == listener
161 && it->event == event
164 && it->fileName .Equals( fileName )
165 && it->pathPrefix .Equals( pathPrefix )
166 && it->pathSubstring.Equals( pathSubstring ) )
172 ALIB_WARNING(
"FILES",
"Listener with matching set of parameters not found with deregistration." )
185 if( it->listener == listener )
194 Log_If(cnt==0, Verbosity::Warning,
"No listener found to be removed.")
207 if( event == it->event )
211 && ( it->fileName .IsNotEmpty()
212 || it->pathPrefix .IsNotEmpty()
213 || it->pathSubstring.IsNotEmpty() ) )
216 (file.AsCursor().IsRoot() ? file.AsCursor()
217 : file.AsCursor().Parent() )
218 .AssemblePath(filePathBuffer);
220 filePath= &filePathBuffer;
223 if( ( it->file .IsValid() && ( it->file == file.AsCursor().Export() ) )
224 || ( it->subTree .IsValid() && ( file.AsCursor().Distance(
ImportCursor(it->subTree) ) >= 0 ) )
225 || ( it->fileName .IsNotEmpty() && it->fileName.Equals(file.AsCursor().Name()) )
226 || ( it->pathPrefix .IsNotEmpty() && filePath->
StartsWith(it->pathPrefix) )
227 || ( it->pathSubstring.IsNotEmpty() && filePath->
IndexOf(it->pathSubstring) >= 0 )
231 ?
"CreateNode" :
"DeleteNode" )
232 it->listener->Notify( file, event );
242 "FILES",
"Given node is not a directory.")
249 FInfo& v= *directory;
262#if ALIB_DEBUG && !DOXYGEN
265 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) 'nf l}\n");
289 if( includedTypes.
Test(rit.
Node()->Type()))
strings::TAString< typename cmTree::CharacterType, lang::HeapAllocator > & AssemblePath(strings::TAString< typename cmTree::CharacterType, lang::HeapAllocator > &targetString, lang::CurrentData targetData=lang::CurrentData::Clear) const
void Initialize(cmTree &pTree, unsigned int depth=(std::numeric_limits< unsigned int >::max)())
void SetPathGeneration(lang::Switch pathGeneration)
void ConstructRootValue(TArgs &&... args)
Cursor createCursor(baseNode &node)
void DbgSetDCSName(const char *name) const
Cursor ImportCursor(CursorHandle handle)
The entry type which is embedded in each tree node.
constexpr DirectorySums & Sums() const
constexpr ExtendedEntryInfo * GetExtendedInfo() const
constexpr bool IsDirectory() const noexcept
constexpr Types Type() const noexcept
@ DIRECTORY
Directory/folder.
NumberFormat numberFormat
ALIB_API ~FTree()
Destructor.
ALIB_API int MonitorStop(FTreeListener *listener)
List< MonoAllocator, ListenerRecord > listeners
The list of registered listeners.
ALIB_API FTree(MonoAllocator &allocator)
ALIB_API void notifyListeners(FTreeListener::Event event, File &file, SharedLock *lock, const lang::system::PathString &filePath)
static ALIB_API void FixSums(Cursor directory)
ALIB_API void registerListener(FTreeListener *listener, lang::ContainerOp insertOrRemove, FTreeListener::Event event, const File *file, const StringTree::Cursor *subTree, const lang::system::PathString &fileName, const lang::system::PathString &pathPrefix, const lang::system::PathString &pathSubstring)
constexpr bool Test(TInterface bit) noexcept
integer IndexOf(TChar needle, integer startIdx=0) const
constexpr bool IsEmpty() const
bool StartsWith(const TString &needle) const
ALIB_API void AcquireShared(ALIB_DBG_TAKE_CI)
ALIB_API void ReleaseShared(ALIB_DBG_TAKE_CI)
#define ALIB_WARNING(...)
#define IF_ALIB_THREADS(...)
#define ALIB_WARNINGS_RESTORE
#define ALIB_WARNINGS_ALLOW_SPARSE_ENUM_SWITCH
#define ALIB_LOCK_RECURSIVE_WITH(lock)
#define ALIB_ASSERT_ERROR(cond,...)
#define Log_SetDomain(...)
#define ALIB_CALLER_PRUNED
ALIB_API AString & DbgDump(AString &target, FTree &tree, EnumBitSet< FInfo::Types > includedTypes=EnumBitSet< FInfo::Types >(true), FTree::Cursor startNode=FTree::Cursor(), unsigned int depth=(std::numeric_limits< unsigned int >::max)())
This is the reference documentation of sub-namespace system of module ALib BaseCamp.
strings::TAString< PathCharType, PoolAllocator > PathStringPA
A pool-allocated string representing a path.
static constexpr PathCharType DIRECTORY_SEPARATOR
The standard path separator character. Defaults to '\' on Windows OS, '/' else.
@ Off
Switch it off, switched off, etc.
ContainerOp
Denotes standard container operations.
@ Insert
Denotes insertions.
files::File File
Type alias in namespace alib.
files::FilesCamp FILES
The singleton instance of ALib Camp class FilesCamp.
A handle type used with methods TCursor::Export and ImportCursor.
HashTable< TAllocator, typename NodeKey::ValueDescriptor, typename NodeKey::Hash, typename NodeKey::EqualTo, lang::Caching::Enabled, TRecycling > nodeTable
Recursively accumulated values for directories.
uint32_t TypeCounters[int(Types::MARKER_TYPES_END)]
Per-type counters.
Event
The type of change that imposes the notification of a listener.
@ CreateNode
A file or directory entry was created.
Record used to manage registered listeners.
static ALIB_API void AllocateExtendedInfo(StringTree< MonoAllocator, FInfo, detail::FTreeNodeHandler >::Cursor &node, const lang::system::PathString &symLinkDest, const lang::system::PathString &symLinkRealPath)