1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #ifndef FILE_TRACKER_H
6 #define FILE_TRACKER_H
7 
8 #include <IceUtil/Shared.h>
9 #include <Slice/Parser.h>
10 
11 namespace Slice
12 {
13 
14 class FileException : public ::IceUtil::Exception
15 {
16 public:
17 
18     FileException(const char*, int, const std::string&);
19 #ifndef ICE_CPP11_COMPILER
20     ~FileException() throw();
21 #endif
22     virtual std::string ice_id() const;
23     virtual void ice_print(std::ostream&) const;
24 #ifndef ICE_CPP11_MAPPING
25     virtual FileException* ice_clone() const;
26 #endif
27     virtual void ice_throw() const;
28 
29     std::string reason() const;
30 
31 private:
32 
33     static const char* _name;
34     const std::string _reason;
35 };
36 
37 class FileTracker;
38 typedef IceUtil::Handle<FileTracker> FileTrackerPtr;
39 
40 class FileTracker : public ::IceUtil::SimpleShared
41 {
42 public:
43 
44     FileTracker();
45     ~FileTracker();
46 
47     static FileTrackerPtr instance();
48 
49     void setSource(const std::string&);
50     void addFile(const std::string&);
51     void addDirectory(const std::string&);
52     void error();
53     void cleanup();
54     void dumpxml();
55 
56 private:
57 
58     std::list<std::pair< std::string, bool> > _files;
59     std::string _source;
60     std::map<std::string, std::list<std::string> > _generated;
61     std::map<std::string, std::list<std::string> >::iterator _curr;
62 };
63 
64 }
65 
66 #endif
67