lubyk logo

Lubyk documentation

C++ Class definition.

(internal) A C++ class/struct definition.

Constructor

.new (def)

Create a new class definition. Most of the attributes are passed with def. Usage example:

local class = dub.Class {
  -- self can be a class or db (root)
  db      = self.db or self,
  parent  = parent,
  name    = name,
  xml     = elem,
  xml_headers  = {
    {path = header.dir .. lub.Dir.sep .. elem.refid .. '.xml', dir = header.dir}
  },
}

Accessors

:fullname ()

The fullname of the class in the form of @parent::ClassName@.

:hasVariables ()

Returns true if the class has variables (public C attributes).

:needCast ()

Return true if the class needs a cast method (it has known superclasses).

:ignoreFunc (name)

Return true if the given function name should be ignored (do not create bindings).

:setName (name)

Set the class name and C++ object creation type.

:setOpt (opt)

Set options (usually from parsed C++ class comment).

Find

:namespace ()

Return the enclosing namespace or nil if none found.

:findChild (name)

Return a child element named name or nil if nothing is found. Uses the database internally.

:method (name)

Return a method from a given @name@.

Iterators

:superclasses ()

Return an iterator over the superclasses of this class.

:constants ()

Return an iterator over the constants defined in this class.

:methods ()

Return an iterator over the methods of this class.

:attributes ()

Return an iterator over the attributes of this class.