| 1 |
#ifndef MNMODEL_H |
| 2 |
#define MNMODEL_H |
| 3 |
|
| 4 |
#include <wx/wx.h> |
| 5 |
#include <wx/treebase.h> |
| 6 |
|
| 7 |
#include "config.h" |
| 8 |
|
| 9 |
#define MAX_WIKI_TEXT_SIZE 10000 |
| 10 |
#define MAX_BUF_SIZE 1024 |
| 11 |
#define EXT_TAG ".txt" |
| 12 |
#define DATE_TAG ":''DATE'':" |
| 13 |
#define TYPE_TAG ":''TYPE'':" |
| 14 |
#define NEW_DATA DATE_TAG " %Y/%m/%d %H:%M:%S\n\n" TYPE_TAG " memo\n---------------------------------------------------------\n" |
| 15 |
|
| 16 |
#define ALLMEMO_TAG "malon-all" |
| 17 |
#define TYPESEARCH_TAG "malon-type:" |
| 18 |
|
| 19 |
#define CODE_SET_EUC_JP "euc-jp" |
| 20 |
#ifdef __WXMAC__ |
| 21 |
#define CODE_SET_SYSTEM "CP932" |
| 22 |
#endif |
| 23 |
#ifdef __WXCOCOA__ |
| 24 |
#define CODE_SET_SYSTEM "CP932" |
| 25 |
#endif |
| 26 |
#ifdef __WXMSW__ |
| 27 |
#define CODE_SET_SYSTEM "CP932" |
| 28 |
#endif |
| 29 |
#ifdef __WXMOTIF__ |
| 30 |
#define CODE_SET_SYSTEM "eucJP" |
| 31 |
#endif |
| 32 |
#ifdef __WXGTK__ |
| 33 |
#define CODE_SET_SYSTEM "euc-jp" |
| 34 |
#endif |
| 35 |
#ifdef __WXX11__ |
| 36 |
#define CODE_SET_SYSTEM "eucJP" |
| 37 |
#endif |
| 38 |
|
| 39 |
#define MAC_BACKSLASH 0x80 |
| 40 |
|
| 41 |
|
| 42 |
class WikiData : wxTreeItemData{ |
| 43 |
|
| 44 |
public: |
| 45 |
WikiData(wxString* dataDir, const char* fileName, FILE* fp); |
| 46 |
WikiData(wxString* dataDir); |
| 47 |
~WikiData(); |
| 48 |
const wxString* getFileName(); |
| 49 |
const wxString* getSubject(); |
| 50 |
const wxString* getDate(); |
| 51 |
const wxString* getText(); |
| 52 |
void modText(wxString* text); |
| 53 |
void modSubject(wxString* newName); |
| 54 |
void save(); |
| 55 |
void removeDataFile(); |
| 56 |
|
| 57 |
private: |
| 58 |
wxString* subject; |
| 59 |
wxString* dataDirName; |
| 60 |
wxString* fileName; |
| 61 |
wxString* date; |
| 62 |
wxString* text; |
| 63 |
}; |
| 64 |
|
| 65 |
WX_DECLARE_LIST(WikiData, WikiList); |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
class mnModel { |
| 70 |
|
| 71 |
public: |
| 72 |
mnModel(const char* dataDir); |
| 73 |
~mnModel(); |
| 74 |
WikiList* search(const char* searchStr); |
| 75 |
void group(); |
| 76 |
bool normalSearch(char* tokenList[], FILE*fp, char* decodeFileNameBuf); |
| 77 |
bool typeSearch(char* typeStr, FILE*fp); |
| 78 |
void addWikiData(WikiData* wikiData); |
| 79 |
void addSearchStr(wxString* searchStr); |
| 80 |
void removeSearchStr(wxString searchStr); |
| 81 |
void modSearchStr(wxString* oldStr, wxString* newStr); |
| 82 |
const wxArrayString* getSearchStrList(); |
| 83 |
WikiData* newWikiData(); |
| 84 |
const wxString* getWikiDataDir(); |
| 85 |
|
| 86 |
private: |
| 87 |
wxString* wikiDataDir; |
| 88 |
wxArrayString* searchStrList; |
| 89 |
}; |
| 90 |
|
| 91 |
|
| 92 |
#endif //MNMODEL_H |