Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: experimental/visual_studio_plugin/src/MsAd7.BaseImpl/DocumentPosition.cs

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 using System;
2 using System.Collections.Generic;
3 using System.Diagnostics;
4 using System.Linq;
5 using System.Text;
6 using Microsoft.VisualStudio;
7 using Microsoft.VisualStudio.Debugger.Interop;
8
9 namespace Google.MsAd7.BaseImpl
10 {
11 public class DocumentPosition : IDebugDocumentPosition2
12 {
13
14 public DocumentPosition(IDebugDocumentPosition2 pos) {
15 pos.GetDocument(out doc_);
16 pos.GetFileName(out path_);
17 TEXT_POSITION[] begin = new TEXT_POSITION[1];
18 TEXT_POSITION[] end = new TEXT_POSITION[1];
19 pos.GetRange(begin, end);
20 beginPos_ = begin[0];
21 endPos_ = end[0];
22 }
23
24 public DocumentPosition(string path, uint line) {
25 path_ = path;
26 beginPos_.dwLine = line;
27 beginPos_.dwColumn = 0;
28 endPos_ = beginPos_;
29 }
30
31 public string Path {
32 get { return path_; }
33 set { path_ = value; }
34 }
35
36 public TEXT_POSITION BeginPos {
37 get { return beginPos_; }
38 set { beginPos_ = value; }
39 }
40
41 public TEXT_POSITION EndPos {
42 get { return endPos_; }
43 set { endPos_ = value; }
44 }
45
46 public IDebugDocument2 Doc {
47 get { return doc_; }
48 set { doc_ = value; }
49 }
50
51 public override bool Equals(object obj)
52 {
53 DocumentPosition other = obj as DocumentPosition;
54 bool result = (other != null);
55 result = result && (path_ == other.path_);
56 result = result && (beginPos_.Equals(other.beginPos_));
57 result = result && (endPos_.Equals(other.endPos_));
58 return result;
59 }
60
61 public override int GetHashCode()
62 {
63 Int64 accumulator = path_.GetHashCode() << 32 | beginPos_.GetHashCode();
64 accumulator = accumulator.GetHashCode() << 32 | endPos_.GetHashCode();
65 return accumulator.GetHashCode();
66 }
67
68 #region Implementation of IDebugDocumentPosition2
69
70 public int GetFileName(out string pbstrFileName) {
71 Debug.WriteLine("DocumentPosition.GetFileName");
72 pbstrFileName = path_;
73 return VSConstants.S_OK;
74 }
75
76 public int GetDocument(out IDebugDocument2 ppDoc) {
77 Debug.WriteLine("DocumentPosition.GetDocument");
78 ppDoc = doc_;
79 return VSConstants.S_OK;
80 }
81
82 public int IsPositionInDocument(IDebugDocument2 pDoc) {
83 Debug.WriteLine("DocumentPosition.IsPositionInDocument");
84 throw new NotImplementedException();
85 }
86
87 public int GetRange(TEXT_POSITION[] pBegPosition, TEXT_POSITION[] pEndPositi on) {
88 Debug.WriteLine("DocumentPosition.GetRange");
89 pBegPosition[0] = beginPos_;
90 pEndPosition[0] = endPos_;
91 return VSConstants.S_OK;
92 }
93
94 #endregion
95
96 private string path_;
97 private TEXT_POSITION beginPos_ = new TEXT_POSITION();
98 private TEXT_POSITION endPos_ = new TEXT_POSITION();
99 private IDebugDocument2 doc_ = null;
100 }
101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698