Function: semantic-tag-protection-c-mode
semantic-tag-protection-c-mode is a byte-compiled function defined in
c.el.gz.
Signature
(semantic-tag-protection-c-mode TAG &optional PARENT)
Documentation
Return the protection of TAG in PARENT.
Override function for semantic-tag-protection.
Override semantic-tag-protection in c-mode buffers.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/c.el.gz
(define-mode-local-override semantic-tag-protection
c-mode (tag &optional parent)
"Return the protection of TAG in PARENT.
Override function for `semantic-tag-protection'."
(let ((mods (semantic-tag-modifiers tag))
(prot nil))
;; Check the modifiers for protection if we are not a child
;; of some class type.
(when (or (not parent) (not (eq (semantic-tag-class parent) 'type)))
(while (and (not prot) mods)
(if (stringp (car mods))
(let ((s (car mods)))
;; A few silly defaults to get things started.
(cond ((or (string= s "extern")
(string= s "export"))
'public)
((string= s "static")
'private))))
(setq mods (cdr mods))))
;; If we have a typed parent, look for :public style labels.
(when (and parent (eq (semantic-tag-class parent) 'type))
(let ((pp (semantic-tag-type-members parent)))
(while (and pp (not (semantic-equivalent-tag-p (car pp) tag)))
(when (eq (semantic-tag-class (car pp)) 'label)
(setq prot
(cond ((string= (semantic-tag-name (car pp)) "public")
'public)
((string= (semantic-tag-name (car pp)) "private")
'private)
((string= (semantic-tag-name (car pp)) "protected")
'protected)))
)
(setq pp (cdr pp)))))
(when (and (not prot) (eq (semantic-tag-class parent) 'type))
(setq prot
(cond ((string= (semantic-tag-type parent) "class") 'private)
((string= (semantic-tag-type parent) "struct") 'public)
(t 'unknown))))
(or prot
(if (and parent (semantic-tag-of-class-p parent 'type))
'public
nil))))