moved implementation of PluginsList into Plugins.cpp

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3723 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-10-12 21:27:09 +00:00
parent c1faddf1fa
commit 8d496ae1be
2 changed files with 35 additions and 34 deletions

View file

@ -14,6 +14,38 @@
extern FILE *g_output;
int PluginsList::add(const char *name, const char *path)
{
int pos=SortedStringListND<struct plugin>::add(name);
if (pos == -1) return 1;
((struct plugin*)gr.get())[pos].path=strings.add(path, strlen(path)+1);
((struct plugin*)gr.get())[pos].dataHandle=-1;
((struct plugin*)gr.get())[pos].unDataHandle=-1;
return 0;
}
char* PluginsList::get(char **name, int *dataHandle/*=0*/, int *uninstDataHandle/*=0*/)
{
if (dataHandle) *dataHandle=-1;
if (uninstDataHandle) *uninstDataHandle=-1;
int v=SortedStringListND<struct plugin>::find(*name);
if (v==-1) return NULL;
strcpy(*name, (char*)strings.get()+((struct plugin*)gr.get())[v].name);
if (dataHandle) *dataHandle=((struct plugin*)gr.get())[v].dataHandle;
if (uninstDataHandle) *uninstDataHandle=((struct plugin*)gr.get())[v].unDataHandle;
return (char*)strings.get()+((struct plugin*)gr.get())[v].path;
}
void PluginsList::setDataHandle(const char *name, int dataHandle, int uninstDataHandle)
{
int v=SortedStringListND<struct plugin>::find(name);
if (v==-1) return;
((struct plugin*)gr.get())[v].dataHandle=dataHandle;
((struct plugin*)gr.get())[v].unDataHandle=uninstDataHandle;
}
void Plugins::FindCommands(char* path, bool displayInfo)
{
if (path)

View file

@ -14,40 +14,9 @@ struct plugin {
class PluginsList : public SortedStringListND<struct plugin>
{
public:
PluginsList() { }
~PluginsList() { }
int add(const char *name, const char *path)
{
int pos=SortedStringListND<struct plugin>::add(name);
if (pos == -1) return 1;
((struct plugin*)gr.get())[pos].path=strings.add(path, strlen(path)+1);
((struct plugin*)gr.get())[pos].dataHandle=-1;
((struct plugin*)gr.get())[pos].unDataHandle=-1;
return 0;
}
char *get(char **name, int *dataHandle=0, int *uninstDataHandle=0)
{
if (dataHandle) *dataHandle=-1;
if (uninstDataHandle) *uninstDataHandle=-1;
int v=SortedStringListND<struct plugin>::find(*name);
if (v==-1) return NULL;
strcpy(*name, (char*)strings.get()+((struct plugin*)gr.get())[v].name);
if (dataHandle) *dataHandle=((struct plugin*)gr.get())[v].dataHandle;
if (uninstDataHandle) *uninstDataHandle=((struct plugin*)gr.get())[v].unDataHandle;
return (char*)strings.get()+((struct plugin*)gr.get())[v].path;
}
void setDataHandle(const char *name, int dataHandle, int uninstDataHandle)
{
int v=SortedStringListND<struct plugin>::find(name);
if (v==-1) return;
((struct plugin*)gr.get())[v].dataHandle=dataHandle;
((struct plugin*)gr.get())[v].unDataHandle=uninstDataHandle;
}
int add(const char *name, const char *path);
char *get(char **name, int *dataHandle=0, int *uninstDataHandle=0);
void setDataHandle(const char *name, int dataHandle, int uninstDataHandle);
};
class Plugins