Carbide.c++

com.nokia.carbide.cpp.epoc.engine.preprocessor
Class DefaultTranslationUnitProvider

java.lang.Object
  extended by com.nokia.carbide.cpp.epoc.engine.preprocessor.DefaultTranslationUnitProvider
All Implemented Interfaces:
ITranslationUnitProvider

public class DefaultTranslationUnitProvider
extends java.lang.Object
implements ITranslationUnitProvider

A default implementation of ITranslationUnitProvider which caches translation units. It keeps a maximum number of translation units in memory at a time. It refreshes a TU when the underlying file's timestamp changes.

See Also:
ITranslationUnitProvider

Method Summary
static DefaultTranslationUnitProvider getInstance()
          Get the singleton instanceof the translation unit provider.
 com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTTranslationUnit getTranslationUnit(java.io.File file, IModelDocumentProvider modelDocumentProvider)
          Locate an existing TU, or load it and parse it.
 void setDebugFlag(boolean flag)
          Configure the debugging flag.
 void setMaxCacheCount(int count)
          Set the maximum number of TU's to keep.
 void setMinimumHitsToKeep(int minHits)
          Set the minimum number of hits setting, which controls the lower limit at which a TU will be kept in the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DefaultTranslationUnitProvider getInstance()
Get the singleton instanceof the translation unit provider. The provider owns the cache of TUs.

Returns:
instance, never null

getTranslationUnit

public com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTTranslationUnit getTranslationUnit(java.io.File file,
                                                                                                 IModelDocumentProvider modelDocumentProvider)
Description copied from interface: ITranslationUnitProvider
Locate an existing TU, or load it and parse it. Listen for future changes to the document contents and identity (via modelDocumentProvider) and to the file.

This represents only the given file (no #includes are expanded).

Specified by:
getTranslationUnit in interface ITranslationUnitProvider
Parameters:
file - the full path to the file
modelDocumentProvider - the provider of IDocument instances for the file.
Returns:
existing or new TU; return null only if the file does not exist.

setDebugFlag

public void setDebugFlag(boolean flag)
Configure the debugging flag. Results are sent to System.out.

Parameters:
flag -

setMaxCacheCount

public void setMaxCacheCount(int count)
Set the maximum number of TU's to keep.

This attempts to reduces the cache.

Parameters:
count - number of TUs, must be nonnegative

setMinimumHitsToKeep

public void setMinimumHitsToKeep(int minHits)
Set the minimum number of hits setting, which controls the lower limit at which a TU will be kept in the cache.

This attempts to reduces the cache.

Parameters:
minHits - minimum hits, must be nonnegative

Carbide.c++