kig
argsparser.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KIG_MISC_ARGSPARSER_H
00019 #define KIG_MISC_ARGSPARSER_H
00020
00021 #include "../objects/common.h"
00022
00023 #include <string>
00024
00025 class ObjectImpType;
00026
00106 class ArgsParser
00107 {
00108 public:
00112 enum { Invalid = 0, Valid = 1, Complete = 2 };
00113 struct spec { const ObjectImpType* type; std::string usetext; std::string selectstat; bool onOrThrough;};
00114 private:
00118 std::vector<spec> margs;
00119
00120 spec findSpec( const ObjectImp* o, const Args& parents ) const;
00121 public:
00122 ArgsParser( const struct spec* args, int n );
00123 ArgsParser( const std::vector<spec>& args );
00124 ArgsParser();
00125 ~ArgsParser();
00126
00127 void initialize( const std::vector<spec>& args );
00128 void initialize( const struct spec* args, int n );
00129
00134 ArgsParser without( const ObjectImpType* type ) const;
00135
00136 int check( const Args& os ) const;
00137 int check( const std::vector<ObjectCalcer*>& os ) const;
00143 std::string usetext( const ObjectImp* o, const Args& sel ) const;
00144
00149 std::string selectStatement( const Args& sel ) const;
00150
00151
00152
00153 Args parse( const Args& os ) const;
00154 std::vector<ObjectCalcer*> parse( const std::vector<ObjectCalcer*>& os ) const;
00155
00160 const ObjectImpType* impRequirement( const ObjectImp* o, const Args& parents ) const;
00161
00167 bool isDefinedOnOrThrough( const ObjectImp* o, const Args& parents ) const;
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 bool checkArgs( const std::vector<ObjectCalcer*>& os ) const;
00182 bool checkArgs( const std::vector<ObjectCalcer*>& os, uint minobjects ) const;
00183 bool checkArgs( const Args& os ) const;
00184 bool checkArgs( const Args& os, uint minobjects ) const;
00185 };
00186
00187 #endif