winix/core/item.h

116 lines
1.9 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2011, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_core_item
#define headerfile_winix_core_item
#include <string>
#define WINIX_ITEM_FILETYPE_NONE 0
#define WINIX_ITEM_FILETYPE_IMAGE 1
#define WINIX_ITEM_FILETYPE_DOCUMENT 2
#define WINIX_ITEM_FILETYPE_VIDEO 3
#define WINIX_ITEM_FILETYPE_UNKNOWN 10
struct Item
{
long id;
long parent_id;
long user_id;
long group_id;
std::wstring guest_name; // used as a user name when user_id is equal -1
long modification_user_id; // who has modified the item last (not taken into account when checking permissions)
int privileges;
tm date_creation;
tm date_modification;
std::wstring subject;
std::wstring content;
std::wstring url;
int modify_index;
enum ContentType
{
ct_text = 0,
ct_formatted_text,
ct_html,
ct_bbcode,
ct_raw
};
ContentType content_type;
enum Type
{
dir = 0,
file = 1,
symlink = 2,
none = 1000
};
Type type;
// used when type is symlink or to a directory too (function 'default')
std::wstring link_to;
int link_redirect;
// static file (if exists)
std::wstring file_path; // relative file path
int file_fs; // file system type where the file was saved
int file_type; // file type (none, image, doc, etc)
bool has_thumb; // whether or not we have a thumbnail
std::wstring hash; // file hash (md4, md5, ...)
int hash_type; // hash type WINIX_CRYPT_HASH_* (see crypt.h)
size_t file_size; // size of the file
std::wstring html_template;
// sort index used when displaying a group of items
int sort_index;
// methods
Item();
void SetDateToNow();
void SetDateModifyToNow();
void Clear();
private:
// used by the database
long content_id; // content id in 'content' table
int ref; // content references
friend class Db;
friend class DbItemColumns;
};
#endif