# BasicPluginInfo.h

Go to the documentation of this file.

    00001 /*******************************************************************\
    00002
    00003               Copyright (C) 2003 Joseph Coffland
    00004
    00005     This program is free software; you can redistribute it and/or
    00006      modify it under the terms of the GNU General Public License
    00007     as published by the Free Software Foundation; either version 2
    00008         of the License, or (at your option) any later version.
    00009
    00010    This program is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013              GNU General Public License for more details.
    00014
    00015   You should have received a copy of the GNU General Public License
    00016      along with this program; if not, write to the Free Software
    00017       Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    00018                            02111-1307, USA.
    00019
    00020             For information regarding this software email
    00021                    jcofflan@users.sourceforge.net
    00022
    00023 \*******************************************************************/
    00024
    00025 #ifndef BASICPLUGININFO_H
    00026 #define BASICPLUGININFO_H
    00027
    00028 #include <iostream>
    00029 #include <string>
    00030 #include <string.h>
    00031
    00032 class BasicPluginInfo {
    00034   std::string name;
    00035
    00037   std::string description;
    00038
    00040   unsigned int numDeps;
    00041
    00043   char **dependencies;
    00044
    00045 public:
    00046   BasicPluginInfo(std::string name, std::string description) :
    00047     name(name), description(description), numDeps(0), dependencies(0) {}
    00048
    00055   BasicPluginInfo(std::string name, std::string description,
    00056                   const unsigned int numDeps, const char *deps[]) :
    00057     name(name), description(description), numDeps(numDeps) {
    00058     dependencies = new char *[numDeps];
    00059
    00060     for (unsigned int i = 0; i < numDeps; i++)
    00061       dependencies[i] = strdup(deps[i]);
    00062   }
    00063
    00064   ~BasicPluginInfo() {
    00065     if (dependencies) {
    00066       for (unsigned int i = 0; i < numDeps; i++)
    00067         delete dependencies[i];
    00068
    00069       delete dependencies;
    00070     }
    00071   }
    00072
    00074   BasicPluginInfo(const BasicPluginInfo &info) :
    00075     name(info.name), description(info.description), numDeps(info.numDeps),
    00076     dependencies(info.dependencies) {}
    00077
    00078   const std::string &getName() const {return name;}
    00079   const std::string &getDescription() const {return description;}
    00080   const unsigned int getNumDeps() const {return numDeps;}
    00081   const std::string getDependency(const int i) const {return dependencies[i];}
    00082
    00083   friend std::ostream &operator<<(std::ostream &, BasicPluginInfo &);
    00084 };
    00085
    00086 std::ostream &operator<<(std::ostream &, BasicPluginInfo &);
    00087 #endif