Function: semantic-c-check-type-namespace-using
semantic-c-check-type-namespace-using is a byte-compiled function
defined in c.el.gz.
Signature
(semantic-c-check-type-namespace-using TYPE NAMESPACE)
Documentation
Check if TYPE is accessible in NAMESPACE through a using statement.
Returns the original type from the namespace where it is defined, or nil if it cannot be found.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/c.el.gz
(append (list ns) typename)))))))) ;; )
;; This searches a type in a namespace, following through all using
;; statements.
(defun semantic-c-check-type-namespace-using (type namespace)
"Check if TYPE is accessible in NAMESPACE through a using statement.
Returns the original type from the namespace where it is defined,
or nil if it cannot be found."
(let (usings result usingname usingtype unqualifiedname members) ;; shortname tmp
;; Get all using statements from NAMESPACE.
(when (and (setq usings (semantic-tag-get-attribute namespace :members))
(setq usings (semantic-find-tags-by-class 'using usings)))
;; Get unqualified typename.
(when (listp (setq unqualifiedname (semantic-analyze-split-name
(semantic-tag-name type))))
(setq unqualifiedname (car (last unqualifiedname))))
;; Iterate over all using statements in NAMESPACE.
(while (and usings
(null result))
(setq usingname (semantic-analyze-split-name
(semantic-tag-name (car usings)))
usingtype (semantic-tag-type (semantic-tag-type (car usings))))
(cond
((or (string= usingtype "namespace")
(stringp usingname))
;; We are dealing with a 'using [namespace] NAMESPACE;'
;; Search for TYPE in that namespace
(setq result
(semanticdb-typecache-find usingname))
(if (and result
(setq members (semantic-tag-get-attribute result :members))
(setq members (semantic-find-tags-by-name unqualifiedname members)))
;; TYPE is member of that namespace, so we are finished
(setq result (car members))
;; otherwise recursively search in that namespace for an alias
(setq result (semantic-c-check-type-namespace-using type result))
(when result
(setq result (semantic-tag-type result)))))
((and (string= usingtype "class")
(listp usingname))
;; We are dealing with a 'using TYPE;'
(when (string= unqualifiedname (car (last usingname)))
;; We have found the correct tag.
(setq result (semantic-tag-type (car usings))))))
(setq usings (cdr usings))))
result))