summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2012-04-28 15:02:14 +0000
committerrandomdan <randomdan@localhost>2012-04-28 15:02:14 +0000
commitaabce76d60614eabf54246a340498ce6103edf0d (patch)
treea76e099d58a8e06a3267c8e59af0aba24ff69347
parentFixed memory leak in HtmlDocument (free doc) (diff)
downloadproject2-aabce76d60614eabf54246a340498ce6103edf0d.tar.bz2
project2-aabce76d60614eabf54246a340498ce6103edf0d.tar.xz
project2-aabce76d60614eabf54246a340498ce6103edf0d.zip
Render subviews in the order they're defined
Add viewGroup for creating arbitrary nesting Don't error when a previously referenced script file no longer exists, just return not current
-rw-r--r--project2/common/rowView.h2
-rw-r--r--project2/common/viewGroup.cpp27
-rw-r--r--project2/xml/xmlScriptParser.cpp8
3 files changed, 35 insertions, 2 deletions
diff --git a/project2/common/rowView.h b/project2/common/rowView.h
index 9ba4699..534a06f 100644
--- a/project2/common/rowView.h
+++ b/project2/common/rowView.h
@@ -26,7 +26,7 @@ class RowView : public View, public RowProcessor {
Columns viewColumns;
void executeChildren() const;
- typedef ANONSTORAGEOF(View) SubViews;
+ typedef ANONORDEREDSTORAGEOF(View) SubViews;
SubViews subViews;
typedef ANONSTORAGEOF(ValueAggregate) ValueAggregates;
ValueAggregates valueAggregates;
diff --git a/project2/common/viewGroup.cpp b/project2/common/viewGroup.cpp
new file mode 100644
index 0000000..b01f6c8
--- /dev/null
+++ b/project2/common/viewGroup.cpp
@@ -0,0 +1,27 @@
+#include "view.h"
+#include <boost/foreach.hpp>
+#include "presenter.h"
+
+class ViewGroup : public View {
+ public:
+ ViewGroup(ScriptNodePtr s) :
+ SourceObject(s),
+ View(s)
+ {
+ s->script->loader.addLoadTarget(s, Storer::into<ElementLoader>(&subViews));
+ }
+
+ void execute(const MultiRowSetPresenter * presenter) const
+ {
+ presenter->addNewRowSet(name);
+ BOOST_FOREACH(const SubViews::value_type & sq, subViews) {
+ sq->execute(presenter);
+ }
+ presenter->finishRowSet();
+ }
+
+ typedef ANONORDEREDSTORAGEOF(View) SubViews;
+ SubViews subViews;
+};
+
+DECLARE_LOADER("viewgroup", ViewGroup);
diff --git a/project2/xml/xmlScriptParser.cpp b/project2/xml/xmlScriptParser.cpp
index ece6701..71c4bb5 100644
--- a/project2/xml/xmlScriptParser.cpp
+++ b/project2/xml/xmlScriptParser.cpp
@@ -76,7 +76,13 @@ bool
XmlScriptParser::isCurrent() const
{
BOOST_FOREACH(const Files::value_type & f, files) {
- if (boost::filesystem::last_write_time(f.first) != f.second) {
+ try {
+ if (boost::filesystem::last_write_time(f.first) != f.second) {
+ _root.reset();
+ return false;
+ }
+ }
+ catch (const boost::filesystem::filesystem_error &) {
_root.reset();
return false;
}