internal unsafe SourceLocation(Interop.SourceLocation native) { Native = native; IntPtr file = IntPtr.Zero; uint line, column, offset; Interop.clang_getInstantiationLocation(Native, &file, out line, out column, out offset); Line = (int)line; Column = (int)column; Offset = (int)offset; File = new File(file); }
internal unsafe CodeCompletion(Interop.CompletionResult* native) { IntPtr completionString = native->completionString; Chunks = new Chunk[Interop.clang_getNumCompletionChunks(completionString)]; for (uint i = 0; i < Chunks.Count(); ++i) { Chunks[(int)i] = new Chunk( Interop.clang_getCompletionChunkKind(completionString, i), Interop.clang_getCompletionChunkText(completionString, i).ManagedString); } Priority = Interop.clang_getCompletionPriority(completionString); Availability = Interop.clang_getCompletionAvailability(completionString); Annotations = new string[Interop.clang_getCompletionNumAnnotations(completionString)]; for (uint i = 0; i < Annotations.Count(); ++i) { Annotations[(int)i] = Interop.clang_getCompletionAnnotation(completionString, i).ManagedString; } Comment = Interop.clang_getCompletionAnnotation(completionString).ManagedString; }
internal Cursor(Interop.Cursor native) { Native = native; Kind = Interop.clang_getCursorKind(Native); }
public Cursor GetOverloadedDecl(uint i) { return(new Cursor(Interop.clang_getOverloadedDecl(Native, i))); }
public Type GetArgumentType(uint i) { return(new Type(Interop.clang_getArgType(Native, i))); }
public Cursor GetArgument(uint i) { return(new Cursor(Interop.clang_Cursor_getArgument(Native, i))); }
public override int GetHashCode() { return((int)((long)Interop.clang_hashCursor(Native) - UInt32.MaxValue / 2)); }
/// <summary> /// Determine whether two cursors are equivalent. /// </summary> /// <param name="other">The cursor to compare with.</param> /// <returns></returns> public bool Equals(Cursor other) { return(Interop.clang_equalCursors(Native, other.Native) != 0); }