#include <c4d_file.h>
Manages file and path names.
Private Attributes | |
maxon::Url | dummy1 |
Constructors/Destructors | |
Filename (void) | |
Filename (const Char *string) | |
Filename (const maxon::String &string) | |
Filename (const Filename &src) | |
~Filename (void) | |
String Content | |
Bool | IsPopulated () const |
String | GetString (void) const |
void | SetString (const maxon::String &str) |
Directory/File Parts | |
const Filename | GetDirectory (void) const |
void | SetDirectory (const Filename &str) |
const Filename | GetFile (void) const |
void | SetFile (const Filename &str) |
String | GetFileString (void) const |
Suffix Part | |
String | GetSuffix (void) const |
void | SetSuffix (const maxon::String &str) |
void | ClearSuffix (void) |
void | ClearSuffixComplete (void) |
Bool | CheckSuffix (const maxon::String &str) const |
Read/Write Memory | |
void | SetMemoryReadMode (void *adr, Int size=-1, Bool transferOwnership=false) |
void | SetMemoryWriteMode (MemoryFileStruct *mfs) |
Operators | |
const Filename & | operator= (const Filename &fname) |
const Filename & | operator+= (const Filename &fname) |
Bool | operator== (const Filename &fname) const |
Bool | operator!= (const Filename &fname) const |
void | CopyTo (Filename *dst) const |
Bool | IsBrowserUrl () const |
Bool | FileSelect (FILESELECTTYPE type, FILESELECT flags, const maxon::String &title, const maxon::String &force_suffix=maxon::String()) |
const Filename | operator+ (const Filename &fname1, const Filename &fname2) |
static maxon::Result< Bool > | FileSelectMultiple (FILESELECT flags, const maxon::String &title, const maxon::Url &startUrl, const maxon::Id &settingsIdentifier, const maxon::Block< maxon::Tuple< maxon::String, maxon::String >> &filterStrings, const maxon::ValueReceiver< const maxon::Url & > &selectedUrls) |
Filename | ( | void | ) |
Default constructor.
Constructs the filename from a character array.
[in] | string | The filename character array. |
Filename | ( | const maxon::String & | string | ) |
Constructs the filename from a string.
[in] | string | The filename string. |
Copy constructor. Creates a filename from another filename.
[in] | src | The source filename. |
~Filename | ( | void | ) |
Default destructor.
Bool IsPopulated | ( | ) | const |
Checks if the filename has been set.
String GetString | ( | void | ) | const |
Gets the String of the filename.
void SetString | ( | const maxon::String & | str | ) |
Sets the filename to the passed string.
[in] | str | The string to use to set the filename. |
const Filename GetDirectory | ( | void | ) | const |
Gets the directory that the file is located.
void SetDirectory | ( | const Filename & | str | ) |
Sets the directory for the filename. The file part remains unchanged.
[in] | str | The directory to set for the filename. |
const Filename GetFile | ( | void | ) | const |
Gets the file part of the filename only, without the path.
void SetFile | ( | const Filename & | str | ) |
Sets the file part for the filename. The directory part remains unchanged.
[in] | str | The file part to set for the filename. |
String GetFileString | ( | void | ) | const |
Convenience function to directly get the file part string. Identical to GetFile().GetString().
String GetSuffix | ( | void | ) | const |
Gets the suffix of the filename.
void SetSuffix | ( | const maxon::String & | str | ) |
Sets the suffix part of the filename.
[in] | str | A string with the suffix for the file. Only contains the suffix part and no dot (e.g. "TIF"). |
void ClearSuffix | ( | void | ) |
Clears the suffix part of the filename.
void ClearSuffixComplete | ( | void | ) |
Same as ClearSuffix() only that it also clears suffixes longer than seven characters.
Bool CheckSuffix | ( | const maxon::String & | str | ) | const |
Checks if the suffix of the filename is the same as its string.
[in] | str | The suffix to check against. |
Sets the filename to read from a memory block instead of from a file.
[in] | adr | The memory to read from. The caller owns the pointed memory block. |
[in] | size | The size of memory block starting at adr, or -1 if the buffer is "big enough". |
[in] | transferOwnership | If true the ownership of the memory block is transfered to the caller, who then needs to free the memory with DeleteMem(). Otherwise (false by default) the memory block will be freed when the MemoryFileStruct is destructed. |
void SetMemoryWriteMode | ( | MemoryFileStruct * | mfs | ) |
Sets the filename to write to a memory block instead of to a file.
[in] | mfs | The memory file to write to. The caller owns the pointed memory file. |
Assignment operator. Assigns the right-operand filename to the left-operand filename.
[in] | fname | The right-operand filename. |
Concatenates the filenames and set the left-hand operand to the result.
[in] | fname | The right-operand filename. |
Checks if two filenames are equal.
[in] | fname | The right-operand filename. |
Check if two filenames are different.
[in] | fname | The right-operand filename. |
void CopyTo | ( | Filename * | dst | ) | const |
Copies the filename to dst.
[out] | dst | The destination filename. The caller owns the pointed filename. |
Bool IsBrowserUrl | ( | ) | const |
Checks if the filename is a content browser url.
Bool FileSelect | ( | FILESELECTTYPE | type, |
FILESELECT | flags, | ||
const maxon::String & | title, | ||
const maxon::String & | force_suffix = maxon::String() |
||
) |
Opens a file selector dialog. Example: To load a file:
To save a bmp file:
[in] | type | The type of file to show in the file selector: FILESELECTTYPE |
[in] | flags | The file selector flags: FILESELECT |
[in] | title | The title for the file selector dialog. |
[in] | force_suffix | Set this to suffix to force a filename suffix when in save mode. |
|
static |
FileSelectMultiple allows to select files or folders in a OS file chooser dialog.
[in] | flags | Flags see FILESELECT. |
[in] | title | Title to be set in the window. |
[in] | startUrl | Start url to select in the file chooser. |
[in] | settingsIdentifier | Identifier to store settings for different callers (e.g. window dimensions etc). Every caller can have different settings. Keep empty for default settings |
[in] | filterStrings | Array with tuples for valid file suffixes. first: name, second: ; seperated list of suffixes. e.g. BaseArray<Tuple<String, String>> filterStrings; filterStrings.Append({"All files"_s, "*.*"_s}) iferr_return; filterStrings.Append({"3D-Formats"_s, "*.c4d;*.dem;*.dxf;*.iob;*.lwo;*.lws;*.3dm;*.3dmf;*.ai;*.ps;*.wrl;*.3ds;*.obj;*.mon;*.dae;*.dwg;*.fbx;*.igs"_s}) iferr_return; |
[out] | selectedUrls | Value receiver which is triggered for every selected url. |
Concatenates the two filenames. It will join directories and files parts.
[in] | fname1 | The left-operand filename. |
[in] | fname2 | The right-operand filename. |
|
private |