#error Incomplete; Needs work /*============================================================================= * drt/sys/kfname.h * Primitive filename handling functions. * * These functions provide a portable interface to the underlying file * system, providing a system-independent way of specifying and * manipulating file names. * * History * 0.01, 1998-03-21, David R Tribble. * First cut. * * 0.10, 1999-07-04, David R Tribble. * Converted from C++ to C. * * [Public] * Copyright ©1998-1999, by David R. Tribble, all rights reserved. * See "drt/sys/copyr.txt" for more information. *----------------------------------------------------------------------------*/ #ifndef drt_sys_kfname_h #define drt_sys_kfname_h 1 #ifdef __cplusplus extern "C" { #endif /* Identification */ #ifndef NO_H_IDENT static const char drt_sys_kfname_h_id[] = "@(#)drt/sys/kfname.h 0.10"; #endif /* System includes */ #ifndef drt_std_stdio_h #include #define drt_std_stdio_h 1 #endif /* Special includes */ #ifndef drt_sys_kdefs_h #include "kdefs.h" #endif /* Local wrappers */ #include "klib1.h" drt_namespace_begin /* Forward declarations */ struct DrtChar; /*#include "kchar.h" */ struct DrtFilePattern; /*#include "kfpat.h" */ /*----------------------------------------------------------------------------- * Struct DrtFileName * Contains a filename for a file. * * This structure is used as the glue which marries command line filename * arguments to the actual underlying file system, which may reside on a * remote host machine. * * Notes * Stores a filename in a generic, portable form that is independent of * any underlying file system. Functions provide conversions between this * generic form and the form used by the native file system. * * Both normal and wide character functions are provided, for systems that * support either. * * The drt_fname_create() function must be called to actually create a * filename object, which in turn creates an object of the correct derived * subtype which is appropriate for the local file system. * * History * 100, 1998-03-21, David R Tribble. * First cut. * * 200, 1999-07-04, David R Tribble. * Redone. *----------------------------------------------------------------------------*/ #define DrtFileName_VS 200 /* Class version number */ struct DrtFileName; /* Opaque type */ typedef struct DrtFileName DrtFileName_t; /* Public constants */ extern const int DrtFileName_vs; /* Library version number */ extern const unsigned int DrtFileName_MAGIC; /* Struct magic number */ extern const char *const DrtFileName_WILD; /* Wildcard substring */ extern const wchar_t *const DrtFileName_WWILD; /* Wildcard substring */ /* Public functions */ extern struct DrtFileName * drt_fname_create(const char *n); /* Create a filename */ extern struct DrtFileName * drt_fname_wcreate(const wchar_t *n); /* Create a wide filename */ extern struct DrtFileName * drt_fname_copy(const struct DrtFileName *n); /* Clone a filename */ extern void drt_fname_free(struct DrtFileName *n); /* Deallocate a filename */ extern bool drt_fname_is_valid(const struct DrtFileName *n); /* Validate a filename */ extern FILE * drt_fname_open(struct DrtFileName *n, const char *m); /* Open a named file */ ===REDO=== %public: /* Member Functions */ % virtual bool fromNative(const char *n) = 0; % /* Set from a native filename */ % virtual bool fromNativeW(const wchar_t *n) = 0; % /* Set from a native filename */ % % virtual const char * % toNative() = 0; % /* Get native filename */ % virtual const wchar_t * % toNativeW() = 0; % /* Get native filename */ % % bool setHost(const char *n); % /* Set hostname portion */ % bool setDev(const char *n); % /* Set device portion */ % bool setPath(const char *n); % /* Set path prefix portion */ % bool setFile(const char *n); % /* Set filename portion */ % bool setExt(const char *n); % /* Set extension portion */ % bool setVers(const char *n); % /* Set version number portion */ % % bool getHost(char *buf, int len) const; % /* Get hostname portion */ % bool getDev(char *buf, int len) const; % /* Get device portion */ % bool getPath(char *buf, int len) const; % /* Get path prefix portion */ % bool getFile(char *buf, int len) const; % /* Get filename portion */ % bool getExt(char *buf, int len) const; % /* Get extension portion */ % bool getVers(char *buf, int len) const; % /* Get version number portion */ % % const char * getHost() const; % /* Get hostname portion */ % const char * getDev() const; % /* Get device portion */ % const char * getPath() const; % /* Get path prefix portion */ % const char * getFile() const; % /* Get filename portion */ % const char * getExt() const; % /* Get extension portion */ % const char * getVers() const; % /* Get version number portion */ % % int length() const; % /* Get filename size */ % virtual bool isAbs() const = 0; % /* Is an absolute name */ % virtual bool isRemote() const = 0; % /* Is a remote name */ % % bool isSame(const DrtFileName &r) const; % /* Compare filenames */ % bool matches(const DrtFilePattern &r) const; % /* Match filename pattern */ % % FILE * open(Mode m) const; % /* Open the named file */ % % bool setAccess(DrtFileStatus::Access p); % /* Set file permissions */ %}; % ===END REDO=== #include "klib2.h" drt_namespace_end #ifdef __cplusplus } #endif #endif /* drt_sys_kfname_h */ /* End kfname.h */