summaryrefslogtreecommitdiffstats
path: root/aconf/model/node.lua
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-04-03 10:40:28 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2015-04-10 18:17:00 +0300
commita92dc45aee3f599926c77294328db38c5b2544eb (patch)
tree0f31580b868245cabe733864f9d99901730c3279 /aconf/model/node.lua
parent3baaf91de453d35b095881478be8d88b3fc2b97a (diff)
downloadaconf-a92dc45aee3f599926c77294328db38c5b2544eb.tar.bz2
aconf-a92dc45aee3f599926c77294328db38c5b2544eb.tar.xz
docs: describe functionality used in the dnsmasq modulev0.5.0
Diffstat (limited to 'aconf/model/node.lua')
-rw-r--r--aconf/model/node.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/aconf/model/node.lua b/aconf/model/node.lua
index a9854ce..c1d53e9 100644
--- a/aconf/model/node.lua
+++ b/aconf/model/node.lua
@@ -3,6 +3,7 @@ Copyright (c) 2012-2015 Kaarle Ritvanen
See LICENSE file for license details
--]]
+--- @module aconf.model
local M = {}
local err = require('aconf.error')
@@ -62,6 +63,16 @@ function M.BoundMember:init(parent, name, field)
end
+--- non-leaf object. An instance of this class represents
+-- a non-leaf object in the data model, in the context of a specific
+-- transaction. These instances appear as Lua tables, such that their
+-- children may be read and written by using their relative path name
+-- as the key. If the child is of complex type, it is possible to
+-- assign a structure of Lua tables as the value. This results in
+-- replacing the entire subtree with the provided sturcture. Providing
+-- a string in lieu of a complex value is handled by interpreting the
+-- string as a path and copying the subtree it refers to.
+-- @klass node.TreeNode
M.TreeNode = class()
local function equal_tns(tn1, tn2)
@@ -362,6 +373,12 @@ function M.Collection:init(context, params)
end
+--- list object, inherits @{node.TreeNode}. An instance of this class
+-- represents a list object in the data model, in the context of a
+-- specific transaction. A list is an ordered collection of
+-- members. The path of a list member is that of the list augmented by
+-- the index of the member.
+-- @klass node.List
M.List = class(M.Collection)
local function _ipairs(mt, i)
@@ -430,6 +447,13 @@ function M.List:init(context, params)
end
end
+ --- inserts a member to a list or set
+ -- @function node.insert
+ -- @tparam node.List list list or set
+ -- @param v value to be inserted
+ -- @tparam ?int i index. By default, the element is inserted at the
+ -- end of the list. This parameter is not applicable when inserting
+ -- to a @{node.Set} instance.
function mt.insert(v, i)
assert(v ~= nil)