/* Copyright 2010-2012 Grégory Soutadé This file is part of KissCount. KissCount is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KissCount is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with KissCount. If not, see . */ #ifndef USER_H #define USER_H #include #include #include #include "Category.hpp" #include "Account.hpp" #include "Operation.hpp" #include "Database.hpp" #include "import/ImportEngine.hpp" class Database; class ImportPattern; class User { public: User(Database* db); ~User(); void InvalidateOperations(); int _id; QString _name; QString _password; std::vector _accounts; std::map >* > _operations; std::vector _categories; std::vector _categoriesFonts; std::map _preferences; std::map _importPatterns; class AccountNotFound {}; class CategoryNotFound {}; Category GetCategory(int catId); QString GetCategoryName(int catId); int GetCategoryId(const QString& catName) throw (CategoryNotFound); const QFont GetCategoryFont(int catId); void AddCategory(const Category& cat); void UpdateCategory(const Category& cat); void DeleteCategory(const Category& cat); Account GetAccount(int accountId) throw (AccountNotFound); QString GetAccountName(int accountId); int GetAccountId(const QString& accountName) throw (AccountNotFound); int GetAccountIdFromAccountNumber(const QString& accountNumber) throw (AccountNotFound); void AddAccount(Account& ac); void UpdateAccount(Account& ac); void DeleteAccount(Account& ac); int GetCategoriesNumber(); int GetAccountsNumber(); int GetOperationsNumber(int month, int year); QString GetLanguage(); void LinkOrUnlinkOperation(Operation& op); void Group(const Operation& op); bool Group(std::vector* ops, const Operation& op); void UnGroup(const Operation& op); void ResolveGroups(int year); void UpdateImportPattern(User* user); private: Database* _db; }; #endif