Filename Class Reference

#include <c4d_file.h>

Detailed Description

Manages file and path names.

Private Attributes

String dummy1
 
void * dummy2
 
Int dummy3
 
Int32 dummy4
 

Constructors/Destructors

 Filename (void)
 
 Filename (const Char *string)
 
 Filename (const String &string)
 
 Filename (const Filename &src)
 
 ~Filename (void)
 

String Content

Bool Content (void) const
 
String GetString (void) const
 
void SetString (const 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 String &str)
 
void ClearSuffix (void)
 
void ClearSuffixComplete (void)
 
Bool CheckSuffix (const String &str) const
 

Read/Write Memory

void SetMemoryReadMode (void *adr, Int size=-1, Bool transferOwnership=false)
 
void SetMemoryWriteMode (MemoryFileStruct *mfs)
 

Operators

const Filenameoperator= (const Filename &fname)
 
const Filenameoperator+= (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 String &title, const String &force_suffix=String())
 
const MemoryFileStructGetMemoryModeI () const
 
const Filename operator+ (const Filename &fname1, const Filename &fname2)
 

Constructor & Destructor Documentation

§ Filename() [1/4]

Filename ( void  )

Default constructor.

§ Filename() [2/4]

Filename ( const Char string)

Constructs the filename from a character array.

Parameters
[in]stringThe filename character array.

§ Filename() [3/4]

Filename ( const String string)

Constructs the filename from a string.

Parameters
[in]stringThe filename string.

§ Filename() [4/4]

Filename ( const Filename src)

Copy constructor. Creates a filename from another filename.

Parameters
[in]srcThe source filename.

§ ~Filename()

~Filename ( void  )

Default destructor.

Member Function Documentation

§ Content()

Bool Content ( void  ) const

Checks if the filename has been set.

Returns
true if filename was set, otherwise false.

§ GetString()

String GetString ( void  ) const

Gets the String of the filename.

Returns
The string with the full filename.

§ SetString()

void SetString ( const String str)

Sets the filename to the passed string.

Parameters
[in]strThe string to use to set the filename.

§ GetDirectory()

const Filename GetDirectory ( void  ) const

Gets the directory that the file is located.

Returns
The directory part for the filename.

§ SetDirectory()

void SetDirectory ( const Filename str)

Sets the directory for the filename. The file part remains unchanged.

Parameters
[in]strThe directory to set for the filename.

§ GetFile()

const Filename GetFile ( void  ) const

Gets the file part of the filename only, without the path.

Returns
The file part of the filename.

§ SetFile()

void SetFile ( const Filename str)

Sets the file part for the filename. The directory part remains unchanged.

Parameters
[in]strThe file part to set for the filename.

§ GetFileString()

String GetFileString ( void  ) const

Convenience function to directly get the file part string. Identical to GetFile().GetString().

Returns
The file part of the filename as a string.

§ GetSuffix()

String GetSuffix ( void  ) const

Gets the suffix of the filename.

Note
Suffix strings do not contain the dot character '.'.
Returns
The suffix. Only contains the suffix part without dot (e.g. "TIF").

§ SetSuffix()

void SetSuffix ( const String str)

Sets the suffix part of the filename.

Note
Suffix strings do not contain the dot character '.'.
Parameters
[in]strA string with the suffix for the file. Only contains the suffix part and no dot (e.g. "TIF").

§ ClearSuffix()

void ClearSuffix ( void  )

Clears the suffix part of the filename.

§ ClearSuffixComplete()

void ClearSuffixComplete ( void  )

Same as ClearSuffix() only that it also clears suffixes longer than seven characters.

§ CheckSuffix()

Bool CheckSuffix ( const String str) const

Checks if the suffix of the filename is the same as its string.

Parameters
[in]strThe suffix to check against.
Returns
true if the suffix was checked successfully, otherwise false.

§ SetMemoryReadMode()

void SetMemoryReadMode ( void *  adr,
Int  size = -1,
Bool  transferOwnership = false 
)

Sets the filename to read from a memory block instead of from a file.

Parameters
[in]adrThe memory to read from. The caller owns the pointed memory block.
[in]sizeThe size of memory block starting at adr, or -1 if the buffer is "big enough".
[in]transferOwnershipIf 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.

§ SetMemoryWriteMode()

void SetMemoryWriteMode ( MemoryFileStruct mfs)

Sets the filename to write to a memory block instead of to a file.

Parameters
[in]mfsThe memory file to write to. The caller owns the pointed memory file.

§ operator=()

const Filename& operator= ( const Filename fname)

Assignment operator. Assigns the right-operand filename to the left-operand filename.

Parameters
[in]fnameThe right-operand filename.
Returns
The left-operand filename.

§ operator+=()

const Filename& operator+= ( const Filename fname)

Concatenates the filenames and set the left-hand operand to the result.

Parameters
[in]fnameThe right-operand filename.
Returns
The left-operand filename.

§ operator==()

Bool operator== ( const Filename fname) const

Checks if two filenames are equal.

Parameters
[in]fnameThe right-operand filename.
Returns
true if filenames are equal, otherwise false.

§ operator!=()

Bool operator!= ( const Filename fname) const

Check if two filenames are different.

Parameters
[in]fnameThe right-operand filename.
Returns
true if filenames are different, otherwise false.

§ CopyTo()

void CopyTo ( Filename dst) const

Copies the filename to dst.

Parameters
[out]dstThe destination filename. The caller owns the pointed filename.

§ IsBrowserUrl()

Bool IsBrowserUrl ( ) const

Checks if the filename is a content browser url.

Returns
true if the filename is a browser url, otherwise false.

§ FileSelect()

Bool FileSelect ( FILESELECTTYPE  type,
FILESELECT  flags,
const String title,
const String force_suffix = String() 
)

Opens a file selector dialog. Example: To load a file:

To save a bmp file:

Parameters
[in]typeThe type of file to show in the file selector: FILESELECTTYPE
[in]flagsThe file selector flags: FILESELECT
[in]titleThe title for the file selector dialog.
[in]force_suffixSet this to suffix to force a filename suffix when in save mode.
Returns
true if the user selected a file, otherwise false.

§ GetMemoryModeI()

const MemoryFileStruct* GetMemoryModeI ( ) const

Private.

Friends And Related Function Documentation

§ operator+

const Filename operator+ ( const Filename fname1,
const Filename fname2 
)
friend

Concatenates the two filenames. It will join directories and files parts.

Parameters
[in]fname1The left-operand filename.
[in]fname2The right-operand filename.
Returns
The result of the concatenation of the 2 filenames.

Member Data Documentation

§ dummy1

String dummy1
private

§ dummy2

void* dummy2
private

§ dummy3

Int dummy3
private

§ dummy4

Int32 dummy4
private