00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef Parser_conf_feature_H
00025 #define Parser_conf_feature_H
00026
00027
00028 #include <set>
00029 #include <stdlib.h>
00030
00031
00032 #include "conf/conf.h"
00033 #include "text/strings.h"
00034 #include "Common/util.h"
00035
00036
00037 #include "TokenPath.h"
00038
00039 #include <map>
00040
00041 namespace Parser {
00042
00043
00044 typedef std::map<char const*, std::set<TokenPath*> > FeatureSpecs;
00045
00046 }
00047 namespace IXE {
00048 using namespace Parser;
00049
00050 template<>
00051 inline void Var<FeatureSpecs>::serialize(std::ostream& os) { }
00052 }
00053 namespace Parser {
00060 class conf_feature : public IXE::Var<FeatureSpecs>
00061 {
00062 public:
00063
00064 conf_feature(char const* name) : IXE::Var<FeatureSpecs>(name) { }
00065
00066 conf_feature(char const* name, char const* value) : IXE::Var<FeatureSpecs>(name) {
00067 parseValue(value);
00068 }
00069
00070 ~conf_feature() { reset(); }
00071
00075 virtual void serialize(std::ostream& os);
00076
00077 protected:
00086 virtual void parseValue(char const*& line);
00087
00088 virtual void reset() {
00089 for (FeatureSpecs::iterator fit = value.begin(); fit != value.end();) {
00090 char const* word = fit->first;
00091 for (std::set<TokenPath*>::iterator pit = fit->second.begin();
00092 pit != fit->second.end(); ++pit)
00093 delete *pit;
00094 value.erase(fit++);
00095 free((void*)word);
00096 }
00097 }
00098 };
00099
00100 }
00101
00102 #endif