1 /**
2 *  Copyright Mikael H�gdahl - triyana@users.sourceforge.net
3 *
4 *  This source is distributed under the terms of the Q Public License version 1.0,
5 *  created by Trolltech (www.trolltech.com).
6 */
7 
8 #ifndef Import_h
9 #define Import_h
10 
11 #include <MH.h>
12 #include <MHString.h>
13 #include <MHVector.h>
14 
15 class Security;
16 class Account;
17 class Set;
18 class MHCSVFile;
19 
20 
21 
22 /**
23 *  Extends Portfolio2.
24 *  Add methods for dividends.
25 */
26 class Import : public MH {
27 public:
28                             Import (const char* fileName);
29                             ~Import ();
30 
Errors()31     int                     Errors () {return aErrors;}
32     void                    Read ();
Rows()33     int                     Rows () {return aRows;}
34 
35 private:
36     int                     aRows;
37     int                     aErrors;
38     Account*                aAccount;
39     Security*               aSecurity;
40     Set*                    aSet;
41     MHString                aFileName;
42     MHVector*               aAccounts;
43     MHVector*               aGuards;
44     MHVector*               aIni;
45     MHVector                aPortfolios;
46     MHVector                aPrices;
47     MHVector*               aSecurities;
48     MHVector                aSetItems;
49     MHVector*               aSets;
50 
51     void                    cleanup ();
52     void                    importAccount (char action, MHCSVFile* v);
53     void                    importGuard (char action, MHCSVFile* v);
54     void                    importPortfolio (char action, MHCSVFile* v);
55     void                    importPref (char action, MHCSVFile* v);
56     void                    importPrice (char action, MHCSVFile* v);
57     void                    importSecurity (char action, MHCSVFile* v);
58     void                    importSet (char action, MHCSVFile* v);
59     void                    importSetItem (char action, MHCSVFile* v);
60 };
61 
62 #endif
63