4strings::TAString<PathCharType>&
8 static constexpr int STACK_SIZE= 256;
9 FTree::CursorHandle nStack[STACK_SIZE];
21 while( !actNode.IsRoot() ) {
23 if(sp == STACK_SIZE) {
29 auto parentNode= actNode;
33 if(nStack[i] == actNode.Export())
37 auto parent= parentNode.Parent();
40 nStack[sp++]= parent.Export();
41 actNode=
FTFile(parent.Parent());
44 nStack[sp++]= actNode.Export();
50 FTree::ConstCursorHandle ch = nStack[sp];
52 if( !actual.IsRoot() ) {
55 target << actual.Name();
65 int perms= int(Value().Perms());
77 "This method is not compatible due to changes in the permission enumeration." );
80 std::array<char, 9> result;
81 std::array<char, 3> chars = {
'r',
'w',
'x'};
85 result[charIdx]= perms & bit ? chars[charIdx % 3] :
'-';
115 while (
format.IsNotEmpty() ) {
127 while (
format.ConsumeChar(c) )
136 auto& value= Value();
144 case 'a' : toBeAdded= Name();
break;
145 case 's' : toBeAdded=
Stem();
break;
146 case 'e' : toBeAdded=
Extension();
break;
151 toBeAdded= pathBuffer;
157 toBeAdded= pathBuffer;
162 ALIB_WARNING(
"ALIB",
"Format Error: Token 'n' followed by unknown "
163 "specifier '{}' in FTFile::Format.", c )
164 target <<
"Format Error: Token 'n' followed by unknown specifier '" << c
165 <<
"' in FTFile::Format.";
173 toBeAdded= strBuffer;
180 else toBeAdded= value.Type();
190 strBuffer <<
" -> " << value.GetLinkTarget();
191 if( value.GetRealLinkTarget().IsNotEmpty()
192 && !value.GetLinkTarget().Equals( value.GetRealLinkTarget()) )
193 strBuffer <<
" (" << value.GetRealLinkTarget() <<
")";
194 toBeAdded= strBuffer;
200 if(value.symParent != 0) {
202 pathBuffer <<
" <- ";
204 toBeAdded= pathBuffer;
211 case 'x' : toBeAdded= (value.IsCrossingFS() ?
'm' :
'-') ;
break;
212 case 'a' : toBeAdded= (value.IsArtificialFS() ?
'm' :
'-') ;
break;
215 ALIB_WARNING(
"ALIB",
"Format Error: Unknown character {} after "
216 "token 'f' in FTFile::Format.", c )
217 target <<
"Format Error: Unknown character '" << c
218 <<
"' after token 'f' in FTFile::Format.";
224 if( value.QtyHardLinks() != uint32_t(-1) ) toBeAdded= value.QtyHardLinks();
225 else toBeAdded=
"-1";
230 else toBeAdded= value.ScanState();
237 case 'm' : date= value.MDate();
break;
238 case 'b' : date= value.BDate();
break;
239 case 'c' : date= value.CDate();
break;
240 case 'a' : date= value.ADate();
break;
244 "Format Error: Unknown character {} after token 'd' "
245 "in FTFile::Format.", c )
246 target <<
"Format Error: Unknown character '" << c
247 <<
"' after token 'd' in FTFile::Format.";
253 dateFormat=
A_CHAR(
"dd. MMM yyyy HH:mm");
254 date.
Format( dateFormat, strBuffer );
255 toBeAdded= strBuffer;
261 bool automaticMode =
true;
262 auto unit = ByteSizeUnits::IEC;
265 if(
format.CharAtStart() ==
'(' ) {
268 unit= ByteSizeUnits::SI;
275 automaticMode=
false;
278 if(
format.ConsumeChar() !=
')' ) {
280 "Format Error: Expected closing brace ')' after unit specification with token 's'." )
281 target <<
"Format Error: Expected closing brace ')' after unit specification with token 's'.";
286 if( !automaticMode ) {
290 if( unit==ByteSizeUnits::B || unit ==ByteSizeUnits::B_SI )
293 strBuffer <<
alib::Dec( dval , 0, ftreeNF);
298 toBeAdded= strBuffer;
305 bool isOwner= c==
'o';
308 if( c !=
'i' && c !=
'n' ) {
310 "Format Error: Expected 'i' or 'n' specifier after token 'o' and 'g'."
312 target <<
"Format Error: Expected 'i' or 'n' specifier after token 'o' and 'g'."
313 " Given: '" << c <<
"'";
316 bool isName= (c ==
'n');
320 toBeAdded= isOwner ? resolver.GetOwnerName(value)
321 : resolver.GetGroupName(value);
323 strBuffer << (isOwner ? value.Owner() : value.Group());
324 toBeAdded= strBuffer;
334 if( !value.IsDirectory()
350 "Format Error: Token 'r' followed by unknown specifier '{}' "
351 "in FTFile::Format", c )
352 target <<
"Format Error: Token 'r' followed by unknown specifier '" << c
353 <<
"'in FTFile::Format";
374 ALIB_WARNING(
"ALIB",
"Format Error: Missing single Quote" )
375 target <<
"Format Error: Missing closing single quote character <'>" ;
393 if(
format.CharAtStart() ==
'{' ) {
398 if(
format.ConsumeChar() !=
'}' ) {
400 "Format Error: Expected closing brace '}' with field specifier {width/alignment}." )
401 target <<
"Format Error: Expected closing brace '}' with field specifier {width/alignment}.";
404 target <<
Field( toBeAdded, width, alignment );
411 target.
ToUpper(previousLength);
#define ALIB_WARNING(domain,...)
Cursor ImportCursor(CursorHandle handle)
strings::TAString< PathCharType > & AssembleRealPath(strings::TAString< PathCharType > &target, lang::Inclusion includeFilename) const
AString & Format(Substring format, AString &target, lang::CurrentData targetData=lang::CurrentData::Keep, NumberFormat *numberFormat=nullptr) const
FTFile()=default
Defaulted default constructor.
strings::TAString< PathCharType > & AssembleSymbolicPath(strings::TAString< PathCharType > &target, lang::Inclusion includeFilename) const
FTFile GetSymbolicParent()
AString & FormatAccessRights(AString &target) const
PathString Extension() const
FTree::ConstCursor ConstCursor
The constant version of type #".Cursor".
NumberFormat & GetNumberFormat()
const OwnerAndGroupResolver & GetOGResolver() const
TAString & InsertChars(TChar c, integer qty)
TAString & ToUpper(integer regionStart=0, integer regionLength=MAX_LEN)
TAString & _(const TAppendable &src)
void DbgDisableBufferReplacementWarning()
constexpr integer Length() const
constexpr bool IsEmpty() const
constexpr bool IsNotEmpty() const
AString & Format(Substring format, AString &target, lang::CurrentData targetData=lang::CurrentData::Keep) const
@ GROUP_READ
Posix S_IRGRP: The file's user group has read permission.
@ GROUP_EXEC
Posix S_IXGRP: The file's user group has execute/search permission.
@ OTHERS_EXEC
Posix S_IXOTH: Other users have execute/search permission.
@ GROUP_WRITE
Posix S_IWGRP: The file's user group has write permission.
@ OWNER_READ
Posix S_IRUSR: File owner has read permission.
@ OWNER_EXEC
Posix S_IXUSR: File owner has execute/search permission.
@ OWNER_WRITE
Posix S_IWUSR: File owner has write permission.
@ OTHERS_READ
Posix S_IROTH: Other users have read permission.
@ OTHERS_WRITE
Posix S_IWOTH: Other users have write permission.
@ RECURSIVE
Follow symlink target strings.
@ RESOLVED
Read symlink target strings.
bool Parse(strings::TSubstring< TChar > &input, TEnum &result)
void FFormat_File(const Box &box, const String &formatSpec, NumberFormat &nf, AString &target)
Alignment
Denotes Alignments.
@ Right
Chooses right alignment.
@ Keep
Chooses not no clear existing data.
@ Clear
Chooses to clear existing data.
Inclusion
Denotes how members of a set something should be taken into account.
@ Exclude
Chooses exclusion.
@ Include
Chooses inclusion.
strings::TNumberFormat< character > NumberFormat
Type alias in namespace #"%alib".
filetree::FilesCamp FILETREE
The singleton instance of ALib Camp class #"FilesCamp".
lang::integer integer
Type alias in namespace #"%alib".
boxing::Box Box
Type alias in namespace #"%alib".
strings::TField< character > Field
Type alias in namespace #"%alib".
LocalString< 4096 > String4K
Type alias name for #"TLocalString;TLocalString<character,4096>".
strings::TString< character > String
Type alias in namespace #"%alib".
system::Path Path
Type alias in namespace #"%alib".
strings::TDec< character > Dec
Type alias in namespace #"%alib".
strings::TSubstring< character > Substring
Type alias in namespace #"%alib".
strings::util::CalendarDateTime CalendarDateTime
Type alias in namespace #"%alib".
LocalString< 256 > String256
Type alias name for #"TLocalString;TLocalString<character,256>".
constexpr PathCharType DIRECTORY_SEPARATOR
The standard path separator character. Defaults to '\' on Windows OS, '/' else.
format::ByteSizeIEC ByteSizeIEC
Type alias in namespace #"%alib".
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace #"%alib".
characters::character character
Type alias in namespace #"%alib".
lang::uinteger uinteger
Type alias in namespace #"%alib".
Recursively accumulated values for directories.
uint32_t QtyErrsBrokenLink
Number of broken symbolic links in the directory and its subfolders.
uint32_t CountNonDirectories() const noexcept
uint32_t CountDirectories() const noexcept
uint32_t QtyErrsAccess
Number of access errors in the folder and subfolders.