This repository has been archived by the owner on Apr 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMRU.h
91 lines (74 loc) · 2.33 KB
/
MRU.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* MRU class
*
* Licensed under The GNU Lesser General Public License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2005-2006 Sijawusz Pur Rahnama
* @link svn://kplugins.net/kaway2/ kAway2 plugin SVN Repo
* @version $Revision: 6 $
* @modifiedby $LastChangedBy: sija $
* @lastmodified $Date: 2006-02-24 23:19:37 +0100 (Pt, 24 lut 2006) $
* @license http://creativecommons.org/licenses/LGPL/2.1/
*/
#pragma once
typedef std::deque<std::string> tMRUlist;
class MRU {
public:
MRU(std::string name, int count = 100, bool dtbCount = false);
~MRU();
public:
tMRUlist get(bool rev = true, const char * buff = 0, int buffSize = 1024);
void append(std::string current);
void append(tMRUlist list);
inline void set(std::string current) {
this->clear();
this->append(current);
}
inline void set(tMRUlist list) {
this->clear();
this->append(list);
}
inline void clear() {
sMRU mru;
mru.name = this->name.c_str();
mru.count = 0;
Ctrl->IMessage(&sIMessage_MRU(IMC_MRU_SET, &mru));
}
inline int getCount() {
return((this->dtbCount) ? GETINT(this->count) : this->count);
}
/*
* Static methods
*/
inline static tMRUlist get(const char * name, int count = 100, bool rev = true,
const char * buff = 0, int buffSize = 1024) {
MRU mru(name, count);
return(mru.get(rev, buff, buffSize));
}
inline static void append(const char * name, std::string current, int count = 100) {
MRU mru(name, count);
mru.append(current);
}
inline static void append(const char * name, tMRUlist list, int count = 100) {
MRU mru(name, count);
mru.append(list);
}
inline static void set(const char * name, std::string current, int count = 100) {
MRU mru(name, count);
mru.set(current);
}
inline static void set(const char * name, tMRUlist list, int count = 100) {
MRU mru(name, count);
mru.set(list);
}
inline static void clear(const char * name) {
MRU mru(name);
mru.clear();
}
public:
std::string name;
unsigned int count;
bool dtbCount;
};