Marsyas  0.6.0-alpha
/usr/src/RPM/BUILD/marsyas-0.6.0/src/marsyas/FileName.h
Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 1998-2005 George Tzanetakis <gtzan@cs.uvic.ca>
00003 **
00004 ** This program is free software; you can redistribute it and/or modify
00005 ** it under the terms of the GNU General Public License as published by
00006 ** the Free Software Foundation; either version 2 of the License, or
00007 ** (at your option) any later version.
00008 **
00009 ** This program is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 ** GNU General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU General Public License
00015 ** along with this program; if not, write to the Free Software
00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017 */
00018 
00019 
00020 #ifndef MARSYAS_FILENAME_H
00021 #define MARSYAS_FILENAME_H
00022 
00023 #include <vector>
00024 #include <string>
00025 #include <marsyas/export.h>
00026 #include <marsyas/common_header.h>
00027 
00028 namespace Marsyas
00029 {
00039 using std::string;
00040 
00041 class marsyas_EXPORT FileName
00042 {
00043 private:
00044   std::string filename_;
00045 
00046   size_t getLastSlashPos ();
00047   void removeLastSlash ();
00048 
00049 public:
00050   FileName();
00051   FileName(std::string filename);
00052   ~FileName();
00053   std::string fullname();           // full filename (path+file)
00054   std::string name();           // returns just the file (no path)
00055   std::string nameNoExt(); // returns just the file (no path, no ext)
00056   std::string path();   // returns the filename path
00057   std::string ext();                // returns the filename extension
00058   bool isAbsolute();
00059   mrs_bool    isDir (); // true if it is a directory, not a file
00060   std::vector<mrs_string> getFilesInDir (mrs_string wildcard); //get a list of files in the directory
00061   // Append a path element, inserting a path separator if needed:
00062   FileName & append(const string & element);
00063 
00064   static FileName userHomeDir();
00065   static FileName userAppDataDir();
00066 };
00067 
00068 }//namespace Marsyas
00069 
00070 #endif