⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 feature.lua

📁 tolua++是一个对lua进行封装调用的工具
💻 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 (pre)end-- translate verbatimfunction classFeature:preamble ()end-- check if it is a variablefunction classFeature:isvariable () return falseend-- check 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],"%[.-%]","")  self.original_name = self.name  self.lname = clean_template(self.lname) end if not self.is_parameter then	 self.name = getonlynamespace() .. self.name end local parent = classContainer.curr if parent then 	self.access = parent.curr_member_access else endendfunction classFeature:check_public_access()	if self.access and self.access ~= 0 then		return false	end	local parent = classContainer.curr	while parent do		if parent.access and parent.access ~= 0 then			return false		end		parent = parent.prox	end	return trueendfunction clean_template(t)	return string.gsub(t, "[<>:, %*]", "_")end-- 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  n = string.gsub(n..'_'.. (self.lname or self.name), "[<>:, \.%*&]", "_")  return nend

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -