Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / SourceLineInfo.cs / 1305376 / SourceLineInfo.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.Diagnostics; namespace System.Xml.Xsl { [DebuggerDisplay("({Line},{Pos})")] internal struct Location { private ulong value; public int Line { get { return (int)(this.value >> 32); } } public int Pos { get { return (int)(this.value ); } } public Location(int line, int pos) { this.value = (((ulong)line) << 32) | (uint)pos; } public Location(Location that) { this.value = that.value; } public bool LessOrEqual(Location that) { return this.value <= that.value; } } [DebuggerDisplay("{Uri} [{StartLine},{StartPos} -- {EndLine},{EndPos}]")] internal class SourceLineInfo : ISourceLineInfo { protected string uriString; protected Location start; protected Location end; public SourceLineInfo(string uriString, int startLine, int startPos, int endLine, int endPos) : this(uriString, new Location(startLine, startPos), new Location(endLine, endPos)) {} public SourceLineInfo(string uriString, Location start, Location end) { this.uriString = uriString; this.start = start; this.end = end; Validate(this); } public string Uri { get { return this.uriString ; } } public int StartLine { get { return this.start.Line; } } public int StartPos { get { return this.start.Pos ; } } public int EndLine { get { return this.end.Line ; } } public int EndPos { get { return this.end.Pos ; } } public Location End { get { return this.end ; } } public Location Start { get { return this.start ; } } ////// Magic number 0xfeefee is used in PDB to denote a section of IL that does not map to any user code. /// When VS debugger steps into IL marked with 0xfeefee, it will continue the step until it reaches /// some user code. /// protected const int NoSourceMagicNumber = 0xfeefee; public static SourceLineInfo NoSource = new SourceLineInfo(string.Empty, NoSourceMagicNumber, 0, NoSourceMagicNumber, 0); public bool IsNoSource { get { return this.StartLine == NoSourceMagicNumber; } } [Conditional("DEBUG")] public static void Validate(ISourceLineInfo lineInfo) { if (lineInfo.Start.Line == 0 || lineInfo.Start.Line == NoSourceMagicNumber) { Debug.Assert(lineInfo.Start.Line == lineInfo.End.Line); Debug.Assert(lineInfo.Start.Pos == 0 && lineInfo.End.Pos == 0); } else { Debug.Assert(0 < lineInfo.Start.Line && 0 < lineInfo.Start.Pos, "0 < start"); Debug.Assert(0 < lineInfo.End.Line && 0 < lineInfo.End.Pos , "0 < end"); Debug.Assert(lineInfo.Start.LessOrEqual(lineInfo.End), "start <= end"); } } // Returns file path for local and network URIs. Used for PDB generating and error reporting. public static string GetFileName(string uriString) { Debug.Assert(uriString != null); Uri uri; if (uriString.Length != 0 && System.Uri.TryCreate(uriString, UriKind.Absolute, out uri) && uri.IsFile ) { return uri.LocalPath; } return uriString; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.Diagnostics; namespace System.Xml.Xsl { [DebuggerDisplay("({Line},{Pos})")] internal struct Location { private ulong value; public int Line { get { return (int)(this.value >> 32); } } public int Pos { get { return (int)(this.value ); } } public Location(int line, int pos) { this.value = (((ulong)line) << 32) | (uint)pos; } public Location(Location that) { this.value = that.value; } public bool LessOrEqual(Location that) { return this.value <= that.value; } } [DebuggerDisplay("{Uri} [{StartLine},{StartPos} -- {EndLine},{EndPos}]")] internal class SourceLineInfo : ISourceLineInfo { protected string uriString; protected Location start; protected Location end; public SourceLineInfo(string uriString, int startLine, int startPos, int endLine, int endPos) : this(uriString, new Location(startLine, startPos), new Location(endLine, endPos)) {} public SourceLineInfo(string uriString, Location start, Location end) { this.uriString = uriString; this.start = start; this.end = end; Validate(this); } public string Uri { get { return this.uriString ; } } public int StartLine { get { return this.start.Line; } } public int StartPos { get { return this.start.Pos ; } } public int EndLine { get { return this.end.Line ; } } public int EndPos { get { return this.end.Pos ; } } public Location End { get { return this.end ; } } public Location Start { get { return this.start ; } } ////// Magic number 0xfeefee is used in PDB to denote a section of IL that does not map to any user code. /// When VS debugger steps into IL marked with 0xfeefee, it will continue the step until it reaches /// some user code. /// protected const int NoSourceMagicNumber = 0xfeefee; public static SourceLineInfo NoSource = new SourceLineInfo(string.Empty, NoSourceMagicNumber, 0, NoSourceMagicNumber, 0); public bool IsNoSource { get { return this.StartLine == NoSourceMagicNumber; } } [Conditional("DEBUG")] public static void Validate(ISourceLineInfo lineInfo) { if (lineInfo.Start.Line == 0 || lineInfo.Start.Line == NoSourceMagicNumber) { Debug.Assert(lineInfo.Start.Line == lineInfo.End.Line); Debug.Assert(lineInfo.Start.Pos == 0 && lineInfo.End.Pos == 0); } else { Debug.Assert(0 < lineInfo.Start.Line && 0 < lineInfo.Start.Pos, "0 < start"); Debug.Assert(0 < lineInfo.End.Line && 0 < lineInfo.End.Pos , "0 < end"); Debug.Assert(lineInfo.Start.LessOrEqual(lineInfo.End), "start <= end"); } } // Returns file path for local and network URIs. Used for PDB generating and error reporting. public static string GetFileName(string uriString) { Debug.Assert(uriString != null); Uri uri; if (uriString.Length != 0 && System.Uri.TryCreate(uriString, UriKind.Absolute, out uri) && uri.IsFile ) { return uri.LocalPath; } return uriString; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OleDbConnectionFactory.cs
- DbBuffer.cs
- SkinBuilder.cs
- UdpConstants.cs
- CheckBoxBaseAdapter.cs
- LinqDataSourceValidationException.cs
- HideDisabledControlAdapter.cs
- PropertyChangedEventArgs.cs
- QuotedPrintableStream.cs
- SmtpNtlmAuthenticationModule.cs
- OpenTypeLayout.cs
- TableChangeProcessor.cs
- ColumnMapProcessor.cs
- AddInPipelineAttributes.cs
- MimeWriter.cs
- DataGridViewAccessibleObject.cs
- DictionaryEntry.cs
- SkipStoryboardToFill.cs
- Camera.cs
- TextBoxRenderer.cs
- HtmlInputButton.cs
- PolyBezierSegment.cs
- sqlstateclientmanager.cs
- DPCustomTypeDescriptor.cs
- QueryCreatedEventArgs.cs
- _LazyAsyncResult.cs
- CryptographicAttribute.cs
- SmtpAuthenticationManager.cs
- _NetworkingPerfCounters.cs
- oledbmetadatacolumnnames.cs
- CodeGenerator.cs
- CatalogPart.cs
- SmtpReplyReader.cs
- HttpDebugHandler.cs
- PipelineModuleStepContainer.cs
- OperationInvokerTrace.cs
- StatusBarPanelClickEvent.cs
- CollectionViewGroup.cs
- WithStatement.cs
- BlockUIContainer.cs
- DefaultTextStoreTextComposition.cs
- HttpContextWrapper.cs
- NavigateEvent.cs
- ToolStripDesignerUtils.cs
- ActivityExecutionContextCollection.cs
- RegexStringValidatorAttribute.cs
- PageCodeDomTreeGenerator.cs
- Line.cs
- DrawingAttributesDefaultValueFactory.cs
- TagMapInfo.cs
- TemplatedWizardStep.cs
- GenericRootAutomationPeer.cs
- PasswordTextNavigator.cs
- ListViewItemSelectionChangedEvent.cs
- PropertyChangingEventArgs.cs
- XsdValidatingReader.cs
- Number.cs
- QuinticEase.cs
- SqlDeflator.cs
- DllNotFoundException.cs
- TraceEventCache.cs
- ErrorTableItemStyle.cs
- XmlBoundElement.cs
- XmlDomTextWriter.cs
- Translator.cs
- ControlPaint.cs
- followingquery.cs
- Size3D.cs
- FacetValues.cs
- HMACSHA256.cs
- ChtmlPageAdapter.cs
- XmlSchemaFacet.cs
- SmiContext.cs
- Schedule.cs
- BitVector32.cs
- DataGridColumnStyleMappingNameEditor.cs
- BindValidator.cs
- GeneralTransform3D.cs
- FolderBrowserDialog.cs
- PortCache.cs
- CompareValidator.cs
- CodeDirectiveCollection.cs
- ObjectListItem.cs
- TypefaceMetricsCache.cs
- AccessDataSourceView.cs
- ProcessThreadDesigner.cs
- HttpCachePolicyWrapper.cs
- CapabilitiesAssignment.cs
- RangeValuePatternIdentifiers.cs
- SingleResultAttribute.cs
- OleDbReferenceCollection.cs
- HashRepartitionStream.cs
- MessageDispatch.cs
- HistoryEventArgs.cs
- Vector3DConverter.cs
- FileUtil.cs
- BroadcastEventHelper.cs
- ImageDrawing.cs
- DesignerActionPropertyItem.cs
- ImageButton.cs