~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric-updates

« back to all changes in this revision

Viewing changes to src/addins/AspNetAddIn/MonoDevelop.AspNet.Parser.Internal/Location.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-18 08:40:51 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090218084051-gh8m6ukvokbwj7cf
Tags: 1.9.2+dfsg-1ubuntu1
* Merge from Debian Experimental (LP: #330519), remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24
    - Add libmono-cairo1.0-cil to build-deps to fool pkg-config check

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// System.Web.Compilation.Location
 
3
//
 
4
// Authors:
 
5
//      Gonzalo Paniagua Javier (gonzalo@ximian.com)
 
6
//
 
7
// (C) 2003 Ximian, Inc (http://www.ximian.com)
 
8
//
 
9
 
 
10
//
 
11
// Permission is hereby granted, free of charge, to any person obtaining
 
12
// a copy of this software and associated documentation files (the
 
13
// "Software"), to deal in the Software without restriction, including
 
14
// without limitation the rights to use, copy, modify, merge, publish,
 
15
// distribute, sublicense, and/or sell copies of the Software, and to
 
16
// permit persons to whom the Software is furnished to do so, subject to
 
17
// the following conditions:
 
18
// 
 
19
// The above copyright notice and this permission notice shall be
 
20
// included in all copies or substantial portions of the Software.
 
21
// 
 
22
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
23
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
24
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
25
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 
26
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 
27
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 
28
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
29
//
 
30
 
 
31
using MonoDevelop.AspNet.Parser.Dom;
 
32
 
 
33
namespace MonoDevelop.AspNet.Parser.Internal
 
34
{
 
35
        class Location : ILocation
 
36
        {
 
37
                int beginLine, endLine, beginColumn, endColumn;
 
38
                string fileName, plainText;
 
39
                ILocation location;
 
40
                
 
41
                internal Location ()
 
42
                {       
 
43
                }
 
44
 
 
45
                public Location (ILocation location)
 
46
                {
 
47
                        Init (location);
 
48
                }
 
49
 
 
50
                public void Init (ILocation location)
 
51
                {
 
52
                        if (location == null) {
 
53
                                beginLine = 0;
 
54
                                endLine = 0;
 
55
                                beginColumn = 0;
 
56
                                endColumn = 0;
 
57
                                fileName = null;
 
58
                                plainText = null;
 
59
                        } else {
 
60
                                beginLine = location.BeginLine;
 
61
                                endLine = location.EndLine;
 
62
                                beginColumn = location.BeginColumn;
 
63
                                endColumn = location.EndColumn;
 
64
                                fileName = location.Filename;
 
65
                                plainText = location.PlainText;
 
66
                        }
 
67
                        this.location = location;
 
68
                }
 
69
 
 
70
                public string Filename {
 
71
                        get { return fileName; }
 
72
                        set { fileName = value; }
 
73
                }
 
74
 
 
75
                public int BeginLine {
 
76
                        get { return beginLine; }
 
77
                        set { beginLine = value; }
 
78
                }
 
79
 
 
80
                public int EndLine {
 
81
                        get { return endLine; }
 
82
                        set { endLine = value; }
 
83
                }
 
84
 
 
85
                public int BeginColumn {
 
86
                        get { return beginColumn; }
 
87
                        set { beginColumn = value; }
 
88
                }
 
89
 
 
90
                public int EndColumn {
 
91
                        get { return endColumn; }
 
92
                        set { endColumn = value; }
 
93
                }
 
94
 
 
95
                public string PlainText {
 
96
                        get { return plainText; }
 
97
                        set { plainText = value; }
 
98
                }
 
99
                
 
100
                public override string ToString ()
 
101
                {
 
102
                        return string.Format ("{0}({1},{2}-{3},{4})",
 
103
                            System.IO.Path.GetFileName (Filename), BeginLine, BeginColumn, EndLine, EndColumn);
 
104
                }
 
105
                
 
106
                public string FileText {
 
107
                        get {
 
108
                                if (location != null)
 
109
                                        return location.FileText;
 
110
 
 
111
                                return null;
 
112
                        }
 
113
                }
 
114
        }
 
115
}
 
116