-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNoteBook.h
53 lines (42 loc) · 1.28 KB
/
NoteBook.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#pragma once
#include <stdio.h>
#include "NoteFile.h"
class CNoteManager
{
public:
CNoteManager();
~CNoteManager();
static CNoteManager& GetInstance();
void LoadLog();
void SaveLog( EStatus eStatus , const char *pNoteFile );
EStatus GetLastStatus();
const char *GetLastFile();
int Create( const char *pFileName );
int Read( CNoteFile ¬eFile, const char *pPwd ); // 打开
int Edit( CNoteFile ¬eFile, const char *pPwd ); // 编辑
int Append( CNoteFile ¬eFile, const char *pPwd ); // 追加
int EndEdit( CNoteFile ¬eFile );
int EndAppend( CNoteFile ¬eFile );
int EndRead( CNoteFile ¬eFile );
int Lock( const char *pFileName );
int Unlock( const char *pFileName );
int ChangePassword( EPWDType eType, CNoteFile ¬eFile );
private:
int _Open( CNoteFile ¬eFile, const char *pPwd, bool isRemeberState );
int _Close( CNoteFile ¬eFile, const char *pTextName = NULL );
struct {
EStatus eStatus;
char acNoteFile[MAX_FILENAME_LEN];
} m_tLog;
};
#define g_NoteMgr CNoteManager::GetInstance()
/*
cout << "-- 提示:请问是否创建一个日记文件?--" << endl;
if ( ::GetUserChoice() ){
Create( _pNoteFile );
}else {
cout << "-- 信息:退出 --" << endl;
return 1;
}
err = fopen_s( &fp_note, _pNoteFile, "rb+" );
*/