ZenLib
FileName.h
Go to the documentation of this file.
1 /* Copyright (c) MediaArea.net SARL. All Rights Reserved.
2  *
3  * Use of this source code is governed by a zlib-style license that can
4  * be found in the License.txt file in the root of the source tree.
5  */
6 
7 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8 //
9 // File name related functions
10 //
11 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
12 
13 //---------------------------------------------------------------------------
14 #ifndef ZenLib_FileNameH
15 #define ZenLib_FileNameH
16 //---------------------------------------------------------------------------
17 
18 //---------------------------------------------------------------------------
19 #include "ZenLib/Ztring.h"
20 //---------------------------------------------------------------------------
21 
22 namespace ZenLib
23 {
24 
25 //***************************************************************************
26 /// @brief File name manipulation
27 //***************************************************************************
28 
29 class FileName : public ZenLib::Ztring
30 {
31 public :
32  //Constructor/Destructor
33  FileName () : Ztring(){};
34  FileName (const tstring& str) : Ztring(str){};
35  FileName (const tstring& str, size_type pos, size_type n=npos) : Ztring(str, pos, n){};
36  FileName (const Char* s, size_type n) : Ztring(s, n){};
37  FileName (const Char* s) : Ztring(s){};
38  FileName (size_type n, char c) : Ztring(n, c){};
39 
40  //Read/Write
41  ZenLib::Ztring Path_Get () const;
42  ZenLib::Ztring Name_Get () const;
44  ZenLib::Ztring& Path_Set (const Ztring &Path);
45  ZenLib::Ztring& Name_Set (const Ztring &Name);
46  ZenLib::Ztring& Extension_Set (const Ztring &Extension);
47 
48  //Helpers
49  static ZenLib::Ztring Path_Get (const Ztring &File_Name) {return ((FileName&)File_Name).Path_Get();};
50  static ZenLib::Ztring Name_Get (const Ztring &File_Name) {return ((FileName&)File_Name).Name_Get();};
51  static ZenLib::Ztring Extension_Get (const Ztring &File_Name) {return ((FileName&)File_Name).Extension_Get();};
52  static ZenLib::Ztring TempFileName_Create (const Ztring &Prefix);
53 };
54 
55 //Platform differences
56 extern const Char* FileName_PathSeparator;
57 
58 } //NameSpace
59 
60 //---------------------------------------------------------------------------
61 #ifdef __BORLANDC__
62  #pragma warn .8027
63 #endif
64 //---------------------------------------------------------------------------
65 
66 #endif