Added an append() method to append content to a container.
-Container::Container(const Hash& attrs, Widget& content): Widget(attrs) {
+Container::Container(const Hash& attrs, Widget* content): Widget(attrs) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
cerr << "In Container::Container(attrs = {" /* TODO << attrs */
// FIXME - this->content.push_back(content);
#ifdef DEBUG
cerr << "In Container::Container(attrs = {" /* TODO << attrs */
-Container::Container(Widget& content, const Hash& attrs): Widget(attrs) {
+Container::Container(Widget* content, const Hash& attrs): Widget(attrs) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
cerr << "In Container::Container(content = {" /* TODO << content */
// FIXME - this->content.push_back(content);
#ifdef DEBUG
cerr << "In Container::Container(content = {" /* TODO << content */
string Container::renderContent(HIT& hit) {
stringstream out;
for (Content::iterator i = content.begin(); i != content.end(); i++) {
string Container::renderContent(HIT& hit) {
stringstream out;
for (Content::iterator i = content.begin(); i != content.end(); i++) {
+ out << (*i)->render(hit);
+
+void Container::append(Widget* widget) {
+ content.push_back(widget);
+}
class Container: public Widget {
// Typedefs
protected:
class Container: public Widget {
// Typedefs
protected:
- typedef std::vector<Widget> Content;
+ typedef std::vector<Widget*> Content;
// Attributes.
protected:
// Attributes.
protected:
* @param attrs Widget attributes.
* @param content Content of the widget.
*/
* @param attrs Widget attributes.
* @param content Content of the widget.
*/
- Container(const Hash&, Widget&);
+ Container(const Hash&, Widget*);
* @param content Content of the widget.
* @param attrs Widget attributes.
*/
* @param content Content of the widget.
* @param attrs Widget attributes.
*/
- Container(Widget&, const Hash&);
+ Container(Widget*, const Hash&);
* @return Rendered widget.
*/
virtual string renderContent(HIT&);
* @return Rendered widget.
*/
virtual string renderContent(HIT&);
+
+ /**
+ * Appends a widget to the container.
+ *
+ * @param widget Widget to append.
+ */
+ virtual void append(Widget*);
-Fallback::Fallback(const string& name, const Hash& attrs, Widget& content):
+Fallback::Fallback(const string& name, const Hash& attrs, Widget* content):
Container(attrs, content), name(name) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
Container(attrs, content), name(name) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
-Fallback::Fallback(const string& name, Widget& content, const Hash& attrs):
+Fallback::Fallback(const string& name, Widget* content, const Hash& attrs):
Container(content, attrs), name(name) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
Container(content, attrs), name(name) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
* @param attrs Widget attributes.
* @param content Content of the widget.
*/
* @param attrs Widget attributes.
* @param content Content of the widget.
*/
- Fallback(const string&, const Hash&, Widget&);
+ Fallback(const string&, const Hash&, Widget*);
* @param name Name of the widget.
* @param content Content of the widget.
*/
* @param name Name of the widget.
* @param content Content of the widget.
*/
- Fallback(const string&, Widget&);
+ Fallback(const string&, Widget*);
* @param content Content of the widget.
* @param attrs Widget attributes.
*/
* @param content Content of the widget.
* @param attrs Widget attributes.
*/
- Fallback(const string&, Widget&, const Hash&);
+ Fallback(const string&, Widget*, const Hash&);
-Translate::Translate(const string& name, const Hash& attrs, Widget& content):
+Translate::Translate(const string& name, const Hash& attrs, Widget* content):
Fallback(name, attrs, content) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
Fallback(name, attrs, content) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
-Translate::Translate(const string& name, Widget& content, const Hash& attrs):
+Translate::Translate(const string& name, Widget* content, const Hash& attrs):
Fallback(name, content, attrs) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
Fallback(name, content, attrs) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
* @param attrs Widget attributes.
* @param content Content of the widget.
*/
* @param attrs Widget attributes.
* @param content Content of the widget.
*/
- Translate(const string&, const Hash&, Widget&);
+ Translate(const string&, const Hash&, Widget*);
* @param name Name of the widget.
* @param content Content of the widget.
*/
* @param name Name of the widget.
* @param content Content of the widget.
*/
- Translate(const string&, Widget&);
+ Translate(const string&, Widget*);
* @param content Content of the widget.
* @param attrs Widget attributes.
*/
* @param content Content of the widget.
* @param attrs Widget attributes.
*/
- Translate(const string&, Widget&, const Hash&);
+ Translate(const string&, Widget*, const Hash&);