00001 /* Copyright (c) MediaArea.net SARL. All Rights Reserved. 00002 * 00003 * Use of this source code is governed by a zlib-style license that can 00004 * be found in the License.txt file in the root of the source tree. 00005 */ 00006 00007 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00008 // 00009 // File name related functions 00010 // 00011 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00012 00013 //--------------------------------------------------------------------------- 00014 #ifndef ZenLib_FileNameH 00015 #define ZenLib_FileNameH 00016 //--------------------------------------------------------------------------- 00017 00018 //--------------------------------------------------------------------------- 00019 #include "ZenLib/Ztring.h" 00020 //--------------------------------------------------------------------------- 00021 00022 namespace ZenLib 00023 { 00024 00025 //*************************************************************************** 00026 /// @brief File name manipulation 00027 //*************************************************************************** 00028 00029 class FileName : public ZenLib::Ztring 00030 { 00031 public : 00032 //Constructor/Destructor 00033 FileName () : Ztring(){}; 00034 FileName (const tstring& str) : Ztring(str){}; 00035 FileName (const tstring& str, size_type pos, size_type n=npos) : Ztring(str, pos, n){}; 00036 FileName (const Char* s, size_type n) : Ztring(s, n){}; 00037 FileName (const Char* s) : Ztring(s){}; 00038 FileName (size_type n, char c) : Ztring(n, c){}; 00039 00040 //Read/Write 00041 ZenLib::Ztring Path_Get () const; 00042 ZenLib::Ztring Name_Get () const; 00043 ZenLib::Ztring Extension_Get () const; 00044 ZenLib::Ztring& Path_Set (const Ztring &Path); 00045 ZenLib::Ztring& Name_Set (const Ztring &Name); 00046 ZenLib::Ztring& Extension_Set (const Ztring &Extension); 00047 00048 //Helpers 00049 static ZenLib::Ztring Path_Get (const Ztring &File_Name) {return ((FileName&)File_Name).Path_Get();}; 00050 static ZenLib::Ztring Name_Get (const Ztring &File_Name) {return ((FileName&)File_Name).Name_Get();}; 00051 static ZenLib::Ztring Extension_Get (const Ztring &File_Name) {return ((FileName&)File_Name).Extension_Get();}; 00052 static ZenLib::Ztring TempFileName_Create (const Ztring &Prefix); 00053 }; 00054 00055 //Platform differences 00056 extern const Char* FileName_PathSeparator; 00057 00058 } //NameSpace 00059 00060 //--------------------------------------------------------------------------- 00061 #ifdef __BORLANDC__ 00062 #pragma warn .8027 00063 #endif 00064 //--------------------------------------------------------------------------- 00065 00066 #endif