/* Copyright 2010-2011 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; std::string _name; std::string _password; std::vector _accounts; std::map >* > _operations; std::vector _categories; std::vector _categoriesFonts; std::map _preferences; std::map _importPatterns; class AccountNotFound {}; Category GetCategory(int catId); std::string GetCategoryName(int catId); int GetCategoryId(const std::string& catName); 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); std::string GetAccountName(int accountId); int GetAccountId(const std::string& accountName); void AddAccount(Account& ac); void UpdateAccount(Account& ac); void DeleteAccount(Account& ac); int GetCategoriesNumber(); int GetAccountsNumber(); int GetOperationsNumber(int month, int year); std::string 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