00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _BLACKADDER_H
00024 #define _BLACKADDER_H
00025
00026 #include <list>
00027
00028 typedef std::vector<std::string> string_v;
00029 typedef std::map<std::string,std::string> strstr_m;
00030
00031
00032 typedef struct
00033 {
00034 std::string name;
00035 std::string group_name;
00036 std::string m_namespace;
00037 std::string filename;
00038 int line;
00039 bool bExtern;
00040 bool bUsed;
00041 string_v bases;
00042 string_v using_type;
00043 std::string color;
00044 } CLS;
00045
00046
00047 typedef std::map<std::string,std::vector<std::string> > typedef_m;
00048
00049 typedef struct
00050 {
00051 std::string name;
00052 std::vector<CLS *> added;
00053 typedef_m typedefs;
00054 } NSP;
00055
00056
00057
00058 class BlackAdder
00059 {
00060 public:
00061 BlackAdder();
00062 ~BlackAdder();
00063
00064 CLS *add_class(const std::string& ,string_v& ,const std::string& ,int,bool);
00065 NSP *GetNamespace(const std::string& name,bool add = true);
00066 void MakeDot(const std::string& group_name = "");
00067 void add_using(const std::string& );
00068 void clear_using();
00069 void add_type(CLS *,const std::string& );
00070 void set_typedef(const std::string& nspace,const std::string& ,std::vector<std::string>&);
00071 bool type_lookup(CLS *,const std::string& typ,string_v&,NSP *&);
00072 bool is_class(const std::string& nspace,const std::string& name);
00073
00074 private:
00075 void fix_class();
00076 CLS *find_class(const std::string& ,const std::string& );
00077 bool locate(NSP *base,const char *,NSP *&,CLS *&,bool add = true);
00078 bool has_subclass(NSP *nsp0, CLS *cls0, const std::string& color);
00079 std::list<CLS *> find_base(NSP *nsp, CLS *cls);
00080 void find_color(NSP *nsp, CLS *cls);
00081 CLS *find_class(const std::string& name0);
00082
00083 std::vector<NSP *> m_added;
00084 strstr_m m_using;
00085
00086 };
00087
00088
00089 #endif // _BLACKADDER_H