winix/templatesnotify/notifypool.h

83 lines
1.3 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfilecmslunotifypool
#define headerfilecmslunotifypool
#include <list>
#include <string>
#include "templates/locale.h"
#define WINIX_NOTIFY_CODE_DIR_ADD 1
#define WINIX_NOTIFY_CODE_DIR_EDIT 2
#define WINIX_NOTIFY_CODE_DIR_DELETE 4
#define WINIX_NOTIFY_CODE_FILE_ADD 8
#define WINIX_NOTIFY_CODE_FILE_EDIT 16
#define WINIX_NOTIFY_CODE_FILE_DELETE 32
// new thread has been starded
#define WINIX_NOTIFY_CODE_THREAD_ADD 64
// someone replayed in a thread
#define WINIX_NOTIFY_CODE_THREAD_REPLAYED 128
// someone edited its post
#define WINIX_NOTIFY_CODE_THREAD_POST_CHANGED 256
#define WINIX_NOTIFY_CODE_THREAD_DELETE 512
struct NotifyMsg
{
int code;
std::wstring item_link; // link to a file or a dir (can be the same as dir_link if the item is a directory)
std::wstring dir_link; // link to a dir
size_t template_index;
};
// used by the second thread (and its templates)
struct NotifyUserMsg
{
std::wstring name;
std::wstring email;
Locale::Lang lang;
};
class NotifyPool
{
public:
bool Empty() const;
size_t Size() const;
NotifyMsg & GetFirst();
void DeleteFirst();
void Add(const NotifyMsg & msg);
private:
std::list<NotifyMsg> notify_pool;
};
#endif