Drive, path, filename and extention parser

3 posts / 0 new
Last post
ezyclie
ezyclie's picture
Offline
Mobile Wizard
Joined: 4 Mar 2010
Posts:
Drive, path, filename and extention parser

Hi,

I know its easy to make a funtion to do those functionalitiesbut i think its nice we have a built in parser to do those functionalities.

Thanks

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Alex Jonsson
alexj's picture
Offline
Mobile Conjurer
Joined: 8 Sep 2009
Posts:

Good idea, indeed. I've shared this with the dev team. Feel free to expand on this, for use as input to the formulation of a corresponding sprint story.

best
Alex

ezyclie
ezyclie's picture
Offline
Mobile Wizard
Joined: 4 Mar 2010
Posts:

Great!

This is the class that i want:

CFileParser::CFileParser() {
    public:
        // const String &name - The file specification to be parsed. 
        CFileParser(const String &name);
        ~CFilePArser();

    private:
        enum TField {EDrive, EPath, EName, EExt, EMaxFields};

    public:
        void addDir(String dirName);
        String FullName();
        char drive();
        String path();
        String driveAndPath();
        String name();
        String ext();
        String nameAndExt();
        bool drivePresent();
        bool PathPresent();
        void popDir();

    private:
        String name;

}

Description:
void addDir(String dirName) - Adds a single directory onto the end of the path in the fully parsed specification.
String FullName() - Gets the complete file specification(Drive letter:/path/filename.extension).
char drive() - Gets the drive letter.
String path()- Gets the drive path.
String driveAndPath() - Gets the drive and path.
String name() - Gets the filename.
String ext() - Gets the extension
String nameAndExt() - Gets the name and extension
bool drivePresent() - Tests whether a drive is present.
bool PathPresent() - Tests whether a path is present.
void popDir() - Removes the last directory from the path in the fully parsed specification.