Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.89 KB | None | 0 0
  1. #include <fstream> //write and read a file
  2. #include <iostream>
  3. #include <string>
  4. #include <cstring>
  5. #include <glob.h>
  6. #include "../hiberlite/include/hiberlite.h"
  7. using namespace std;
  8. using namespace hiberlite;
  9.  
  10. class Notification{
  11.     friend class hiberlite::access;
  12.     template<class Archive>
  13.     void hibernate(Archive & ar)
  14.     {
  15.         ar & HIBERLITE_NVP(player);
  16.         ar & HIBERLITE_NVP(type);
  17.         ar & HIBERLITE_NVP(score);
  18.         ar & HIBERLITE_NVP(friend_);
  19.     }
  20.    
  21. public:
  22.     const char* player;
  23.     const char* type;
  24.     int score ;
  25.     const char* friend_ ; //seems like friend is aldready used
  26. };
  27.  
  28. HIBERLITE_EXPORT_CLASS(Notification)
  29.  
  30. const char* folder = "Notification/";
  31. const int namesize = 12;
  32. struct Player{};
  33.  
  34. void Opendb(const char* player, Database &db){
  35. //function that creates the folder name
  36.     char dbFile[namesize + strlen(folder) ];
  37.     strcpy(dbFile, folder );
  38.     strcat(dbFile, player);
  39.     strcat(dbFile, ".db");
  40.     db.open(dbFile);
  41. }
  42.  
  43. void addNotifications(Notification notif){
  44.     Database db;
  45.     Opendb(notif.player, db );
  46.     bean_ptr<Notification> p=db.copyBean(notif);
  47. }
  48.  
  49. void createdb(const char* player){
  50.     Database db;
  51.     Opendb(player, db );
  52.     db.registerBeanClass<Notification>();
  53.     db.dropModel();
  54.     db.createModel();
  55. }
  56.  
  57. void prettyPrint(const char* notif){
  58.  
  59. }
  60.  
  61.  
  62. void delNotifications(Notification notif){
  63.  
  64.  
  65. }
  66.  
  67. void showNotifications(Player player){
  68.  
  69. }
  70.  
  71. void addFriend(const char* player){
  72.  
  73. }
  74. void delFriend(const char* player){
  75.  
  76. }
  77. void showFriends(const char* player){
  78.  
  79. }
  80.  
  81. int main(){
  82.     createdb("marcel");
  83.     Notification notif1; notif1.player = "marcel", notif1.type = "game"; notif1.score = 56;
  84.     Notification notif2; notif2.player = "marcel", notif2.type = "friend"; notif2.friend_ = "jojo";
  85.     addNotifications(notif1);
  86.     addNotifications(notif2);
  87.     return 0;
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement