| 1 | /* |
|---|
| 2 | orxonox - the future of 3D-vertical-scrollers |
|---|
| 3 | |
|---|
| 4 | Copyright (C) 2004 orx |
|---|
| 5 | |
|---|
| 6 | This program is free software; you can redistribute it and/or modify |
|---|
| 7 | it under the terms of the GNU General Public License as published by |
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
|---|
| 9 | any later version. |
|---|
| 10 | |
|---|
| 11 | ### File Specific: |
|---|
| 12 | main-programmer: Benjamin Grauer |
|---|
| 13 | co-programmer: ... |
|---|
| 14 | */ |
|---|
| 15 | |
|---|
| 16 | /*! |
|---|
| 17 | * @file load_param.h |
|---|
| 18 | * A Class and macro-functions, that makes our lives easy to load-in parameters |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #ifndef _LOAD_PARAM_DESCRIPTION_H |
|---|
| 22 | #define _LOAD_PARAM_DESCRIPTION_H |
|---|
| 23 | |
|---|
| 24 | #include "base_object.h" |
|---|
| 25 | |
|---|
| 26 | // Forward Declaration // |
|---|
| 27 | template<class T> class tList; |
|---|
| 28 | class MultiType; |
|---|
| 29 | |
|---|
| 30 | /************************ |
|---|
| 31 | *** DESCRIPTION STUFF *** |
|---|
| 32 | ************************/ |
|---|
| 33 | //! A class that handles the description of loadable parameters |
|---|
| 34 | class LoadParamDescription |
|---|
| 35 | { |
|---|
| 36 | friend class LoadParam; |
|---|
| 37 | friend class LoadClassDescription; |
|---|
| 38 | public: |
|---|
| 39 | LoadParamDescription(const char* paramName); |
|---|
| 40 | ~LoadParamDescription(); |
|---|
| 41 | |
|---|
| 42 | void setDescription(const char* descriptionText); |
|---|
| 43 | /** @returns the descriptionString */ |
|---|
| 44 | const char* getDescription() { return this->description; }; |
|---|
| 45 | |
|---|
| 46 | void print() const; |
|---|
| 47 | private: |
|---|
| 48 | char* paramName; //!< The name of the parameter. |
|---|
| 49 | int paramCount; //!< The count of parameters. |
|---|
| 50 | int* types; //!< What kind of parameters does this function take ?? |
|---|
| 51 | char* description; //!< A longer description about this function. |
|---|
| 52 | char** defaultValues; //!< The 'Default Values'. @TODO MAKE THIS A MULTITYPE |
|---|
| 53 | }; |
|---|
| 54 | |
|---|
| 55 | //! A class for descriptions of a loadable module |
|---|
| 56 | class LoadClassDescription |
|---|
| 57 | { |
|---|
| 58 | friend class CLoadParam; |
|---|
| 59 | public: |
|---|
| 60 | LoadClassDescription(const char* className); |
|---|
| 61 | ~LoadClassDescription(); |
|---|
| 62 | |
|---|
| 63 | static LoadClassDescription* addClass(const char* className); |
|---|
| 64 | LoadParamDescription* addParam(const char* paramName); |
|---|
| 65 | |
|---|
| 66 | static void deleteAllDescriptions(); |
|---|
| 67 | |
|---|
| 68 | static void printAll(const char* fileName = NULL); |
|---|
| 69 | static tList<const char>* searchClassWithShort(const char* classNameBegin); |
|---|
| 70 | // static const LoadParamDescription* getClass(const char* className); |
|---|
| 71 | |
|---|
| 72 | private: |
|---|
| 73 | static bool parametersDescription; //!< if parameter-description should be enabled. |
|---|
| 74 | static tList<LoadClassDescription>* classList; //!< a list, that stores all the loadable classes. (after one instance has been loaded) |
|---|
| 75 | char* className; //!< name of the class |
|---|
| 76 | |
|---|
| 77 | tList<LoadParamDescription>* paramList; //!< List of parameters this class knows. |
|---|
| 78 | }; |
|---|
| 79 | |
|---|
| 80 | #endif /* _LOAD_PARAM_DESCRIPTION_H */ |
|---|