BeckyPlugin library  2.4
class library for Becky! plugin
Addrbook.h
1 #ifndef _ADDRBOOK_H
2 #define _ADDRBOOK_H
3 #include <windows.h>
11 #include <stdlib.h>
12 #include <string>
13 #include <map>
14 
15 #include "CrossLink.h"
16 using namespace CLink;
17 #include "VCard.h"
18 
19 typedef void (*FRegist)( LPCTSTR _Address );
20 
22 typedef std::map<std::string,std::string> SBookList;
23 typedef std::map<std::string,std::string>::iterator SBookListIt;
24 
25 // 2011/02/08 Groupindex ポインタを map に格納するように変更してみるも
26 // より遅くなってしまったので却下(笑)
27 // find で実装してみる
28 #if 1
29 class SGroupIndex;
30 typedef std::map<std::string, SGroupIndex *> SGroupIndexList;
31 typedef std::map<std::string, SGroupIndex *>::iterator SGroupIndexListIt;
32 #endif
33 
34 #define HEADER_MAX_LENGTH 1028
35 
36 
39 {
40  const char *Email;
41  char *Name;
42  size_t Length;
43 };
44 
47 {
48  const char *Book;
50  char Path[ _MAX_PATH ];
51 };
52 
55 {
56  const char *Email;
58 };
59 
60 class CBeckyAPI;
63 {
68  typedef bool (*FEachPath)( SChainItem *_Node, char *_Path, void *_UserData );
69 
70 protected:
71  SBookList BookList;
73 
74 #if 1
75  static SGroupIndexList *GroupIndexList;
81  static SGroupIndex *GetGroupIndex( const char *_Path );
82 #endif
83 
90  static bool CreateCallBack( DWORD _UserData, const char *_Path, const char *_FileName, const WIN32_FIND_DATA *_FindData );
96  static bool IndexCallBack( DWORD _UserData, const char *_Path, const char *_FileName, const WIN32_FIND_DATA *_FindData );
102  static bool SubCallBack( DWORD _UserData, const char *_Path, const char *_FileName, const WIN32_FIND_DATA *_FindData );
103 
104 protected:
107  void CreatePathList( LPCTSTR _BasePath );
109  void DeletePathList();
110 
113  bool InsertPathList( std::string _Path );
114 
120  static bool SearchGroup( LPCTSTR _Path, const char *_Email, char *_Name, size_t _Length );
121 
122  // パスの比較
123  // @param _Item パスアイテム
124  // @param _Folder フォルダ名
125  //int ComparePath( LPCTSTR _Item, LPCTSTR _Folder );
126 
132  bool ForEachTrace( SChainItem *_Root, const char *_Path, FEachPath _UserFunc, void *_UserData );
138  bool ForEachNext( SChainItem *_Root, const char *_Path, FEachPath _UserFunc, void *_UserData );
143  static bool Finder( SChainItem *_Node, char *_Path, void *_UserData );
148  static bool PathFinder( SChainItem *_Node, char *_Path, void *_UserData );
149 
154  static bool CardFinder( SChainItem *_Node, char *_Path, void *_UserData );
159  static bool SearchGroup( LPCTSTR _Path, const char *_Email, SVcardItem **_Item );
160 
161 public:
162  char *BasePath;
163 
166  SAddressBook( LPCTSTR _BasePath );
167 
169  virtual ‾SAddressBook();
170 
172  void Rebuild();
173 
179  bool Search( const char *_Email, char *_Name, size_t _Length, LPCTSTR _Book = NULL );
184  bool SearchVCard( const char *_Email, SVcardItem **_Card, LPCTSTR _Book );
185  // v0.3 if return value not NULL, you must free the pointer.
186 // char *GetCurrentBook( LPCSTR _GetCurrentFolder );
187 
192  std::string GetCurrentBook( LPCSTR _DataFolder, LPCSTR _GetCurrentFolder );
196  bool ForEach( FEachPath _UserFunction, void *_UserData );
201  static void CopyName( char *_Name, size_t _Length, char *_Base );
203  SChainItem *GetPathList(){ return PathList; }
204 };
205 
206 #endif // _ADDRBOOK_H
SChainItem * Node
リンクノード
Definition: Addrbook.h:49
const char * Email
メールアドレス
Definition: Addrbook.h:56
const char * Email
メールアドレス
Definition: Addrbook.h:40
トレース検索用構造体.
Definition: Addrbook.h:38
SChainItem * PathList
パスリスト
Definition: Addrbook.h:72
SBookList BookList
アドレスブックリスト(2010/09/10 追加)
Definition: Addrbook.h:71
SVcardItem ** Card
カード
Definition: Addrbook.h:57
アドレスブッククラス.
Definition: Addrbook.h:62
size_t Length
長さ
Definition: Addrbook.h:42
Becky API クラス
Definition: BeckyApi.h:96
const char * Book
ブック
Definition: Addrbook.h:48
VCardトレース検索用構造体.
Definition: Addrbook.h:54
VCARD データ
Definition: VCard.h:16
char * Name
名前
Definition: Addrbook.h:41
関連付け検索用構造体.
Definition: Addrbook.h:46
SChainItem * GetPathList()
パスリスト取得
Definition: Addrbook.h:203
Group.idx クラス
Definition: GroupIndex.h:30