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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
Code: SetFromNode
Prefix:
Postfix:
// Ensure that the category vector will be at least as long as the id vector.
// This is import for supporting legacy config files.
while(category.size() < id.size())
category.push_back("?");
Function: GetIndexByID
Declaration: int GetIndexByID(const std::string &s) const;
Definition:
// ****************************************************************************
// Method: PluginManagerAttributes::GetIndexByID
//
// Purpose:
// Find the index of a plugin by its ID, or -1 if it does not exist
//
// Programmer: Jeremy Meredith
// Creation: September 7, 2001
//
// ****************************************************************************
int
PluginManagerAttributes::GetIndexByID(const std::string &s) const
{
for (size_t i=0; i<id.size(); i++)
{
if (id[i] == s)
return i;
}
// not found -- return -1
return -1;
}
Function: AddPlugin
Declaration: void AddPlugin(const std::string &n,const std::string &t,const std::string &v,const std::string &i,bool e);
Definition:
// ****************************************************************************
// Method: PluginManagerAttributes::AddPlugin
//
// Purpose:
// Add a new plugin.
//
// Programmer: Jeremy Meredith
// Creation: September 7, 2001
//
// Modifications:
// Jeremy Meredith, Wed Nov 5 12:51:11 PST 2003
// Added ability to disable plugins by default.
//
// Brad Whitlock, Thu Feb 4 15:26:46 PST 2010
// I added a category field.
//
// ****************************************************************************
void
PluginManagerAttributes::AddPlugin(const std::string &n,
const std::string &t,
const std::string &v,
const std::string &i,
bool e)
{
name.push_back(n);
type.push_back(t);
version.push_back(v);
id.push_back(i);
category.push_back("?");
enabled.push_back(e);
SelectAll();
}
Function: RemovePlugin
Declaration: void RemovePlugin(const std::string &s);
Definition:
// ****************************************************************************
// Method: PluginManagerAttributes::RemovePlugin
//
// Purpose:
// Add a new plugin.
//
// Programmer: Jeremy Meredith
// Creation: September 27, 2001
//
// Modifications:
// Brad Whitlock, Thu Feb 4 15:27:03 PST 2010
// I added a category.
//
// ****************************************************************************
void
PluginManagerAttributes::RemovePlugin(const std::string &s)
{
int index = GetIndexByID(s);
if (index<0)
return;
name .erase(name .begin() + index);
type .erase(type .begin() + index);
version.erase(version .begin() + index);
id .erase(id .begin() + index);
category.erase(category.begin() + index);
enabled.erase(enabled .begin() + index);
SelectAll();
}
Function: UniqueCategories
Declaration: void UniqueCategories(const std::string &t, stringVector &c) const;
Definition:
// ****************************************************************************
// Method: PluginManagerAttributes::UniqueCategories
//
// Purpose:
// Get the list of unique category names for a given plugin type.
//
// Programmer: Brad Whitlock
// Creation: Thu Feb 4 15:31:40 PST 2010
//
// Modifications:
//
// ****************************************************************************
#include <algorithm>
void
PluginManagerAttributes::UniqueCategories(const std::string &t, stringVector &c) const
{
c.clear();
for(size_t i = 0; i < type.size(); ++i)
{
if(type[i] == t)
{
if(i < category.size() &&
category[i] != "?" &&
std::find(c.begin(), c.end(), category[i]) == c.end())
c.push_back(category[i]);
}
}
std::sort(c.begin(), c.end());
}
Function: GetPluginCategoryName
Declaration: std::string GetPluginCategoryName(const std::string &s) const;
Definition:
// ****************************************************************************
// Method: PluginManagerAttributes::GetPluginCategoryName
//
// Purpose:
// Get the category name for the specified plugin.
//
// Programmer: Brad Whitlock
// Creation: Thu Feb 4 15:31:40 PST 2010
//
// Modifications:
//
// ****************************************************************************
std::string
PluginManagerAttributes::GetPluginCategoryName(const std::string &s) const
{
std::string c("?");
int index = GetIndexByID(s);
if(index >= 0 && index < category.size())
{
c = category[index];
}
return c;
}
Function: SetPluginCategoryName
Declaration: void SetPluginCategoryName(const std::string &s, const std::string &c);
Definition:
// ****************************************************************************
// Method: PluginManagerAttributes::SetPluginCategoryName
//
// Purpose:
// Sets the category name for the specified plugin.
//
// Programmer: Brad Whitlock
// Creation: Thu Feb 4 15:31:40 PST 2010
//
// Modifications:
//
// ****************************************************************************
void
PluginManagerAttributes::SetPluginCategoryName(const std::string &s, const std::string &c)
{
int index = GetIndexByID(s);
if(index >= 0 && index < category.size())
{
category[index] = c;
SelectCategory();
}
}
Function: PluginCategoryNameNotSet
Declaration: bool PluginCategoryNameNotSet(const std::string &s) const;
Definition:
// ****************************************************************************
// Method: PluginManagerAttributes::PluginCategoryNameNotSet
//
// Purpose:
// Returns whether the category name has been set.
//
// Programmer: Brad Whitlock
// Creation: Thu Feb 4 15:31:40 PST 2010
//
// Modifications:
//
// ****************************************************************************
bool
PluginManagerAttributes::PluginCategoryNameNotSet(const std::string &s) const
{
return GetPluginCategoryName(s) == "?";
}
|