1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2013 - TortoiseGit
4 // Copyright (C) 2007 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * \ingroup TortoiseProc
25 * Maintains a list of X string items in the registry and provides methods
26 * to add new items. The list can be used as a 'recently used' or 'recent items' list.
32 virtual ~CRegHistory();
35 /// \param lpszSection the section in the registry, e.g., "Software\\CompanyName\\History"
36 /// \param lpszKeyPrefix the name of the registry values, e.g., "historyItem"
37 /// \return the number of history items loaded
38 size_t Load(LPCTSTR lpszSection
, LPCTSTR lpszKeyPrefix
);
39 /// Saves the history.
41 /// Adds a new string to the history list.
42 bool AddEntry(LPCTSTR szText
);
43 /// Removes the entry at index \c pos.
44 void RemoveEntry(int pos
);
45 /// Sets the maximum number of items in the history. Default is 25.
46 void SetMaxHistoryItems(int nMax
) {m_nMaxHistoryItems
= nMax
;}
47 /// Returns the number of items in the history.
48 size_t GetCount() const {return m_arEntries
.size(); }
49 bool IsEmpty() const { return m_arEntries
.empty(); }
50 /// Returns the entry at index \c pos
51 LPCTSTR
GetEntry(size_t pos
) {return m_arEntries
[pos
].c_str();}
54 std::wstring m_sSection
;
55 std::wstring m_sKeyPrefix
;
56 std::vector
<std::wstring
> m_arEntries
;
57 int m_nMaxHistoryItems
;