1 #pragma once
2 
3 #ifndef TFXSET_INCLUDED
4 #define TFXSET_INCLUDED
5 
6 #include "tcommon.h"
7 
8 #undef DVAPI
9 #undef DVVAR
10 #ifdef TOONZLIB_EXPORTS
11 #define DVAPI DV_EXPORT_API
12 #define DVVAR DV_EXPORT_VAR
13 #else
14 #define DVAPI DV_IMPORT_API
15 #define DVVAR DV_IMPORT_VAR
16 #endif
17 
18 #include <set>
19 #include <map>
20 #include <string>
21 
22 class TFx;
23 class TXsheetFx;
24 class TOStream;
25 class TIStream;
26 
27 class DVAPI TFxSet {
28 protected:
29   std::set<TFx *> m_fxs;
30   // TXsheetFx *m_xsheetFx;
31 
32 public:
33   TFxSet();
34   virtual ~TFxSet();
35 
36   void addFx(TFx *fx);
37   bool removeFx(TFx *fx);
containsFx(TFx * fx)38   bool containsFx(TFx *fx) { return m_fxs.count(fx) > 0; }
39 
40   // n.b. aggiunge m_fxs a fxs senza fare clear di quest'ultimo
41   void getFxs(std::set<TFx *> &fxs);
42 
43   int getFxCount() const;
44   TFx *getFx(int index) const;
45   TFx *getFx(const std::string &id) const;
46 
47   // TXsheetFx *getXsheetFx() const {
48   //  return m_xsheetFx;
49   //}
50 
51   void clear();
52 
53   virtual void saveData(TOStream &os, int occupiedColumnCount);
54   virtual void loadData(TIStream &os);
55 
56 private:
57   // not implemented
58   TFxSet(const TFxSet &);
59   TFxSet &operator=(const TFxSet &);
60 };
61 
62 // helper functions
63 DVAPI TFx *searchFx(const std::map<TFx *, TFx *> &table, TFx *fx);
64 void DVAPI updateFxLinks(const std::map<TFx *, TFx *> &table);
65 
66 #endif
67