Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream> //write and read a file
- #include <iostream>
- #include <string>
- #include <cstring>
- #include <glob.h>
- #include "../hiberlite/include/hiberlite.h"
- using namespace std;
- using namespace hiberlite;
- class Notification{
- friend class hiberlite::access;
- template<class Archive>
- void hibernate(Archive & ar)
- {
- ar & HIBERLITE_NVP(player);
- ar & HIBERLITE_NVP(type);
- ar & HIBERLITE_NVP(score);
- ar & HIBERLITE_NVP(friend_);
- }
- public:
- const char* player;
- const char* type;
- int score ;
- const char* friend_ ; //seems like friend is aldready used
- };
- HIBERLITE_EXPORT_CLASS(Notification)
- const char* folder = "Notification/";
- const int namesize = 12;
- struct Player{};
- void Opendb(const char* player, Database &db){
- //function that creates the folder name
- char dbFile[namesize + strlen(folder) ];
- strcpy(dbFile, folder );
- strcat(dbFile, player);
- strcat(dbFile, ".db");
- db.open(dbFile);
- }
- void addNotifications(Notification notif){
- Database db;
- Opendb(notif.player, db );
- bean_ptr<Notification> p=db.copyBean(notif);
- }
- void createdb(const char* player){
- Database db;
- Opendb(player, db );
- db.registerBeanClass<Notification>();
- db.dropModel();
- db.createModel();
- }
- void prettyPrint(const char* notif){
- }
- void delNotifications(Notification notif){
- }
- void showNotifications(Player player){
- }
- void addFriend(const char* player){
- }
- void delFriend(const char* player){
- }
- void showFriends(const char* player){
- }
- int main(){
- createdb("marcel");
- Notification notif1; notif1.player = "marcel", notif1.type = "game"; notif1.score = 56;
- Notification notif2; notif2.player = "marcel", notif2.type = "friend"; notif2.friend_ = "jojo";
- addNotifications(notif1);
- addNotifications(notif2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement