1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
-- tolua: abstract feature class
-- Written by Waldemar Celes
-- TeCGraf/PUC-Rio
-- Jul 1998
-- $Id: feature.lua,v 1.2 2001/11/26 23:00:23 darkgod Exp $
-- This code is free software; you can redistribute it and/or modify it.
-- The software provided hereunder is on an "as is" basis, and
-- the author has no obligation to provide maintenance, support, updates,
-- enhancements, or modifications.
-- Feature class
-- Represents the base class of all mapped feature.
classFeature = {
}
-- write support code
function classFeature:supcode ()
end
-- output tag
function classFeature:decltag ()
end
-- register feature
function classFeature:register ()
end
-- unregister feature
function classFeature:unregister ()
end
-- translate verbatim
function classFeature:preamble ()
end
-- check if feature is inside a class definition
-- it returns the feature class name or nil.
function classFeature:inclass ()
if self.parent and self.parent.type == 'class' then
return self.parent.name
else
return nil
end
end
-- check if feature is inside a module
-- it returns the feature module name or nil.
function classFeature:inmodule ()
if self.parent and self.parent.type == 'module' then
return self.parent.name
else
return nil
end
end
-- return C binding function name based on name
-- the client specifies a prefix
-- return C binding function name
-- the client specifies a prefix
function classFeature:cfuncname (n)
if self.parent then
n = self.parent:cfuncname(n)
end
if self.lname then
return n..'_'..self.lname
else
return n..'_'..self.name
end
end
|