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 "functor_list.h" |
---|
25 | #include "base_object.h" |
---|
26 | |
---|
27 | #include "factory.h" |
---|
28 | #include "debug.h" |
---|
29 | #include "substring.h" |
---|
30 | #include "tinyxml.h" |
---|
31 | #include "helper_functions.h" |
---|
32 | |
---|
33 | // Forward Declaration // |
---|
34 | template<class T> class tList; |
---|
35 | |
---|
36 | /************************ |
---|
37 | *** DESCRIPTION STUFF *** |
---|
38 | ************************/ |
---|
39 | //! A class that handles the description of loadable parameters |
---|
40 | class LoadParamDescription |
---|
41 | { |
---|
42 | friend class LoadParamBase; |
---|
43 | friend class LoadClassDescription; |
---|
44 | public: |
---|
45 | LoadParamDescription(const char* paramName); |
---|
46 | ~LoadParamDescription(); |
---|
47 | |
---|
48 | void setDescription(const char* descriptionText); |
---|
49 | /** @returns the descriptionString */ |
---|
50 | const char* getDescription() { return this->description; }; |
---|
51 | |
---|
52 | void print() const; |
---|
53 | private: |
---|
54 | char* paramName; //!< The name of the parameter. |
---|
55 | int paramCount; //!< The count of parameters. |
---|
56 | int* types; //!< What kind of parameters does this function take ?? |
---|
57 | char* description; //!< A longer description about this function. |
---|
58 | char** defaultValues; //!< The 'Default Values'. |
---|
59 | }; |
---|
60 | |
---|
61 | //! A class for descriptions of a loadable module |
---|
62 | class LoadClassDescription |
---|
63 | { |
---|
64 | friend class LoadParamBase; |
---|
65 | public: |
---|
66 | LoadClassDescription(const char* className); |
---|
67 | ~LoadClassDescription(); |
---|
68 | |
---|
69 | static LoadClassDescription* addClass(const char* className); |
---|
70 | LoadParamDescription* addParam(const char* paramName); |
---|
71 | |
---|
72 | static void deleteAllDescriptions(); |
---|
73 | |
---|
74 | static void printAll(const char* fileName = NULL); |
---|
75 | static tList<const char>* searchClassWithShort(const char* classNameBegin); |
---|
76 | // static const LoadParamDescription* getClass(const char* className); |
---|
77 | |
---|
78 | private: |
---|
79 | static bool parametersDescription; //!< if parameter-description should be enabled. |
---|
80 | static tList<LoadClassDescription>* classList; //!< a list, that holds all the loadable classes. (after one instance has been loaded) |
---|
81 | char* className; //!< name of the class |
---|
82 | tList<LoadParamDescription>* paramList; //!< List of parameters this class knows. |
---|
83 | }; |
---|
84 | |
---|
85 | #endif /* _LOAD_PARAM_DESCRIPTION_H */ |
---|