From cea2cbc276fc337f95ab665bd766c5a467980e4e Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 20 May 2012 18:11:52 +0000 Subject: project fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@103 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Bonsai/list.h | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 plugins/Bonsai/list.h (limited to 'plugins/Bonsai/list.h') diff --git a/plugins/Bonsai/list.h b/plugins/Bonsai/list.h new file mode 100644 index 0000000000..7143cb0f55 --- /dev/null +++ b/plugins/Bonsai/list.h @@ -0,0 +1,94 @@ +/* +Bonsai plugin for Miranda IM + +Copyright © 2006 Cristian Libotean + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef M_BONSAI_LIST_H +#define M_BONSAI_LIST_H + +#define INITIAL_SIZE 20 + +#include "commonheaders.h" + +#define ID_GROUP 1 +#define ID_TITLE 2 + +struct TPluginOptions{ + WCHAR *szPlugin; + WCHAR *szGroup; + WCHAR *szTitle; + + DWORD pluginHash; + DWORD groupHash; + DWORD titleHash; + + TPluginOptions(const WCHAR *plugin, const WCHAR *group, const WCHAR *title, DWORD pluginHash, DWORD groupHash, DWORD titleHash) + { + szPlugin = _wcsdup(plugin); + szGroup = _wcsdup(group); + szTitle = _wcsdup(title); + this->pluginHash = pluginHash; + this->groupHash = groupHash; + this->titleHash = titleHash; + } + + ~TPluginOptions() + { + free(this->szPlugin); + free(this->szGroup); + free(this->szTitle); + } +}; + +typedef TPluginOptions *PPluginOptions; + +class COptionsList{ + protected: + PPluginOptions *_plugins; + int _count; + int _capacity; + + void Enlarge(int increaseAmount); + void EnsureCapacity(); + + public: + COptionsList(int initialSize = INITIAL_SIZE); + ~COptionsList(); + + void Clear(); + + int Add(const WCHAR *plugin, const WCHAR *group, const WCHAR *title); + int Remove(int index); + int Contains(const WCHAR *plugin, const WCHAR *group, const WCHAR *title) const; + int Index(const WCHAR *plugin, const WCHAR *group, const WCHAR *title) const; + + const PPluginOptions operator [](int index); + + int Count() const; + int Capacity() const; +}; + +extern COptionsList &lstPluginOptions; //list of services + +WCHAR *BuildPluginUniqueID(PPluginOptions plugin, WCHAR *out, int size, int type); +WCHAR *GetPluginGroup(PPluginOptions plugin, WCHAR *group, int count); +WCHAR *GetPluginTitle(PPluginOptions plugin, WCHAR *title, int count); +void SavePluginGroup(PPluginOptions plugin, WCHAR *newGroup); +void SavePluginTitle(PPluginOptions plugin, WCHAR *newTitle); + +#endif //M_SERVICESLIST_LIST_H \ No newline at end of file -- cgit v1.2.3