+function Map.__init__(self, config, ...)
+ Node.__init__(self, ...)
+ self.config = config
+ self.template = "cbi/map"
+end
+
+function Map.render(self)
+ ffluci.template.render(self.template)
+end
+
+function Map.section(self, class, ...)
+ if instanceof(class, AbstractClass) then
+ local obj = class(...)
+ obj.map = self
+ table.insert(self.children, obj)
+ return obj
+ else
+ error("class must be a descendent of AbstractSection")
+ end
+end
+
+
+--[[
+AbstractSection
+]]--
+AbstractSection = class(Node)
+
+function AbstractSection.__init__(self, ...)
+ Node.__init__(self, ...)
+end
+
+function AbstractSection.option(self, class, ...)
+ if instanceof(class, AbstractValue) then
+ local obj = class(...)
+ obj.section = self
+ obj.map = self.map
+ table.insert(self.children, obj)
+ return obj
+ else
+ error("class must be a descendent of AbstractValue")
+ end
+end
+
+
+
+--[[
+NamedSection - A fixed configuration section defined by its name
+]]--
+NamedSection = class(AbstractSection)
+
+function NamedSection.__init__(self, section, ...)
+ AbstractSection.__init__(self, ...)
+ self.section = section
+ self.template = "cbi/nsection"
+end
+
+
+--[[
+TypedSection - A (set of) configuration section(s) defined by the type
+ addremove: Defines whether the user can add/remove sections of this type
+ anonymous: Allow creating anonymous sections
+ valid: a table with valid names or a function returning nil if invalid
+]]--
+TypedSection = class(AbstractSection)
+
+function TypedSection.__init__(self, sectiontype, ...)
+ AbstractSection.__init__(self, ...)
+ self.sectiontype = sectiontype
+ self.template = "cbi/tsection"
+
+ self.addremove = true
+ self.anonymous = false
+ self.valid = nil
+end
+
+
+--[[
+AbstractValue - An abstract Value Type
+ null: Value can be empty
+ valid: A table with valid names or a function returning nil if invalid
+ depends: A table of option => value pairs of which one must be true
+]]--
+AbstractValue = class(Node)
+
+function AbstractValue.__init__(self, option, ...)