Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

menusystem.h

Go to the documentation of this file.
00001 #ifndef menusystem_h
00002 #define menusystem_h
00003 
00004 #include <list>
00005 #include "menu.h"
00006 
00008 
00009 class MenuSystem
00010 {
00011  private:
00012   class Node;
00013 
00014   typedef std::list<Node*> node_list;
00015   typedef std::list<Node*>::iterator node_list_it;
00016 
00017   std::string current_path;
00018   std::string current_subdir;
00019 
00020   bool is_valid;
00021   bool is_sitemap;
00022  public:
00023 
00024   typedef enum What
00025     {
00026       ITEM,
00027       MENU,
00028       MENUCLOSE,
00029       UNDEFINED  
00030     };
00031 
00032   typedef struct Tag
00033   {
00034     Menu menu;
00035     Item item;
00036     MenuClose menuclose;
00037 
00038     What what;
00039 
00040     Tag() : what( UNDEFINED ) {}
00041     Tag( Menu menu ) : menu( menu ), what( MENU ) {}
00042     Tag( Item item ) : item( item ), what( ITEM ) {}
00043     Tag( MenuClose menuclose ): menuclose(menuclose), what( MENUCLOSE ) {}
00044   };
00045 
00046   typedef std::list<Tag> tag_list;
00047   typedef tag_list::iterator tag_list_it;
00048 
00049   typedef struct Options
00050   {
00051     std::string position;
00052     std::string target;   
00053     std::string root;     
00054     bool is_local_system;
00055     bool is_block_quote;
00056     std::string nav_up;   
00057     std::string nav_down; 
00058     int indent_num;
00059     std::string indent_type;
00060     std::string highlight_type;
00061     std::string highlight_active_type;
00062     std::string highlight_menu_type;
00063     std::string highlight_active_menu_type;
00064     std::string blockquote_principe;
00065     std::string title_type;
00066     std::string title_menu_type;
00067     std::string title_highlight_type;
00068     std::string title_highlight_menu_type;
00069     bool override;
00070   };
00071 
00072  private:
00073   tag_list tlist;
00074 
00075   Node *root; 
00076   Node *root_bak; 
00077 
00078   node_list nodes; 
00079 
00080   Options options;
00081 
00082  public:
00083   MenuSystem( tag_list tlist, Options options );
00084   ~MenuSystem();
00085   
00086   bool operator!() const { return !is_valid; }
00087 
00089   std::string get_html_menu();
00090 
00092   std::string get_sitemap();
00093 
00095   std::string get_link( std::string path, Options o );
00096 
00097  private:
00099   bool create_tree();
00100 
00102   std::string get_childs( Node *parent );
00103 
00105   bool is_in_position( std::string path );
00106 
00108   bool is_position( std::string path );
00109 
00111   int count_directories( std::string text );
00112 
00114   std::string create_item( Node *node, 
00115                            std::string highlight_type,
00116                            std::string highlight_active_type,
00117                            int indent_num, 
00118                            std::string indent_type );
00119 
00120 
00122   std::string get_local_childs( std::string path );
00123 
00125   std::string get_root_dir( Node *node );
00126 
00127   std::string get_pre( Node *node ); 
00128   std::string get_pre_forwards( Node *node ); 
00129   std::string get_pre_backwards( Node *node ); 
00130 
00131   std::string get_post( Node *node ); 
00132   std::string get_post_forwards( Node *node ); 
00133   std::string get_post_backwards( Node *node ); 
00134 
00135   std::string get_href( Node *node ); 
00136 
00137   bool is_extern_link( std::string href );  
00138   bool is_local_link( std::string href ); 
00139 
00140   std::string get_highlight_type( Node* node );
00141   std::string get_highlight_active_type( Node* node );
00142   std::string get_highlight_menu_type( Node* node );
00143   std::string get_highlight_active_menu_type( Node* node );
00144   int get_indent_num( Node* node );
00145   std::string get_indent_type( Node* node );
00146   std::string get_blockquote_principe( Node* node );
00147   std::string get_title_type( Node* node );
00148   std::string get_title_menu_type( Node* node ); 
00149   std::string get_title_highlight_type( Node* node );
00150   std::string get_title_highlight_menu_type( Node* node ); 
00151   std::string get_target( Node* node ); 
00152 };
00153 
00154 #endif

Generated on Tue Nov 20 02:19:52 2001 for Leo<HTML> by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001