8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
16#if !defined ( _WIN32 )
52 int perms= int(Value().Perms());
64 "This method is not compatible due to changes in the permission enumeration." );
67 std::array<char, 9> result;
68 std::array<char, 3> chars = {
'r',
'w',
'x'};
73 result[charIdx]= perms & bit ? chars[charIdx % 3] :
'-';
104 while (
format.IsNotEmpty() )
115 while (
format.ConsumeChar(c) )
125 auto& value= Value();
135 case 'a' : toBeAdded= Name();
break;
136 case 's' : toBeAdded=
Stem();
break;
137 case 'e' : toBeAdded=
Extension();
break;
144 pathBuffer << Name();
146 toBeAdded= pathBuffer;
151 ALIB_WARNING(
"ALIB",
"Format Error: Token 'n' followed by unknown "
152 "specifier '{}' in File::Format.", c )
153 target <<
"Format Error: Token 'n' followed by unknown specifier '" << c
154 <<
"' in File::Format.";
164 toBeAdded= strBuffer;
171 else toBeAdded= value.Type();
181 strBuffer <<
" -> " << value.GetLinkTarget();
182 if( value.GetRealLinkTarget().IsNotEmpty()
183 && !value.GetLinkTarget().Equals( value.GetRealLinkTarget()) )
184 strBuffer <<
" (" << value.GetRealLinkTarget() <<
")";
185 toBeAdded= strBuffer;
193 case 'x' : toBeAdded= (value.IsCrossingFS() ?
'm' :
'-') ;
break;
194 case 'a' : toBeAdded= (value.IsArtificialFS() ?
'm' :
'-') ;
break;
197 ALIB_WARNING(
"ALIB",
"Format Error: Unknown character {} after "
198 "token 'f' in File::Format.", c )
199 target <<
"Format Error: Unknown character '" << c
200 <<
"' after token 'f' in File::Format.";
207 toBeAdded= value.QtyHardLinks();
212 else toBeAdded= value.Quality();
220 case 'm' : date= value.MDate();
break;
221 case 'b' : date= value.BDate();
break;
222 case 'c' : date= value.CDate();
break;
223 case 'a' : date= value.ADate();
break;
227 "Format Error: Unknown character {} after token 'd' "
228 "in File::Format.", c )
229 target <<
"Format Error: Unknown character '" << c
230 <<
"' after token 'd' in File::Format.";
237 dateFormat=
A_CHAR(
"dd. MMM yyyy HH:mm");
238 date.
Format( dateFormat, strBuffer );
239 toBeAdded= strBuffer;
245 bool automaticMode =
true;
246 auto unit = ByteSizeUnits::IEC;
249 if(
format.CharAtStart() ==
'(' )
254 unit= ByteSizeUnits::SI;
264 automaticMode=
false;
267 if(
format.ConsumeChar() !=
')' )
270 "Format Error: Expected closing brace ')' after unit specification with token 's'." )
271 target <<
"Format Error: Expected closing brace ')' after unit specification with token 's'.";
282 if( unit==ByteSizeUnits::B || unit ==ByteSizeUnits::B_SI )
285 strBuffer <<
alib::Dec( dval , 0, ftreeNF);
292 toBeAdded= strBuffer;
299 bool isOwner= c==
'o';
302 if( c !=
'i' && c !=
'n' )
305 "Format Error: Expected 'i' or 'n' specifier after token 'o' and 'g'."
307 target <<
"Format Error: Expected 'i' or 'n' specifier after token 'o' and 'g'."
308 " Given: '" << c <<
"'";
311 bool isName= (c ==
'n');
316 toBeAdded= isOwner ? resolver.GetOwnerName(value)
317 : resolver.GetGroupName(value);
321 strBuffer << (isOwner ? value.Owner() : value.Group());
322 toBeAdded= strBuffer;
332 if( !value.IsDirectory()
349 "Format Error: Token 'r' followed by unknown specifier '{}' "
350 "in File::Format", c )
351 target <<
"Format Error: Token 'r' followed by unknown specifier '" << c
352 <<
"'in File::Format";
378 ALIB_WARNING(
"ALIB",
"Format Error: Missing single Quote" )
379 target <<
"Format Error: Missing closing single quote character <'>" ;
398 if(
format.CharAtStart() ==
'{' )
404 if(
format.ConsumeChar() !=
'}' )
407 "Format Error: Expected closing brace '}' with field specifier {width/alignment}." )
408 target <<
"Format Error: Expected closing brace '}' with field specifier {width/alignment}.";
411 target <<
Field( toBeAdded, width, alignment );
418 target.
ToUpper(previousLength);
427 :
FILES.GetResource(
"FFMT"),
442void AppendableTraits<files::File,nchar, lang::HeapAllocator>::operator()( TAString<nchar, lang::HeapAllocator>& target,
const files::File& file )
449void AppendableTraits<files::File,wchar, lang::HeapAllocator>::operator()( TAString<wchar, lang::HeapAllocator>& target,
const files::File& file )
constexpr CharacterType Separator() const noexcept
@ RECURSIVE
Follow symlink target strings.
@ RESOLVED
Read symlink target strings.
@ 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.
OwnerAndGroupResolver & GetOGResolver()
NumberFormat & GetNumberFormat()
ALIB_DLL AString & Format(Substring format, AString &target, lang::CurrentData targetData=lang::CurrentData::Keep, NumberFormat *numberFormat=nullptr) const
Path & AssemblePath(Path &target, lang::CurrentData targetData=lang::CurrentData::Clear) const
system::PathString Extension() const
AString & FormatAccessRights(AString &target) const
ALIB_WARNINGS_RESTORE system::PathString Stem() const
TAString & InsertChars(TChar c, integer qty)
TAString & ToUpper(integer regionStart=0, integer regionLength=MAX_LEN)
TAString & _(const TAppendable &src)
constexpr integer Length() const
constexpr bool IsEmpty() const
constexpr bool IsNotEmpty() const
ALIB_DLL AString & Format(Substring format, AString &target, lang::CurrentData targetData=lang::CurrentData::Keep) const
#define ALIB_WARNING(domain,...)
bool Parse(strings::TSubstring< TChar > &input, TEnum &result)
void FFormat_File(const alib::Box &box, const alib::String &formatSpec, alib::NumberFormat &nf, alib::AString &target)
Alignment
Denotes Alignments.
@ Right
Chooses right alignment.
@ Keep
Chooses not no clear existing data.
@ Clear
Chooses to clear existing data.
constexpr PathCharType DIRECTORY_SEPARATOR
The standard path separator character. Defaults to '\' on Windows OS, '/' else.
strings::TDec< character > Dec
Type alias in namespace alib.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
format::ByteSizeIEC ByteSizeIEC
Type alias in namespace alib.
LocalString< 4096 > String4K
Type alias name for TLocalString<character,4096>.
lang::integer integer
Type alias in namespace alib.
strings::TField< character > Field
Type alias in namespace alib.
strings::TNumberFormat< character > NumberFormat
Type alias in namespace alib.
system::Path Path
Type alias in namespace alib.
strings::util::CalendarDateTime CalendarDateTime
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
files::FilesCamp FILES
The singleton instance of ALib Camp class FilesCamp.
strings::TString< character > String
Type alias in namespace alib.
characters::character character
Type alias in namespace alib.
lang::uinteger uinteger
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.
Recursively accumulated values for directories.
uint32_t QtyErrsAccess
Number of access errors in the folder and subfolders.
uint32_t CountNonDirectories() const noexcept
uint32_t QtyErrsBrokenLink
Number of broken symbolic links in the directory and its subfolders.
uint32_t CountDirectories() const noexcept