First pass
This commit is contained in:
@@ -28,57 +28,57 @@ class KissCount;
|
||||
|
||||
class ImportPattern {
|
||||
public:
|
||||
wxString pattern;
|
||||
wxString account;
|
||||
wxString category;
|
||||
std::string pattern;
|
||||
int account;
|
||||
int category;
|
||||
} ;
|
||||
|
||||
class ImportEngine {
|
||||
public:
|
||||
static wxString NULL_IMPORT_PATTERN;
|
||||
static std::string NULL_IMPORT_PATTERN;
|
||||
|
||||
ImportEngine();
|
||||
~ImportEngine();
|
||||
|
||||
// Get supported file extension. Example :
|
||||
// "OFX files (*.ofx)|*.ofx"
|
||||
virtual wxString GetFileExt();
|
||||
virtual std::string GetFileExt();
|
||||
|
||||
// Handle the file
|
||||
virtual bool HandleFile(const wxString& path, User* user, Database* db, KissCount* kiss)=0;
|
||||
virtual bool HandleFile(const std::string& path, User* user, Database* db, KissCount* kiss)=0;
|
||||
|
||||
// Parse the file and return accounts that doesn't match
|
||||
virtual void ParseFile(std::vector<Account>& accounts, std::vector<Category>& categories);
|
||||
|
||||
// Final Step
|
||||
virtual std::vector<Operation>* GetOperations(std::map<wxString, wxString>& accounts, std::map<wxString, wxString>& categories);
|
||||
virtual std::vector<Operation>* GetOperations(std::map<int, int>& accounts, std::map<int, int>& categories);
|
||||
|
||||
const std::map<AccountAmount, double, AccountAmount>& GetAccountAmounts();
|
||||
|
||||
void MatchPattern(wxString& key, Operation& op);
|
||||
void MatchPattern(std::string& key, Operation& op);
|
||||
int UpdatePattern(int pos);
|
||||
|
||||
static wxString RemoveUnused(const wxString& s);
|
||||
static std::string RemoveUnused(const std::string& s);
|
||||
|
||||
protected:
|
||||
Database* _db;
|
||||
User* _user;
|
||||
wxString _path;
|
||||
std::string _path;
|
||||
KissCount* _kiss;
|
||||
|
||||
wxString _shortExt;
|
||||
wxString _longExt;
|
||||
std::string _shortExt;
|
||||
std::string _longExt;
|
||||
|
||||
std::map<wxString, wxString> _accounts;
|
||||
std::map<wxString, wxString> _categories;
|
||||
std::map<int, int> _accounts;
|
||||
std::map<int, int> _categories;
|
||||
std::vector<Account> _unresolvedAccounts;
|
||||
std::vector<Category> _unresolvedCategories;
|
||||
std::vector<Operation> _operations;
|
||||
std::map<wxString, wxString> _descriptions;
|
||||
std::map<std::string, std::string> _descriptions;
|
||||
std::map<AccountAmount, double, AccountAmount> _accountAmounts;
|
||||
|
||||
void ApplyPattern(ImportPattern& pattern, Operation& op);
|
||||
wxString FindPattern(wxString& s1, wxString& s2);
|
||||
std::string FindPattern(std::string& s1, std::string& s2);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -80,7 +80,7 @@ void XMLImportEngine::LoadAccountAmount(XMLImportEngine* _this, const char** att
|
||||
if (!strcmp(attrs[i], "account"))
|
||||
accountAmount.account = wxString(attrs[i+1], wxConvUTF8);
|
||||
|
||||
else if (!strcmp(attrs[i], "monthpp"))
|
||||
else if (!strcmp(attrs[i], "month"))
|
||||
{
|
||||
wxString(attrs[i+1], wxConvUTF8).ToLong(&v);
|
||||
accountAmount.month = v;
|
||||
@@ -169,7 +169,7 @@ void XMLImportEngine::LoadOperation(XMLImportEngine* _this, const char** attrs)
|
||||
op.day = v;
|
||||
}
|
||||
|
||||
else if (!strcmp(attrs[i], "monthpp"))
|
||||
else if (!strcmp(attrs[i], "month"))
|
||||
{
|
||||
wxString(attrs[i+1], wxConvUTF8).ToLong(&v);
|
||||
op.month = v;
|
||||
|
||||
Reference in New Issue
Block a user