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:
parent
c1faddf1fa
commit
8d496ae1be
2 changed files with 35 additions and 34 deletions
|
@ -14,6 +14,38 @@
|
||||||
|
|
||||||
extern FILE *g_output;
|
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)
|
void Plugins::FindCommands(char* path, bool displayInfo)
|
||||||
{
|
{
|
||||||
if (path)
|
if (path)
|
||||||
|
|
|
@ -14,40 +14,9 @@ struct plugin {
|
||||||
class PluginsList : public SortedStringListND<struct plugin>
|
class PluginsList : public SortedStringListND<struct plugin>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PluginsList() { }
|
int add(const char *name, const char *path);
|
||||||
~PluginsList() { }
|
char *get(char **name, int *dataHandle=0, int *uninstDataHandle=0);
|
||||||
|
void setDataHandle(const char *name, int dataHandle, int uninstDataHandle);
|
||||||
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;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Plugins
|
class Plugins
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue