{"id":75,"date":"2011-03-10T21:49:45","date_gmt":"2011-03-11T02:49:45","guid":{"rendered":"http:\/\/www2.rfdm.com\/blog\/?p=75"},"modified":"2011-03-12T13:41:30","modified_gmt":"2011-03-12T18:41:30","slug":"using-wt-c-web-toolkit-for-a-web-site-map","status":"publish","type":"post","link":"https:\/\/www.rfdm.com\/blog\/?p=75","title":{"rendered":"Using Wt (C++ Web Toolkit) for a web site map"},"content":{"rendered":"<p>It had been many years since I had looked at <a href=\"http:\/\/www.webtoolkit.eu\">Wt<\/a>, a C++ library for developing interactive web applications.  Last weekend, I started using it again for a simple site map that&#8217;s automatically generated so I don&#8217;t have to manually update the map.<\/p>\n<p>The first pass resulted in <a href=\"\/wt\/sitemap.wt\">sitemap<\/a>.  I&#8217;m using a TreeView with Wt::WStandardItem objects.<\/p>\n<p>The <a href=\"\/wt\/sitemap.wt\">sitemap<\/a> application initially generated the TreeView on the fly by traversing the filesystem under my document root, using my existing SiteIndexConfig class (used by my menu generators and my site indexer) for configuration.  I knew from the start that this wouldn&#8217;t work for deployment, since it&#8217;d be too slow with all of the content from my old web server.  But I already had classes to traverse the filesystem and pluck out web pages, find their titles (already stored in Xapian by my indexer), etc.  It worked for a throwaway prototype.<\/p>\n<p>I then wrote a new application to generate the data for <a href=\"\/wt\/sitemap.wt\">sitemap<\/a>, which I named (with no originality) <tt>mksitemap<\/tt>.  It dumps a small binary file from a class named <tt>Dwm::WWW:DirectoryTree<\/tt> (derived from Dwm::DirectoryEntry), which can be directly read to populate a <tt>Dwm::WWW::SiteMap::DirectoryTree<\/tt>.  From the instance of <tt>Dwm::WWW::SiteMap::DirectoryTree<\/tt>, I directly create <tt>Wt::WStandardItem<\/tt> objects for the <tt>Wt::TreeView<\/tt>.<\/p>\n<p>The <a href=\"\/wt\/sitemap.wt\">sitemap<\/a> application itself is fairly small in terms of lines-of-code:<\/p>\n<p><code><br \/>\ndwm@www2:\/home\/dwm\/src\/dwm\/www\/apps\/sitemap% mcloc .<br \/>\n           54 .\/DwmWWWSiteMapApp.cc<br \/>\n           22 .\/DwmWWWSiteMapApp.hh<br \/>\n           43 .\/DwmWWWSiteMapDirectoryTree.cc<br \/>\n           28 .\/DwmWWWSiteMapDirectoryTree.hh<br \/>\n           20 .\/sitemap.cc<br \/>\n          167 TOTAL<br \/>\n<\/code><\/p>\n<p>Obviously this isn&#8217;t counting the more general-purpose classes used by <a href=\"\/wt\/sitemap.wt\">sitemap<\/a>:<\/p>\n<p><code><br \/>\ndwm@www2:\/home\/dwm\/src\/dwm\/www\/classes% mcloc src include<br \/>\n           14 include\/DwmWWW.hh<br \/>\n           27 include\/DwmWWWDirectoryTree.hh<br \/>\n           41 include\/DwmWWWSiteIndexConfig.hh<br \/>\n           17 include\/DwmWWWUtils.hh<br \/>\n           97 src\/DwmWWWDirectoryTree.cc<br \/>\n          243 src\/DwmWWWSiteIndexConfig.ll<br \/>\n          130 src\/DwmWWWUtils.cc<br \/>\n          569 TOTAL<br \/>\n<\/code><\/p>\n<p>I&#8217;m not going to count the lines of code from libDwm; it&#8217;s a significant library, I&#8217;m only using a small part of it in this application, and it&#8217;s no effort to use it since I&#8217;ve been working on it for a decade.  I&#8217;m using the <tt>Dwm::IO<\/tt> templates, the <tt>Dwm::SysLogger<\/tt> class, the <tt>Dwm::StringUtils<\/tt> templates, the <tt>Dwm::DirectoryEntry<\/tt> class and the <tt>Dwm::Signal<\/tt> class since I&#8217;m running under <tt>mod_fastcgi<\/tt>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It had been many years since I had looked at Wt, a C++ library for developing interactive web applications. Last weekend, I started using it again for a simple site map that&#8217;s automatically generated so I don&#8217;t have to manually update the map. The first pass resulted in sitemap. I&#8217;m using a TreeView with Wt::WStandardItem &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.rfdm.com\/blog\/?p=75\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using Wt (C++ Web Toolkit) for a web site map&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,12,13],"tags":[23,43,42],"class_list":["post-75","post","type-post","status-publish","format-standard","hentry","category-computing","category-software-development","category-web-development","tag-c","tag-sitemap","tag-wt"],"_links":{"self":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/75","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=75"}],"version-history":[{"count":13,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/75\/revisions"}],"predecessor-version":[{"id":100,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/75\/revisions\/100"}],"wp:attachment":[{"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rfdm.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}