![]() | InDesign SDK 20.5 |
#include <SDKFileHelper.h>

Public Member Functions | |
| SDKFileHelper (const PMString &path) | |
| SDKFileHelper (const IDFile &file) | |
| virtual | ~SDKFileHelper () |
| bool16 | IsExisting () const |
| bool16 | IsChosen () const |
| PMString | GetPath () const |
| IDFile | GetIDFile () const |
| IDFile | GetAbsoluteFromRelative (const PMString &relativePath) const |
| PMString | GetParentFolderAsString () const |
Static Public Member Functions | |
| static bool16 | isMacPosixPathEnabled () |
Protected Member Functions | |
| SDKFileHelper () | |
| void | initFromString () |
| void | initFromSysFile () |
| void | traceInitializeDiagnostics (int32 e) const |
| PMString | calcDefaultFileName () const |
| void | setChosen (bool16 chsen) |
| void | setIDFile (const IDFile &file) |
| void | setPath (const PMString &path) |
| PMString | absoluteFromRelative (const PMString &folder, const PMString &path) const |
| bool16 | isAbsolutePath (const PMString &path) const |
| bool16 | isUnixPath (const PMString &path) const |
| bool16 | isMacPath (const PMString &path) const |
| bool16 | isWinPath (const PMString &path) const |
| PMString | getMinusLastElement (const PMString &path) const |
| PMString | getMinusFirstElement (const PMString &path) const |
| PMString | getAsMacPath (const PMString &path) const |
| PMString | getAsWinPath (const PMString &path) const |
Friends | |
| class | SDKFileHelperUnitTest |
Cross-platform abstraction of file that eases working with files. Intended to obviate need for many of the methods in SDKUtilities. Becomes particularly powerful when the mechanism to choose a file is considered, eliminating the need for difficult to write boilerplate to parameterise the file selection dialogs.
| SDKFileHelper::SDKFileHelper | ( | const PMString & | path | ) |
Constructor to use when the path is already known as a string.
| path | path to file of interest |
| SDKFileHelper::SDKFileHelper | ( | const IDFile & | file | ) |
| virtual |
Destructor
| protected |
Default constructor: invoked only from subclasses
| protected |
Make an absolute path given a folder and a relative path
| folder | folder relative to which we're going to navigate |
| path | specifies path of interest |
| protected |
Helper to provide a default file name (Untitled, translated per locale, for instance).
Return the path as a Macintosh format path (pre OS X)
| path | specifies the path of interest |
Return the path as a WIndows format path (not UNC)
| path | specifies the path of interest |
| IDFile SDKFileHelper::GetIDFile | ( | ) | const |
Return string minus the first element from the pathname.
So "\\this\\that\\file" becomes "\\that\\file" and "../../file" becomes "../file"
| path |
return string minus the last element from the pathname.
So "\\this\\that\\file" becomes "\\this\\that"
| path |
| PMString SDKFileHelper::GetParentFolderAsString | ( | ) | const |
| PMString SDKFileHelper::GetPath | ( | ) | const |
Return a string-based representation of the path to this file.
| protected |
| protected |
| protected |
Determine if the passed in string represents an absolute pathname. A win absolute pathname looks like "\\this\\that\\file" A mac absolute pathname looks like "this:that:file" a unix absolute pathname looks like "/this/that/file"
| path | the path passed in. |
| bool16 SDKFileHelper::IsChosen | ( | ) | const |
Determine if a IDFile has been acquired as a result of a 'Choice' by the user. Convenience method for the SDKxxxChooser methods to represent whether a choice occurred and expose this.
| bool16 SDKFileHelper::IsExisting | ( | ) | const |
Tests whether the file exists. If the file has not yet been created or an invalid path or IDFile has been specified then this should be false.
| protected |
Determines whether the path passed in can be a mac path.
This is not a firm test of what constitutes a mac path, more just a heuristic that answers, "given a path, is it plausible it is a mac path?".
| path | the path used for the test. |
| static |
Returns the Mac Path-Style
| protected |
Determines if the passed in string represents a UNIX path.
This is not a firm test of what constitutes a UNIX path, more just a heuristic that answers, "given a path, is it plausible it is a UNIX path?".
| path | the path used for the test. |
| protected |
Determines whether the path passed in could be a win path.
This is not a firm test of what constitutes a win path, more just a heuristic that answers, "given a path, is it plausible it is a win path?".
| path | the path used for the test. |
| protected |
Mutator for the 'chosen' attribute; this is protected because client code should not be able to indicate that an end-user has made a choice.
| chsen | IN specifies the new state for this attribute |
| protected |
Mutator for the IDFile stored in the instance; deliberately not exposed to client code. We need this method to let the derived classes that return a IDFile from a choice set the state of the instance.
| file | IN path in file system to file. |
| protected |
Mutator for the PMString path stored in the instance; deliberately not exposed to client code. We need
| path | IN path to file |
| protected |
Report problems in creating a IDFile from a PMString
| e | IN error number for core filename initialisation (see ICoreFilename) |