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.cpp
76 lines (64 loc) · 1.9 KB
/
MRU.cpp
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
/**
* 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/
*/
#include "StdAfx.h"
#include "Includes.h"
MRU::MRU(std::string name, int count, bool dtbCount) {
this->dtbCount = dtbCount;
this->count = count;
this->name = name;
}
MRU::~MRU() {
//
}
tMRUlist MRU::get(bool rev, const char * buff, int buffSize) {
tMRUlist list;
sMRU mruList;
mruList.name = this->name.c_str();
mruList.count = this->getCount();
mruList.flags = MRU_SET_LOADFIRST;
if (buff) {
mruList.buffer = (char*) buff;
mruList.flags |= MRU_GET_ONEBUFF;
mruList.buffSize = buffSize;
} else {
mruList.flags |= MRU_GET_USETEMP;
mruList.buffSize = 1024;
}
sIMessage_MRU mru(IMC_MRU_GET, &mruList);
Ctrl->IMessage(&mru);
for (int i = 0; i < mru.MRU->count; i++) {
if (!mru.MRU->values[i]) break;
(rev) ?
list.push_back((char*)mru.MRU->values[i]) :
list.push_front((char*)mru.MRU->values[i]);
}
return(list);
}
void MRU::append(std::string current) {
tMRUlist list;
list.push_back(current);
this->append(list);
}
void MRU::append(tMRUlist list) {
int count = this->getCount();
for (tMRUlist::iterator it = list.begin(); it != list.end(); it++) {
sMRU mru;
mru.name = this->name.c_str();
mru.flags = MRU_SET_LOADFIRST | MRU_GET_USETEMP;
mru.current = (*it).c_str();
mru.count = count;
Ctrl->IMessage(&sIMessage_MRU(IMC_MRU_SET, &mru));
}
}