示例#1
0
文件: Token.cs 项目: JadeHub/Jade
 internal Token(Library.CXToken handle, TranslationUnit tu)
 {
     //we dont save the handle here as it will be destroyed when the CXTokenSet id disposed
     Kind = Library.clang_getTokenKind(handle);
     Spelling = Library.clang_getTokenSpelling(tu.Handle, handle).ManagedString;
     Location = tu.ItemFactory.CreateSourceLocation(Library.clang_getTokenLocation(tu.Handle, handle));
     Extent = tu.ItemFactory.CreateSourceRange(Library.clang_getTokenExtent(tu.Handle, handle));
 }
示例#2
0
文件: Cursor.cs 项目: JadeHub/Jade
 private unsafe OverriddenCursorSet(Library.CXCursor* handles, uint count, ITranslationUnitItemFactory factory)
 {
     _cursors = new List<Cursor>();
     for (uint i = 0; i < count; i++)
     {
         _cursors.Add(factory.CreateCursor(handles[i]));
     }
 }
示例#3
0
 internal SourceRange(Library.SourceRange handle, ITranslationUnitItemFactory itemFactory)
 {
     Debug.Assert(!handle.IsNull);
     Handle = handle;
     Start = itemFactory.CreateSourceLocation(Library.clang_getRangeStart(Handle));
     End = itemFactory.CreateSourceLocation(Library.clang_getRangeEnd(Handle));
     Debug.Assert(Start <= End);
     Debug.Assert(Start.File == End.File);
 }
示例#4
0
 /// <summary>
 /// Return true if handle represents the expected location
 /// </summary>
 /// <param name="handle"></param>
 /// <param name="expectedFile"></param>
 /// <param name="expectedOffset"></param>
 /// <returns></returns>
 static internal bool IsValid(Library.CXSourceLocation handle, IntPtr expectedFile, int expectedOffset)
 {
     IntPtr file = IntPtr.Zero;
     uint line, column, offset;
     unsafe
     {
         Library.clang_getInstantiationLocation(handle, &file, out line, out column, out offset);
     }
     return (file == expectedFile && offset == expectedOffset);
 }
示例#5
0
 /// <summary>
 /// Create a new Cursor object.
 /// </summary>
 /// <param name="handle">Handle to a non null cursor obect.</param>
 /// <param name="itemFactory">TranslationUnit's item factory / item cache.</param>
 internal Cursor(Library.Cursor handle, ITranslationUnitItemFactory itemFactory)
 {
     Debug.Assert(!handle.IsNull);
     Handle = handle;
     _itemFactory = itemFactory;
     Kind = Library.clang_getCursorKind(Handle);
     Library.CXType typeHandle = Library.clang_getCursorType(Handle);
     if (typeHandle.IsValid)
         _type = _itemFactory.CreateType(typeHandle);
 }
示例#6
0
 internal unsafe SourceLocation(Library.SourceLocation handle, ITranslationUnitItemFactory itemFactory)
 {
     Debug.Assert(!handle.IsNull);
     Handle = handle;
     _itemFactory = itemFactory;
     IntPtr file = IntPtr.Zero;
     uint line, column, offset;
     Library.clang_getInstantiationLocation(Handle, &file, out line, out column, out offset);
     Line = (int)line;
     Column = (int)column;
     Offset = (int)offset;
     if (file != IntPtr.Zero)
     {
         File = _itemFactory.CreateFile(file);
     }
 }
示例#7
0
 internal Type(Library.CXType handle, ITranslationUnitItemFactory itemFactory)
 {
     Debug.Assert(handle.IsValid);
     Handle = handle;
     _itemFactory = itemFactory;
 }
示例#8
0
 internal unsafe TokenSetHandle(TranslationUnit tu, Library.Token* toks, uint count)
 {
     _tu = tu;
     _tokens = toks;
     _count = count;
 }
示例#9
0
文件: Comment.cs 项目: JadeHub/Jade
 internal Comment(Library.CXComment handle)
 {
     _handle = handle;
 }
示例#10
0
 internal Token(Library.Token handle, TranslationUnit tu)
 {
     _tu = tu;
     Handle = handle;
 }
示例#11
0
文件: Type.cs 项目: JadeHub/Jade
 private Type ReturnType(Library.CXType t)
 {
     return t != null && t.IsValid ? _itemFactory.CreateType(t) : null;
 }