00001 // ZenLib::FileName - FileName functions 00002 // Copyright (C) 2007-2011 MediaArea.net SARL, Info@MediaArea.net 00003 // 00004 // This software is provided 'as-is', without any express or implied 00005 // warranty. In no event will the authors be held liable for any damages 00006 // arising from the use of this software. 00007 // 00008 // Permission is granted to anyone to use this software for any purpose, 00009 // including commercial applications, and to alter it and redistribute it 00010 // freely, subject to the following restrictions: 00011 // 00012 // 1. The origin of this software must not be misrepresented; you must not 00013 // claim that you wrote the original software. If you use this software 00014 // in a product, an acknowledgment in the product documentation would be 00015 // appreciated but is not required. 00016 // 2. Altered source versions must be plainly marked as such, and must not be 00017 // misrepresented as being the original software. 00018 // 3. This notice may not be removed or altered from any source distribution. 00019 // 00020 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00021 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00022 // 00023 // File name related functions 00024 // 00025 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00026 00027 //--------------------------------------------------------------------------- 00028 #ifndef ZenLib_FileNameH 00029 #define ZenLib_FileNameH 00030 //--------------------------------------------------------------------------- 00031 00032 //--------------------------------------------------------------------------- 00033 #include "ZenLib/Conf.h" 00034 #include "ZenLib/Ztring.h" 00035 //--------------------------------------------------------------------------- 00036 00037 namespace ZenLib 00038 { 00039 00040 //*************************************************************************** 00041 /// @brief File name manipulation 00042 //*************************************************************************** 00043 00044 class FileName : public ZenLib::Ztring 00045 { 00046 public : 00047 //Constructor/Destructor 00048 FileName () : Ztring(){}; 00049 FileName (const tstring& str) : Ztring(str){}; 00050 FileName (const tstring& str, size_type pos, size_type n=npos) : Ztring(str, pos, n){}; 00051 FileName (const Char* s, size_type n) : Ztring(s, n){}; 00052 FileName (const Char* s) : Ztring(s){}; 00053 FileName (size_type n, char c) : Ztring(n, c){}; 00054 00055 //Read/Write 00056 ZenLib::Ztring Path_Get () const; 00057 ZenLib::Ztring Name_Get () const; 00058 ZenLib::Ztring Extension_Get () const; 00059 ZenLib::Ztring& Path_Set (const Ztring &Path); 00060 ZenLib::Ztring& Name_Set (const Ztring &Name); 00061 ZenLib::Ztring& Extension_Set (const Ztring &Extension); 00062 00063 //Helpers 00064 static ZenLib::Ztring Path_Get (const Ztring &File_Name) {return ((FileName&)File_Name).Path_Get();}; 00065 static ZenLib::Ztring Name_Get (const Ztring &File_Name) {return ((FileName&)File_Name).Name_Get();}; 00066 static ZenLib::Ztring Extension_Get (const Ztring &File_Name) {return ((FileName&)File_Name).Extension_Get();}; 00067 static ZenLib::Ztring TempFileName_Create (const Ztring &Prefix); 00068 }; 00069 00070 //Platform differences 00071 extern const Char* FileName_PathSeparator; 00072 00073 } //NameSpace 00074 00075 //--------------------------------------------------------------------------- 00076 #ifdef __BORLANDC__ 00077 #pragma warn .8027 00078 #endif 00079 //--------------------------------------------------------------------------- 00080 00081 #endif