00001 /* 00002 * Copyright (c) 2010 Ferruccio Vitale <unixo@devzero.it> 00003 * All rights reserved. 00004 * 00005 * $Id: UserMenu.h 72 2010-08-03 16:43:52Z unixo $ 00006 */ 00007 00008 #ifndef __USERMENU_H__ 00009 #define __USERMENU_H__ 00010 00011 #include "common.h" 00012 #include "User.h" 00013 #include "Exceptions.h" 00014 00015 class UserMenu; 00016 00017 typedef void (UserMenu::*op)(); 00018 00019 class UserMenu 00020 { 00021 private: 00022 User *_currentUser; 00023 map<int, op> usr_operations; 00024 map<int, op> adm_operations; 00025 00026 // user operations 00027 void browseProductCatalog() throw (BadAuthException); 00028 void showProductDetail() throw (BadAuthException); 00029 void showConfigurationByProduct() throw (BadAuthException); 00030 void showUserProfile() throw (BadAuthException); 00031 void placeNewOrder() throw (BadAuthException); 00032 00033 // admin operations 00034 void addNewCategory() throw (BadAuthException); 00035 void addNewProduct() throw (BadAuthException); 00036 void changeProductDetail() throw (BadAuthException); 00037 void disableUser() throw (BadAuthException); 00038 void displayMonthlyTrend() throw (BadAuthException); 00039 00040 void displayUnprivilegedMenu() throw (BadAuthException); 00041 void displayAdminMenu() throw (BadAuthException); 00042 void wait(); 00043 00044 bool getNotEmptyLine(const char *msg, char **buffer, int len, const char *end); 00045 00046 public: 00047 UserMenu(); 00048 ~UserMenu(); 00049 00050 void mainMenu(); 00051 bool login(); 00052 void display() throw (BadAuthException); 00053 void registerNewUser(); 00054 }; 00055 00056 #endif /* __USERMENU_H__ */