1 /*
2 
3   tag::write::file applicative class
4 
5   copyright (c) 2004-2006 squell <squell@alumina.nl>
6 
7   use, modification, copying and distribution of this software is permitted
8   under the conditions described in the file 'COPYING'.
9 
10   Usage:
11 
12   The write::file class implements 'meta' operations for a file
13   (tagging and renaming)
14 
15   Example:
16 
17   int main(int argc, char* argv[])
18   {
19       tag::write::file()
20       .filename("%2")
21       .modify(argv[1], argv);
22   }
23 
24 */
25 
26 #ifndef __ZF_SETFNAME
27 #define __ZF_SETFNAME
28 
29 #include <string>
30 #include "setgroup.h"
31 
32 namespace tag {
33     namespace write {
34 
35         class file : public combined<handler> {
36             std::string m_template;
37             bool m_preserve;
38         public:
file()39             file() : m_preserve(0) { }
40 
rename(std::string fname)41             file& rename(std::string fname)
42             { m_template=fname; return *this; }
43 
44             file& touch(bool t = true)
45             { m_preserve=!t; return *this; }
46 
47             virtual bool vmodify(const char*, const function&) const;
48         };
49     }
50 
51 }
52 
53 #endif
54 
55