本文整理汇总了C#中TranslationUnit类的典型用法代码示例。如果您正苦于以下问题:C# TranslationUnit类的具体用法?C# TranslationUnit怎么用?C# TranslationUnit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TranslationUnit类属于命名空间,在下文中一共展示了TranslationUnit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddOrUpdateTranslationUnitsMasked
public ImportResult[] AddOrUpdateTranslationUnitsMasked(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings, bool[] mask)
{
var results =
_fileBasedTranslationProviderLanguageDirection.AddOrUpdateTranslationUnitsMasked(translationUnits,
previousTranslationHashes, settings, mask);
var tmDataAccess = TmDataAccess.OpenConnection(TranslationProvider.Uri);
for (int i = 0; i < results.Length; i++)
{
var result = results[i];
if (result == null) continue;
var translationUnit = translationUnits[i];
if (result.Action == Action.Add || result.Action == Action.Merge || result.Action == Action.Overwrite)
{
var customFieldsValue = new CustomFieldValues
{
FileNameFullPath = translationUnit.GetFilePath(),
ProjectName = translationUnit.GetProjectName()
};
tmDataAccess.AddOrUpdateCustomFields(result.TuId.Id, customFieldsValue);
}
}
return results;
}
示例2: Results
internal unsafe Results(CodeCompletion.Library.CXCodeCompleteResults* handle, TranslationUnit tu)
{
Int64 ii = Library.clang_codeCompleteGetContexts(handle);
_handleToDispose = handle;
_handle = *handle;
_results = new List<Result>();
bool print = _handle.NumberResults <= 100;
for(uint i = 0;i < _handle.NumberResults; i++)
{
//Library.CXCompletionResult r = _handle.Results[i];
Result r = new Result(_handle.Results[i]);
_results.Add(r);
if(print)
System.Diagnostics.Debug.WriteLine(r);
}
if(!print)
System.Diagnostics.Debug.WriteLine("too many results");
/* List<LibClang.Diagnostic> diags = new List<Diagnostic>();
for(uint d = 0; d < Library.clang_codeCompleteGetNumDiagnostics(_handleToDispose); d++)
{
Diagnostic diag = new Diagnostic(Library.clang_codeCompleteGetDiagnostic(handle, d), tu.ItemFactory);
System.Diagnostics.Debug.WriteLine(diag + " " + diag.Location);
}*/
}
示例3: CompleteAt
static unsafe internal Results CompleteAt(TranslationUnit tu, string fileName, int line, int col, LibClang.Library.UnsavedFile[] unsaved)
{
uint options = CodeCompletion.Library.clang_defaultCodeCompleteOptions();
CodeCompletion.Library.CXCodeCompleteResults* results = CodeCompletion.Library.clang_codeCompleteAt(tu.Handle, fileName, (uint)line, (uint)col,
unsaved.Length > 0 ? unsaved : null,
(uint)unsaved.Length,
3);/*
CodeCompletion.Library.clang_defaultCodeCompleteOptions());*/
Int64 p = Library.clang_codeCompleteGetContexts(results);
if (results != null && results->NumberResults > 0)
{
Results rs = new Results(results, tu);
return rs;
}
return null;
}
示例4: Indexer
private Indexer(TranslationUnit tu)
{
unsafe
{
_cbs = new Library.IndexerCallbacks();
_cbs.abortQuery = OnIndexerAbortQuery;
_cbs.diagnostic = OnIndexerDiagnostic;
_cbs.enterMainFile = OnIndexerEnteredMainFile;
_cbs.ppIncludedFile = OnIndexerPPIncludedFile;
_cbs.astImportFile = OnIndexerImportedASTFile;
_cbs.startTU = OnIndexerStartTranslationUnit;
_cbs.index = OnIndexerDeclaration;
_cbs.entityRef = OnIndexerEntityReference;
_includeCallback = OnCxxIncludeVisit;
}
_translationUnit = tu;
}
示例5: AddOrUpdateTranslationUnits
public ImportResult[] AddOrUpdateTranslationUnits(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings)
{
var results = _fileBasedTranslationProviderLanguageDirection.AddOrUpdateTranslationUnits(translationUnits,
previousTranslationHashes, settings);
var tmDataAccess = TmDataAccess.OpenConnection(TranslationProvider.Uri);
for (int i = 0; i < results.Length; i++)
{
var result = results[i];
if (result == null) continue;
var translationUnit = translationUnits[i];
if (result.Action == Action.Add || result.Action == Action.Merge || result.Action == Action.Overwrite)
{
tmDataAccess.AddOrUpdateSourceFile(result.TuId.Id, translationUnit.DocumentProperties.LastOpenedAsPath);
}
}
return results;
}
示例6: AddTranslationUnit
public ImportResult AddTranslationUnit(TranslationUnit translationUnit, ImportSettings settings)
{
var result =
_fileBasedTranslationProviderLanguageDirection.AddTranslationUnit(translationUnit,
settings);
if (result == null) return null;
var tmDataAccess = TmDataAccess.OpenConnection(TranslationProvider.Uri);
if (result.Action == Action.Add || result.Action == Action.Merge || result.Action == Action.Overwrite)
{
var customFieldsValue = new CustomFieldValues
{
FileNameFullPath = translationUnit.GetFilePath(),
ProjectName = translationUnit.GetProjectName()
};
tmDataAccess.AddOrUpdateCustomFields(result.TuId.Id, customFieldsValue);
}
return result;
}
示例7: TranslationUnit
private TranslationUnit(TranslationUnit.Internal native)
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
示例8: __CreateInstance
public static TranslationUnit __CreateInstance(TranslationUnit.Internal native)
{
return new TranslationUnit(native);
}
示例9: TranslationUnit
private TranslationUnit(TranslationUnit.Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
示例10: __CopyValue
private static void* __CopyValue(TranslationUnit.__Internal native)
{
var ret = Marshal.AllocHGlobal(292);
global::CppSharp.Parser.AST.TranslationUnit.__Internal.cctor_1(ret, new global::System.IntPtr(&native));
return ret.ToPointer();
}
示例11: TranslationUnit
internal TranslationUnit(TranslationUnit.Internal* native)
: this(new global::System.IntPtr(native))
{
}
示例12: AddTranslationUnitsMasked
/// <summary>
/// Not required for this implementation.
/// </summary>
/// <param name="translationUnits"></param>
/// <param name="settings"></param>
/// <param name="mask"></param>
/// <returns></returns>
public ImportResult[] AddTranslationUnitsMasked(TranslationUnit[] translationUnits, ImportSettings settings, bool[] mask)
{
throw new NotImplementedException();
}
开发者ID:patrickporter,项目名称:MT-Enhanced-Trados-Plugin,代码行数:11,代码来源:MtTranslationProviderLanguageDirection.cs
示例13: AddTranslationUnits
/// <summary>
/// Not required for this implementation.
/// </summary>
/// <param name="translationUnits"></param>
/// <param name="settings"></param>
/// <returns></returns>
public ImportResult[] AddTranslationUnits(TranslationUnit[] translationUnits, ImportSettings settings)
{
throw new NotImplementedException();
}
开发者ID:patrickporter,项目名称:MT-Enhanced-Trados-Plugin,代码行数:10,代码来源:MtTranslationProviderLanguageDirection.cs
示例14: AddOrUpdateTranslationUnitsMasked
/// <summary>
/// Not required for this implementation.
/// </summary>
/// <param name="translationUnits"></param>
/// <param name="previousTranslationHashes"></param>
/// <param name="settings"></param>
/// <param name="mask"></param>
/// <returns></returns>
public ImportResult[] AddOrUpdateTranslationUnitsMasked(TranslationUnit[] translationUnits, int[] previousTranslationHashes, ImportSettings settings, bool[] mask)
{
ImportResult[] result = { AddTranslationUnit(translationUnits[translationUnits.GetLength(0) - 1], settings) };
return result;
}
开发者ID:patrickporter,项目名称:MT-Enhanced-Trados-Plugin,代码行数:13,代码来源:MtTranslationProviderLanguageDirection.cs
示例15: Token
internal Token(Interop.Token native, TranslationUnit parent) {
Kind = Interop.clang_getTokenKind(native);
Location = new SourceLocation(Interop.clang_getTokenLocation(parent.Native, native));
Extent = new SourceRange(Interop.clang_getTokenExtent(parent.Native, native));
Spelling = Interop.clang_getTokenSpelling(parent.Native, native).ManagedString; //parent.GetText(Extent);
}