Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ca22dc92ab272f4c64fa95bd8b72988c73d1c3dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Copyright (c) 2013 QNX Software Systems and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Andrew Eidsness - Initial implementation
 */

package org.eclipse.cdt.internal.core.dom.ast.tag;

import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.tag.ITagReader;
import org.eclipse.cdt.core.dom.ast.tag.ITagService;

public class TagService implements ITagService {
	/**
	 * First gives the IBinding instance a chance to convert itself, by calling IAdaptable#getAdapter(
	 * ITagReader.class ) on the binding. If the binding doesn't provide an implementation then a simple,
	 * in-memory, non-cached implementation is created and returned.
	 */
	@Override
	public ITagReader findTagReader(IBinding binding) {
		if (binding == null)
			return null;

		// let the binding adapt to its own tag reader
		ITagReader tagReader = (ITagReader) binding.getAdapter(ITagReader.class);
		if (tagReader != null)
			return tagReader;

		return new NonCachedTaggable(binding);
	}
}

Back to the top