Function: semantic-ctxt-scoped-types-c++-mode

semantic-ctxt-scoped-types-c++-mode is a byte-compiled function defined in c.el.gz.

Signature

(semantic-ctxt-scoped-types-c++-mode &optional POINT)

Documentation

Return a list of tags of CLASS type based on POINT.

DO NOT return the list of tags encompassing point. Override semantic-ctxt-scoped-types in c++-mode buffers.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/c.el.gz
(define-mode-local-override semantic-ctxt-scoped-types c++-mode (&optional point)
  "Return a list of tags of CLASS type based on POINT.
DO NOT return the list of tags encompassing point."
  (when point (goto-char (point)))
  (let ((tagsaroundpoint (semantic-find-tag-by-overlay))
	(tagreturn nil)
	(tmp nil))
    ;; In C++, we want to find all the namespaces declared
    ;; locally and add them to the list.
    (setq tmp (semantic-find-tags-by-class 'type (current-buffer)))
    (setq tmp (semantic-find-tags-by-type "namespace" tmp))
    (setq tmp (semantic-find-tags-by-name "unnamed" tmp))
    (setq tagreturn tmp)
    ;; We should also find all "using" type statements and
    ;; accept those entities in as well.
    (setq tmp (semanticdb-find-tags-by-class 'using))
    (let ((idx 0)
	  (len (semanticdb-find-result-length tmp)))
      (while (< idx len)
	(setq tagreturn
	      (append tagreturn (list (semantic-tag-type
				       (car (semanticdb-find-result-nth tmp idx))))))
	(setq idx (1+ idx))))
    ;; Use the encompassed types around point to also look for using
    ;; statements.  If we deal with types, search inside members; for
    ;; functions, we have to call `semantic-get-local-variables' to
    ;; parse inside the function's body.
    (dolist (cur tagsaroundpoint)
      (cond
       ((and (eq (semantic-tag-class cur) 'type)
	     (setq tmp (semantic-find-tags-by-class
			'using
			(semantic-tag-components (car tagsaroundpoint)))))
	(dolist (T tmp)
	  (setq tagreturn (cons (semantic-tag-type T) tagreturn))))
       ((and (semantic-tag-of-class-p (car (last tagsaroundpoint)) 'function)
	     (setq tmp (semantic-find-tags-by-class
			'using
			(semantic-get-local-variables))))
	(setq tagreturn
	      (append tagreturn
		      (mapcar #'semantic-tag-type tmp))))))
    ;; Return the stuff
    tagreturn))