+
+
+section = luci.util.class()
+
+function section.__init__(self, scheme, co, st, c, s)
+ self.csection = co[s]
+ self.ssection = scheme.packages[c].sections[st]
+ self.cref = { c, s }
+ self.sref = { c, st }
+ self.scheme = scheme
+ self.config = co
+ self.type = luci.uvl.TYPE_SECTION
+end
+
+function section.cid(self)
+ return ( self.cref[1] or '?' ) .. '.' .. ( self.cref[2] or '?' )
+end
+
+function section.sid(self)
+ return ( self.sref[1] or '?' ) .. '.' .. ( self.sref[2] or '?' )
+end
+
+function section.values(self)
+ return self.csection
+end
+
+function section.section(self)
+ return self.ssection
+end
+
+function section.variables(self)
+ local v = { }
+ if self.scheme.packages[self.sref[1]].variables[self.sref[2]] then
+ for o, _ in pairs(
+ self.scheme.packages[self.sref[1]].variables[self.sref[2]]
+ ) do
+ table.insert( v, luci.uvl.option(
+ self.scheme, self.config, self.sref[2],
+ self.cref[1], self.cref[2], o
+ ) )
+ end
+ end
+ return v
+end
+
+
+option = luci.util.class()
+
+function option.__init__(self, scheme, co, st, c, s, o)
+ self.coption = co[s] and co[s][o] or nil
+ self.soption = scheme.packages[c].variables[st][o]
+ self.cref = { c, s, o }
+ self.sref = { c, st, o }
+ self.scheme = scheme
+ self.config = co
+ self.type = luci.uvl.TYPE_OPTION
+end
+
+function option.cid(self)
+ return ( self.cref[1] or '?' ) .. '.' ..
+ ( self.cref[2] or '?' ) .. '.' ..
+ ( self.cref[3] or '?' )
+end
+
+function option.sid(self)
+ return ( self.sref[1] or '?' ) .. '.' ..
+ ( self.sref[2] or '?' ) .. '.' ..
+ ( self.sref[3] or '?' )
+end
+
+function option.value(self)
+ return self.coption
+end
+
+function option.option(self)
+ return self.soption
+end
+
+function option.section(self)
+ return self.scheme.packages[self.sref[1]].sections[self.sref[2]]
+end