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