feisty meow concerns codebase
2.140
|
Provides operations commonly needed on file names. More...
#include <filename.h>
Public Types | |
enum | write_modes { ALLOW_NEITHER = 0x0 , ALLOW_READ = 0x1 , ALLOW_WRITE = 0x2 , ALLOW_BOTH = ALLOW_READ | ALLOW_WRITE } |
enum | ownership_modes { NO_RIGHTS = 0x0 , USER_RIGHTS = 0x1 , GROUP_RIGHTS = 0x2 , OTHER_RIGHTS = 0x4 , ALL_RIGHTS = USER_RIGHTS | GROUP_RIGHTS | OTHER_RIGHTS } |
enum | directory_separator { pc_separator = '\\' , unix_separator = '/' } |
the default separator for directories per operating system. More... | |
Public Types inherited from basis::astring | |
enum | special_flag { UNTERMINATED = 62 , SPRINTF = 84 } |
enum | how_to_strip { FROM_FRONT = 1 , FROM_END = 2 , FROM_BOTH_SIDES = 3 } |
Public Member Functions | |
filename () | |
blank constructor. More... | |
filename (const basis::astring &name) | |
creates a filename from any part of a full pathname, if possible. More... | |
filename (const basis::astring &directory, const basis::astring &name_of_file) | |
constructs a filename from a "directory" and the "name_of_file". More... | |
filename (const filename &to_copy) | |
copy constructor. More... | |
DEFINE_CLASS_NAME ("filename") | |
virtual | ~filename () |
bool | good () const |
returns true if the filename seems to be valid. More... | |
void | reset (const basis::astring &name) |
changes the file name held by the object. More... | |
const basis::astring & | raw () const |
returns the astring that we're holding onto for the path. More... | |
basis::astring & | raw () |
accesses the astring that we're holding onto for the path. More... | |
filename & | operator= (const filename &to_copy) |
provides assignment for this object, plus a simple string. More... | |
filename & | operator= (const basis::astring &to_copy) |
provides assignment for this object, plus a simple string. More... | |
void | canonicalize () |
cleans up the filename as needed for the current operating system. More... | |
bool | exists () const |
returns true if the file exists. More... | |
bool | unlink () const |
actually removes the file, if possible. More... | |
filename | parent () const |
returns the parent filename for this one. More... | |
basis::astring | pop () |
removes the deepest component of the pathname. More... | |
void | push (const basis::astring &to_push) |
pushes a new filename onto the current pathname. More... | |
filename | basename () const |
returns the base of the filename; no directory. More... | |
filename | dirname () const |
returns the directory for the filename. More... | |
basis::astring | dirname (bool add_slash) const |
returns the directory for the filename and optionally adds a slash. More... | |
bool | had_directory () const |
returns true if the name that we were given had a non-empty directory. More... | |
char | drive (bool interact_with_fs=false) const |
returns the drive letter for the file, without the colon. More... | |
basis::astring | extension () const |
returns the extension for the file, if one is present. More... | |
basis::astring | rootname () const |
returns the root part of the basename without an extension. More... | |
bool | is_directory () const |
bool | is_writable () const |
bool | is_readable () const |
bool | is_executable () const |
bool | is_normal () const |
bool | chmod (int write_mode, int owner_mode) const |
changes the access rights on the file. More... | |
void | separate (bool &rooted, structures::string_array &pieces) const |
breaks the filename into its component parts. More... | |
void | join (bool rooted, const structures::string_array &pieces) |
undoes a separate() operation to get the filename back. More... | |
virtual void | pack (basis::byte_array &packed_form) const |
Creates a packed form of the packable object in "packed_form". More... | |
virtual bool | unpack (basis::byte_array &packed_form) |
Restores the packable from the "packed_form". More... | |
virtual int | packed_size () const |
Estimates the space needed for the packed structure. More... | |
bool | compare_prefix (const filename &to_compare, basis::astring &sequel) |
examines "this" filename to see if it's a prefix of "to_compare". More... | |
bool | compare_prefix (const filename &to_compare) |
this simpler form doesn't bother with computing the sequel. More... | |
bool | compare_suffix (const filename &to_compare, basis::astring &prequel) |
compares the back end of a filename to this. More... | |
bool | compare_suffix (const filename &to_compare) |
Public Member Functions inherited from basis::astring | |
astring () | |
constructs an empty string. More... | |
astring (const char *initial) | |
constructs a copy of the string passed in "initial". More... | |
astring (char c, int repeat) | |
constructs a string with "repeat" characters of "c" in it. More... | |
astring (const astring &s) | |
Constructs a copy of the string "s". More... | |
astring (const base_string &initial) | |
constructs a string from the base class. More... | |
astring (special_flag way, const char *s,...) | |
constructor that sports a few variable parameter constructions. More... | |
virtual | ~astring () |
destroys any storage for the string. More... | |
DEFINE_CLASS_NAME ("astring") | |
virtual int | comparator (const astring &s2) const |
helps to fulfill orderable contract. More... | |
int | length () const |
Returns the current length of the string. More... | |
int | end () const |
returns the index of the last (non-null) character in the string. More... | |
bool | empty () const |
empty() reports if the string is empty, that is, of zero length(). More... | |
bool | non_empty () const |
non_empty() reports if the string has some contents. More... | |
bool | operator! () const |
the negation operator returns true if the string is empty. More... | |
bool | t () const |
t() is a shortcut for the string being "true", as in non-empty. More... | |
virtual const char * | observe () const |
observes the underlying pointer to the zero-terminated string. More... | |
const char * | c_str () const |
synonym for observe. mimics the STL method name. More... | |
const char * | s () const |
synonym for observe. the 's' stands for "string", if that helps. More... | |
virtual char | get (int index) const |
a constant peek at the string's internals at the specified index. More... | |
virtual char * | access () |
provides access to the actual string held. More... | |
char * | c_str () |
synonym for access. mimics the STL method. More... | |
char * | s () |
synonym for access. More... | |
char & | operator[] (int position) |
accesses individual characters in "this" string. More... | |
const char & | operator[] (int position) const |
observes individual characters in "this" string. More... | |
virtual void | put (int position, char to_put) |
stores the character "to_put" at index "position" in the string. More... | |
astring & | sprintf (const char *s,...) |
similar to the SPRINTF constructor, but works on an existing string. More... | |
int | convert (int default_value) const |
Converts the string into a corresponding integer. More... | |
long | convert (long default_value) const |
converts the string to a long integer. More... | |
float | convert (float default_value) const |
converts the string to a floating point number. More... | |
double | convert (double default_value) const |
converts the string to a double precision floating point number. More... | |
bool | equal_to (const char *that) const |
returns true if "that" is equal to this. More... | |
bool | iequals (const astring &that) const |
returns true if this is case-insensitively equal to "that". More... | |
bool | iequals (const char *that) const |
returns true if this is case-insensitively equal to "that". More... | |
bool | compare (const astring &to_compare, int start_first, int start_second, int count, bool case_sensitive) const |
Compares "this" string with "to_compare". More... | |
bool | begins (const astring &maybe_prefix) const |
Returns true if "this" string begins with "maybe_prefix". More... | |
bool | ibegins (const astring &maybe_prefix) const |
a case-insensitive method similar to begins(). More... | |
bool | ends (const astring &maybe_suffix) const |
returns true if this string ends with "maybe_suffix". More... | |
bool | iends (const astring &maybe_suffix) const |
astring & | operator= (const astring &s) |
Sets the contents of this string to "s". More... | |
astring & | operator= (const char *s) |
Sets the contents of this string to "s". More... | |
void | reset () |
clears out the contents string. More... | |
void | reset (special_flag way, const char *s,...) |
operates like the constructor that takes a 'special_flag'. More... | |
void | copy (char *to_stuff, int count) const |
Copies a maximum of "count" characters from this into "to_stuff". More... | |
void | stuff (char *to_stuff, int count) const |
a synonym for copy(). More... | |
astring | operator+ (const astring &s) const |
Returns the concatenation of "this" and "s". More... | |
astring & | operator+= (const astring &s) |
Modifies "this" by concatenating "s" onto it. More... | |
astring & | operator+= (const char *s) |
astring | operator+ (const char *s) const |
< synonym for the concatenation operator but uses a char pointer instead. More... | |
astring & | operator+= (char c) |
concatenater for single characters. More... | |
int | find (char to_find, int position=0, bool reverse=false) const |
Locates "to_find" in "this". More... | |
int | find (const astring &to_find, int posn=0, bool reverse=false) const |
finds "to_find" in this string. More... | |
int | ifind (char to_find, int position=0, bool reverse=false) const |
like the find() methods above, but case-insensitive. More... | |
int | ifind (const astring &to_find, int posn=0, bool reverse=false) const |
like the find() methods above, but case-insensitive. More... | |
int | find_any (const char *to_find, int position=0, bool reverse=false) const |
searches for any of the characters in "to_find". More... | |
int | ifind_any (const char *to_find, int position=0, bool reverse=false) const |
searches case-insensitively for any of the characters in "to_find". More... | |
int | find_non_match (const char *to_find, int position=0, bool reverse=false) const |
searches for any character that is not in "to_find" and returns index. More... | |
bool | contains (const astring &to_find) const |
Returns true if "to_find" is contained in this string or false if not. More... | |
bool | substring (astring &target, int start, int end) const |
a version that stores the substring in an existing "target" string. More... | |
astring | substring (int start, int end) const |
Returns the segment of "this" between the indices "start" and "end". More... | |
astring | middle (int start, int count) |
returns the middle of the string from "start" with "count" characters. More... | |
astring | left (int count) |
returns the left "count" characters from the string. More... | |
astring | right (int count) |
returns the right "count" characters from the string. More... | |
void | pad (int length, char padding=' ') |
makes the string "length" characters long. More... | |
void | trim (int length) |
shortens the string to "length" if it's longer than that. More... | |
void | insert (int position, const astring &to_insert) |
Copies "to_insert" into "this" at the "position". More... | |
virtual void | zap (int start, int end) |
Deletes the characters between "start" and "end" inclusively. More... | |
void | to_lower () |
to_lower modifies "this" by replacing capitals with lower-case. More... | |
void | to_upper () |
to_upper does the opposite of to_lower (that is, q becomes Q). More... | |
astring | lower () const |
like to_lower(), but returns a new string rather than modifying this. More... | |
astring | upper () const |
like to_upper(), but returns a new string rather than modifying this. More... | |
bool | replace (const astring &tag, const astring &replacement) |
replaces the first occurrence of "tag" text with the "replacement". More... | |
bool | replace_all (char to_replace, char new_char) |
changes all occurrences of "to_replace" with "new_char". More... | |
bool | replace_all (const astring &to_replace, const astring &new_string) |
void | shrink () |
changes all occurrences of "to_replace" into "new_string". More... | |
void | strip (const astring &strip_list, how_to_strip way=FROM_BOTH_SIDES) |
strips all chars from "strip_list" out of "this" given the "way". More... | |
void | strip_spaces (how_to_strip way=FROM_BOTH_SIDES) |
removes excess space characters from string's beginning, end or both. More... | |
void | strip_white_spaces (how_to_strip way=FROM_BOTH_SIDES) |
like strip_spaces, but includes tabs in the list to strip. More... | |
int | packed_size () const |
Reports the size required to pack this string into a byte array. More... | |
void | pack (byte_array &target) const |
stores this string in the "target". it can later be unpacked again. More... | |
bool | unpack (byte_array &source) |
retrieves a string (packed with pack()) from "source" into this string. More... | |
virtual bool | equal_to (const equalizable &s2) const |
< provides a case insensitive comparison routine. More... | |
virtual bool | less_than (const orderable &s2) const |
virtual base_string & | concatenate_string (const base_string &s) |
Modifies "this" by concatenating "s" onto it. More... | |
virtual base_string & | concatenate_char (char c) |
concatenater for single characters. More... | |
virtual base_string & | assign (const base_string &s) |
Sets the contents of this string to "s". More... | |
virtual base_string & | upgrade (const char *s) |
Sets the contents of this string to "s". More... | |
virtual bool | sub_string (base_string &target, int start, int end) const |
Gets the segment of "this" between the indices "start" and "end". More... | |
virtual bool | sub_compare (const base_string &to_compare, int start_first, int start_second, int count, bool case_sensitive) const |
Compares "this" string with "to_compare". More... | |
virtual void | insert (int position, const base_string &to_insert) |
Copies "to_insert" into "this" at the "position". More... | |
virtual void | text_form (base_string &state_fill) const |
Provides a text view of all the important info owned by this object. More... | |
astring & | base_sprintf (const char *s, va_list &args) |
byte_array & | get_implementation () |
Public Member Functions inherited from basis::base_string | |
virtual base_string & | operator= (const base_string &to_copy) |
sets this string's contents equal to the contents of "to_copy". More... | |
Public Member Functions inherited from basis::orderable | |
virtual bool | operator< (const orderable &s2) const |
the virtual method for object ordering. More... | |
Public Member Functions inherited from basis::equalizable | |
virtual bool | operator== (const equalizable &s2) const |
the virtual method for object equality. More... | |
Public Member Functions inherited from basis::text_formable | |
virtual const char * | class_name () const =0 |
Returns the bare name of this class as a constant character pointer. More... | |
Static Public Member Functions | |
static bool | separator (char is_it) |
returns true if the character "is_it" in question is a separator. More... | |
static basis::astring | default_separator () |
returns the default separator character for this OS. More... | |
static bool | legal_character (char to_check) |
returns true if "to_check" is a valid character in a filename. More... | |
static void | detooth_filename (basis::astring &to_clean, char replacement='_') |
takes any known illegal file system characters out of "to_clean". More... | |
static basis::astring | null_device () |
returns the name for the black hole device that consumes all input, i.e. /dev/null. More... | |
Static Public Member Functions inherited from basis::astring | |
static const astring & | empty_string () |
useful wherever empty strings are needed, e.g., function defaults. More... | |
static bool | matches (const astring &match_list, char to_match) |
returns true if "to_match" is found in the "match_list" string. More... | |
Provides operations commonly needed on file names.
Definition at line 63 of file filename.h.
the default separator for directories per operating system.
the PC uses the backward slash to separate file and directory names from each other, while Unix uses the forward slash.
Enumerator | |
---|---|
pc_separator | |
unix_separator |
Definition at line 186 of file filename.h.
Enumerator | |
---|---|
NO_RIGHTS | |
USER_RIGHTS | |
GROUP_RIGHTS | |
OTHER_RIGHTS | |
ALL_RIGHTS |
Definition at line 174 of file filename.h.
Enumerator | |
---|---|
ALLOW_NEITHER | |
ALLOW_READ | |
ALLOW_WRITE | |
ALLOW_BOTH |
Definition at line 168 of file filename.h.
filesystem::filename::filename | ( | ) |
filesystem::filename::filename | ( | const basis::astring & | name | ) |
creates a filename from any part of a full pathname, if possible.
if the name contains quotes, they are stripped out.
Definition at line 62 of file filename.cpp.
References canonicalize().
filesystem::filename::filename | ( | const basis::astring & | directory, |
const basis::astring & | name_of_file | ||
) |
constructs a filename from a "directory" and the "name_of_file".
the "name_of_file" can itself be a directory.
Definition at line 67 of file filename.cpp.
References basis::astring::astring(), canonicalize(), filesystem::DEFAULT_SEPARATOR, and filesystem::NO_PARENT_DEFAULT.
filesystem::filename::filename | ( | const filename & | to_copy | ) |
|
virtual |
Definition at line 91 of file filename.cpp.
filename filesystem::filename::basename | ( | ) | const |
returns the base of the filename; no directory.
Definition at line 385 of file filename.cpp.
References basis::astring::zap().
Referenced by extension(), unit_test::unit_base::final_report(), main(), pop(), rootname(), processes::process_control::sort_by_name(), processes::process_entry::text_form(), versions::version_ini::write_assembly(), and application::launch_manager::zap_process().
void filesystem::filename::canonicalize | ( | ) |
cleans up the filename as needed for the current operating system.
reforms the name by replacing any alternate directory separators with the operating system's preferred character.
Definition at line 157 of file filename.cpp.
References basis::astring::astring(), basis::astring::compare(), filesystem::DEFAULT_SEPARATOR, basis::astring::end(), FUNCDEF, basis::astring::get(), basis::astring::insert(), textual::parser_bits::is_alpha(), textual::parser_bits::is_alphanumeric(), basis::astring::length(), basis::astring::put(), separator(), and basis::astring::zap().
Referenced by filename(), operator=(), and reset().
bool filesystem::filename::chmod | ( | int | write_mode, |
int | owner_mode | ||
) | const |
changes the access rights on the file.
Definition at line 624 of file filename.cpp.
References ALLOW_READ, ALLOW_WRITE, GROUP_RIGHTS, OTHER_RIGHTS, raw(), basis::astring::s(), and USER_RIGHTS.
Referenced by versions::version_ini::write_assembly(), and versions::version_ini::write_rc().
bool filesystem::filename::compare_prefix | ( | const filename & | to_compare | ) |
this simpler form doesn't bother with computing the sequel.
Definition at line 563 of file filename.cpp.
bool filesystem::filename::compare_prefix | ( | const filename & | to_compare, |
basis::astring & | sequel | ||
) |
examines "this" filename to see if it's a prefix of "to_compare".
this returns true if all of "this" is the same as the first portion of "to_compare". that is, if "this" is a prefix of "to_compare", then true is returned. this will always fail if there are fewer components in "to_compare". it will always succeed if the two filenames are identical. on success, the "sequel" is set to the portion of "to_compare" that's not included in this filename.
Definition at line 545 of file filename.cpp.
References filesystem::DEFAULT_SEPARATOR, and basis::array< contents >::length().
Referenced by filesystem::directory_tree::jump_to().
bool filesystem::filename::compare_suffix | ( | const filename & | to_compare | ) |
Definition at line 617 of file filename.cpp.
bool filesystem::filename::compare_suffix | ( | const filename & | to_compare, |
basis::astring & | prequel | ||
) |
compares the back end of a filename to this.
this is similar to compare_prefix() but it checks to see if the back end of "this" filename is the same as "to_compare". if "this" is longer than "to_compare", then failure occurs. only if all of the bits in "this" are seen in the back of "to_compare" is true returned.
Definition at line 600 of file filename.cpp.
References filesystem::DEFAULT_SEPARATOR, and basis::array< contents >::length().
|
static |
returns the default separator character for this OS.
Definition at line 93 of file filename.cpp.
References basis::astring::astring(), and filesystem::DEFAULT_SEPARATOR.
Referenced by filesystem::directory_tree::compare_trees(), filesystem::directory_tree::jump_to(), and filesystem::directory_tree::seek().
filesystem::filename::DEFINE_CLASS_NAME | ( | "filename" | ) |
|
static |
takes any known illegal file system characters out of "to_clean".
this prepares "to_clean" for use as a component in a larger filename by ensuring that the file system will not reject the name (as long as a suitable directory path is prepended to the name and permissions allow the file to be created or accessed). the "replacement" is used as the character that is substituted instead of illegal characters.
Definition at line 452 of file filename.cpp.
References legal_character(), and basis::astring::length().
filename filesystem::filename::dirname | ( | ) | const |
returns the directory for the filename.
if no directory name can be found in the filename, then "." is returned.
Definition at line 393 of file filename.cpp.
References basis::astring::astring(), filesystem::DEFAULT_SEPARATOR, basis::astring::end(), basis::astring::get(), filesystem::NO_PARENT_DEFAULT, and basis::astring::zap().
Referenced by configuration::application_configuration::application_directory(), filesystem::heavy_file_operations::copy_file(), dirname(), parent(), processes::process_entry::text_form(), versions::version_ini::write_assembly(), and filesystem::heavy_file_operations::write_file_chunk().
astring filesystem::filename::dirname | ( | bool | add_slash | ) | const |
returns the directory for the filename and optionally adds a slash.
if "add_slash" is true, then the default directory separator will be present on the end of the string.
Definition at line 419 of file filename.cpp.
References filesystem::DEFAULT_SEPARATOR, dirname(), and raw().
char filesystem::filename::drive | ( | bool | interact_with_fs = false | ) | const |
returns the drive letter for the file, without the colon.
this only makes sense for a fully qualified MS-DOS style name. if no drive letter is found, then '\0' is returned. if "interact_with_fs" is true, then the file system will be checked for the actual drive if no drive letter was found in the contents.
Definition at line 282 of file filename.cpp.
References basis::astring::get(), and basis::astring::length().
bool filesystem::filename::exists | ( | ) | const |
returns true if the file exists.
Definition at line 426 of file filename.cpp.
References is_directory(), is_readable(), and basis::astring::length().
Referenced by filesystem::file_info::calculate(), filesystem::heavy_file_operations::copy_file(), find_unique_backup_name(), configuration::application_configuration::get_logging_directory(), good(), application::launch_manager::launch_now(), filesystem::directory::recursive_create(), filesystem::huge_file::touch(), and filesystem::heavy_file_operations::write_file_chunk().
astring filesystem::filename::extension | ( | ) | const |
returns the extension for the file, if one is present.
Definition at line 299 of file filename.cpp.
References basename(), basis::astring::end(), basis::astring::find(), basis::astring::length(), basis::negative(), raw(), and basis::astring::substring().
Referenced by main().
bool filesystem::filename::good | ( | ) | const |
returns true if the filename seems to be valid.
this means that not only was the pathname parsed and found valid, but the file actually exists.
Definition at line 99 of file filename.cpp.
References exists().
Referenced by filesystem::directory_tree::add_path().
|
inline |
returns true if the name that we were given had a non-empty directory.
this allows one to distinguish between a file with the current directory (.) attached and a file with no directory specified.
Definition at line 139 of file filename.h.
Referenced by configuration::application_configuration::get_cmdline_from_proc().
bool filesystem::filename::is_directory | ( | ) | const |
Definition at line 325 of file filename.cpp.
References S_IFDIR.
Referenced by filesystem::directory_tree::add_path(), exists(), filesystem::directory::recursive_create(), and filesystem::directory::rescan().
bool filesystem::filename::is_executable | ( | ) | const |
Definition at line 349 of file filename.cpp.
References S_IEXEC.
bool filesystem::filename::is_normal | ( | ) | const |
Definition at line 357 of file filename.cpp.
Referenced by filesystem::directory_tree::add_path(), filesystem::directory_tree::calculate(), and filesystem::directory::rescan().
bool filesystem::filename::is_readable | ( | ) | const |
bool filesystem::filename::is_writable | ( | ) | const |
Definition at line 333 of file filename.cpp.
References S_IWRITE.
Referenced by versions::version_ini::writable().
void filesystem::filename::join | ( | bool | rooted, |
const structures::string_array & | pieces | ||
) |
undoes a separate() operation to get the filename back.
"this" is set to a filename made from each of the "pieces". if there are any directory separators inside the pieces themselves, then they will be removed by canonicalize(). if separate() said the path was rooted, then join needs to be told that.
Definition at line 503 of file filename.cpp.
References filesystem::DEFAULT_SEPARATOR, and basis::array< contents >::length().
Referenced by filesystem::directory_tree::compare_trees(), filesystem::directory_tree::jump_to(), and filesystem::directory::recursive_create().
|
static |
returns true if "to_check" is a valid character in a filename.
this does not consider separator characters; it only looks at the the name components. also, it is appropriate for the union of the operating systems we support.
Definition at line 436 of file filename.cpp.
Referenced by detooth_filename().
|
static |
returns the name for the black hole device that consumes all input, i.e. /dev/null.
Definition at line 109 of file filename.cpp.
filename & filesystem::filename::operator= | ( | const basis::astring & | to_copy | ) |
provides assignment for this object, plus a simple string.
the latter version invokes canonicalize to clean the string up.
Definition at line 129 of file filename.cpp.
References canonicalize().
provides assignment for this object, plus a simple string.
Definition at line 121 of file filename.cpp.
|
virtual |
Creates a packed form of the packable object in "packed_form".
This must append to the data in "packed_form" rather than clearing prior contents.
Implements basis::packable.
Reimplemented in filesystem::file_info.
Definition at line 465 of file filename.cpp.
References basis::attach(), and structures::pack().
Referenced by filesystem::file_info::pack(), and filesystem::filename_tree::pack().
|
virtual |
Estimates the space needed for the packed structure.
Implements basis::packable.
Reimplemented in filesystem::file_info.
Definition at line 460 of file filename.cpp.
References structures::packed_size(), and structures::PACKED_SIZE_INT32.
Referenced by filesystem::file_info::packed_size(), and filesystem::filename_tree::packed_size().
filename filesystem::filename::parent | ( | ) | const |
returns the parent filename for this one.
Definition at line 150 of file filename.cpp.
References dirname().
Referenced by pop().
astring filesystem::filename::pop | ( | ) |
removes the deepest component of the pathname.
the component might be a file or directory name, but popping beyond the top-level directory will not succeed. the returned string contains the component that was removed. it will be a blank string if nothing could be popped.
Definition at line 138 of file filename.cpp.
References basename(), basis::astring::equal_to(), filesystem::NO_PARENT_DEFAULT, parent(), and raw().
void filesystem::filename::push | ( | const basis::astring & | to_push | ) |
pushes a new filename onto the current pathname.
this only makes sense as a real pathname if this is currently a directory name and the component "to_push" is a child of that directory (or one intends to create that component as a child). this is the opposite of pop.
Definition at line 152 of file filename.cpp.
References filename().
astring & filesystem::filename::raw | ( | ) |
accesses the astring that we're holding onto for the path.
important note: if you change the string with this non-const raw() method, you MUST call canonicalize() on it again afterwards.
Definition at line 95 of file filename.cpp.
const astring & filesystem::filename::raw | ( | ) | const |
returns the astring that we're holding onto for the path.
Definition at line 97 of file filename.cpp.
Referenced by filesystem::directory_tree::add_path(), configuration::application_configuration::application_configuration_file(), configuration::application_configuration::application_directory(), filesystem::heavy_file_operations::buffer_files(), filesystem::file_info::calculate(), filesystem::directory_tree::calculate(), filesystem::filename_list::calculate_progress(), chmod(), filesystem::directory_tree::compare_trees(), filesystem::heavy_file_operations::copy_file(), dirname(), extension(), unit_test::unit_base::final_report(), filesystem::filename_list::find(), filesystem::directory_tree::jump_to(), filesystem::filename_list::locate(), main(), filesystem::directory_tree::make_directories(), filesystem::filename_list::member(), filesystem::filename_list::member_with_state(), filesystem::byte_filer::name(), filesystem::byte_filer::open(), pop(), filesystem::directory::recursive_create(), filesystem::directory_tree::remove_path(), rootname(), filesystem::directory_tree::seek(), separate(), processes::process_control::sort_by_name(), filesystem::file_info::text_form(), processes::process_entry::text_form(), filesystem::directory_tree::text_form(), whacking_spider(), versions::version_ini::write_assembly(), and filesystem::heavy_file_operations::write_file_chunk().
void filesystem::filename::reset | ( | const basis::astring & | name | ) |
changes the file name held by the object.
Definition at line 103 of file filename.cpp.
References canonicalize().
Referenced by filesystem::byte_filer::close(), and filesystem::byte_filer::open().
astring filesystem::filename::rootname | ( | ) | const |
returns the root part of the basename without an extension.
Definition at line 308 of file filename.cpp.
References basename(), basis::astring::end(), basis::astring::find(), basis::negative(), raw(), and basis::astring::substring().
Referenced by loggers::file_logger::log_file_for_app_name().
void filesystem::filename::separate | ( | bool & | rooted, |
structures::string_array & | pieces | ||
) | const |
breaks the filename into its component parts.
this returns an array containing the component names for the path in this filename object. if the "rooted" flag is set to true, then the path was absolute (i.e. started at '/' in unix. this notion is not needed for dos/windoze, as the first component will be something like 'a:').
Definition at line 482 of file filename.cpp.
References basis::astring::length(), raw(), basis::array< contents >::reset(), and separator().
Referenced by filesystem::directory_tree::add_path(), filesystem::directory_tree::compare_trees(), filesystem::directory_tree::jump_to(), and filesystem::directory::recursive_create().
|
static |
returns true if the character "is_it" in question is a separator.
Definition at line 118 of file filename.cpp.
References pc_separator, and unix_separator.
Referenced by canonicalize(), and separate().
bool filesystem::filename::unlink | ( | ) | const |
actually removes the file, if possible.
if the file was successfully deleted, then true is returned.
Definition at line 101 of file filename.cpp.
References basis::astring::observe(), and unlink.
Referenced by whacking_spider().
|
virtual |
Restores the packable from the "packed_form".
This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.
Implements basis::packable.
Reimplemented in filesystem::file_info.
Definition at line 471 of file filename.cpp.
References basis::detach(), and structures::unpack().
Referenced by filesystem::file_info::unpack(), and filesystem::filename_tree::unpack().