📄 feature.lua
字号:
-- tolua: abstract feature class-- Written by Waldemar Celes-- TeCGraf/PUC-Rio-- Jul 1998-- $Id: $-- 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 = {}classFeature.__index = classFeature-- write support codefunction classFeature:supcode ()end-- output tagfunction classFeature:decltype ()end-- register featurefunction classFeature:register ()end-- translate verbatimfunction classFeature:preamble ()end-- check if it is a variablefunction classFeature:isvariable () return falseend-- checi if it requires collectionfunction classFeature:requirecollection (t) return falseend-- build namesfunction classFeature:buildnames () if self.name and self.name~='' then local n = split(self.name,'@') self.name = n[1] if not n[2] then n[2] = applyrenaming(n[1]) end self.lname = n[2] or gsub(n[1],"%[.-%]","") end self.name = getonlynamespace() .. self.nameend-- check if feature is inside a container definition-- it returns the container class name or nil.function classFeature:incontainer (which) if self.parent then local parent = self.parent while parent do if parent.classtype == which then return parent.name end parent = parent.parent end end return nilendfunction classFeature:inclass () return self:incontainer('class')endfunction classFeature:inmodule () return self:incontainer('module')endfunction classFeature:innamespace () return self:incontainer('namespace')end-- return C binding function name based on name-- the client specifies a prefixfunction 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-- endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -