1 /*
2 
3   mass_tag engine class (wrapping it all up)
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   Initialize with a tag object (containing changes to make) and a tag::read
13   factory (selecting the data source); the result is a finder object which
14   will apply changes to the files it is specified to operate on.
15 
16   Example:
17 
18     mass_tag( ID3().set(artist, "TAFKAT") ).glob("*.mp3");
19 
20 */
21 
22 #ifndef __ZF_MASS_TAG_HPP
23 #define __ZF_MASS_TAG_HPP
24 
25 #include <string>
26 #include "fileexp.h"
27 #include "set_base.h"
28 
29 namespace fileexp {
30 
31     class mass_tag : public find {
32     public:
mass_tag(const tag::writer & write,const tag::reader & read)33         mass_tag(const tag::writer& write, const tag::reader& read)
34         : tag_writer(write), tag_reader(read), counter(0) { }
mass_tag(const T & tag)35         template<class T> mass_tag(const T& tag)
36         : tag_writer(tag),   tag_reader(tag), counter(0) { }
37 
38         const tag::writer& tag_writer;
39         const tag::reader& tag_reader;
40 
41         static tag::ID3field field(wchar_t c);
42         static std::string   var  (int i);
43         static unsigned long total();
44     protected:
45         unsigned long counter;
46 
47         virtual bool file(const char* name, const record&);
48         virtual bool dir (const record&);
49     };
50 
51 }
52 
53 #endif
54 
55