Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / Recognition / SrgsGrammar / SrgsSemanticInterpretationTag.cs / 1 / SrgsSemanticInterpretationTag.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: // // History: // 5/1/2004 jeanfp Created from the Kurosawa Code //--------------------------------------------------------------------------- using System; using System.Diagnostics; using System.Speech.Internal; using System.Speech.Internal.SrgsParser; using System.Text; using System.Xml; #pragma warning disable 1634, 1691 // Allows suppression of certain PreSharp messages. namespace System.Speech.Recognition.SrgsGrammar { /// TODOC <_include file='doc\Tag.uex' path='docs/doc[@for="Tag"]/*' /> [Serializable] [DebuggerDisplay ("{DebuggerDisplayString ()}")] public class SrgsSemanticInterpretationTag : SrgsElement, ISemanticTag { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors /// TODOC <_include file='doc\Tag.uex' path='docs/doc[@for="Tag.Tag1"]/*' /> public SrgsSemanticInterpretationTag () { } #pragma warning disable 56507 /// TODOC <_include file='doc\Tag.uex' path='docs/doc[@for="Tag.Tag2"]/*' /> public SrgsSemanticInterpretationTag (string script) { Helpers.ThrowIfNull (script, "script"); _script = script; } #endregion //******************************************************************** // // Public Properties // //******************************************************************* #region public Properties /// TODOC <_include file='doc\Tag.uex' path='docs/doc[@for="Tag.Script"]/*' /> public string Script { get { return _script; } set { Helpers.ThrowIfNull (value, "value"); _script = value; } } #pragma warning restore 56507 #endregion //******************************************************************** // // Internal Methods // //******************************************************************** #region Internal Methods // Validate the SRGS element. ////// Validate each element and recurse through all the children srgs /// elements if any. /// override internal void Validate (SrgsGrammar grammar) { if (grammar.TagFormat == SrgsTagFormat.Default) { grammar.TagFormat |= SrgsTagFormat.W3cV1; } else if (grammar.TagFormat == SrgsTagFormat.KeyValuePairs) { XmlParser.ThrowSrgsException (SRID.SapiPropertiesAndSemantics); } } internal override void WriteSrgs (XmlWriter writer) { // Skip writing the tag if empty string script = Script.Trim (Helpers._achTrimChars); // Writescript writer.WriteStartElement ("tag"); // Write the script if any if (!string.IsNullOrEmpty(script)) { writer.WriteString (script); } writer.WriteEndElement (); } internal override string DebuggerDisplayString () { StringBuilder sb = new StringBuilder ("SrgsSemanticInterpretationTag '"); sb.Append (_script); sb.Append ("'"); return sb.ToString (); } void ISemanticTag.Content (IElement parent, string value, int line) { Script = value; } #endregion //******************************************************************* // // Private Fields // //******************************************************************** #region Private Fields private string _script = string.Empty; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: // // History: // 5/1/2004 jeanfp Created from the Kurosawa Code //--------------------------------------------------------------------------- using System; using System.Diagnostics; using System.Speech.Internal; using System.Speech.Internal.SrgsParser; using System.Text; using System.Xml; #pragma warning disable 1634, 1691 // Allows suppression of certain PreSharp messages. namespace System.Speech.Recognition.SrgsGrammar { /// TODOC <_include file='doc\Tag.uex' path='docs/doc[@for="Tag"]/*' /> [Serializable] [DebuggerDisplay ("{DebuggerDisplayString ()}")] public class SrgsSemanticInterpretationTag : SrgsElement, ISemanticTag { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors /// TODOC <_include file='doc\Tag.uex' path='docs/doc[@for="Tag.Tag1"]/*' /> public SrgsSemanticInterpretationTag () { } #pragma warning disable 56507 /// TODOC <_include file='doc\Tag.uex' path='docs/doc[@for="Tag.Tag2"]/*' /> public SrgsSemanticInterpretationTag (string script) { Helpers.ThrowIfNull (script, "script"); _script = script; } #endregion //******************************************************************** // // Public Properties // //******************************************************************* #region public Properties /// TODOC <_include file='doc\Tag.uex' path='docs/doc[@for="Tag.Script"]/*' /> public string Script { get { return _script; } set { Helpers.ThrowIfNull (value, "value"); _script = value; } } #pragma warning restore 56507 #endregion //******************************************************************** // // Internal Methods // //******************************************************************** #region Internal Methods // Validate the SRGS element. ////// Validate each element and recurse through all the children srgs /// elements if any. /// override internal void Validate (SrgsGrammar grammar) { if (grammar.TagFormat == SrgsTagFormat.Default) { grammar.TagFormat |= SrgsTagFormat.W3cV1; } else if (grammar.TagFormat == SrgsTagFormat.KeyValuePairs) { XmlParser.ThrowSrgsException (SRID.SapiPropertiesAndSemantics); } } internal override void WriteSrgs (XmlWriter writer) { // Skip writing the tag if empty string script = Script.Trim (Helpers._achTrimChars); // Writescript writer.WriteStartElement ("tag"); // Write the script if any if (!string.IsNullOrEmpty(script)) { writer.WriteString (script); } writer.WriteEndElement (); } internal override string DebuggerDisplayString () { StringBuilder sb = new StringBuilder ("SrgsSemanticInterpretationTag '"); sb.Append (_script); sb.Append ("'"); return sb.ToString (); } void ISemanticTag.Content (IElement parent, string value, int line) { Script = value; } #endregion //******************************************************************* // // Private Fields // //******************************************************************** #region Private Fields private string _script = string.Empty; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WeakEventTable.cs
- Lease.cs
- MouseEventArgs.cs
- CommandBindingCollection.cs
- Console.cs
- EventHandlersStore.cs
- FixedDocument.cs
- SqlProvider.cs
- ReceiveMessageAndVerifySecurityAsyncResultBase.cs
- DiscriminatorMap.cs
- WindowsButton.cs
- IISUnsafeMethods.cs
- StringConverter.cs
- FileInfo.cs
- Splitter.cs
- SvcMapFileLoader.cs
- WebException.cs
- HttpConfigurationContext.cs
- RegisteredHiddenField.cs
- InputReport.cs
- MsmqChannelFactory.cs
- WsiProfilesElement.cs
- OutputCacheSection.cs
- CharacterHit.cs
- SyncOperationState.cs
- NavigationWindow.cs
- TemplateBuilder.cs
- ReadContentAsBinaryHelper.cs
- DeclarativeCatalogPart.cs
- BindingSourceDesigner.cs
- Util.cs
- DesignerValidationSummaryAdapter.cs
- lengthconverter.cs
- RefExpr.cs
- RowToParametersTransformer.cs
- TreeNodeStyleCollection.cs
- ComboBoxAutomationPeer.cs
- EdmProviderManifest.cs
- ManagementNamedValueCollection.cs
- StringUtil.cs
- UnsafeNativeMethods.cs
- TextProperties.cs
- WebResourceAttribute.cs
- DBPropSet.cs
- Operand.cs
- ManifestResourceInfo.cs
- WebPageTraceListener.cs
- ValidatorCompatibilityHelper.cs
- DataTemplateSelector.cs
- NamedPermissionSet.cs
- XPathBuilder.cs
- PrintEvent.cs
- SQLGuidStorage.cs
- SystemWebCachingSectionGroup.cs
- TableCellCollection.cs
- FormsIdentity.cs
- ConnectionStringsSection.cs
- _Semaphore.cs
- XmlAnyElementAttribute.cs
- CompilationUnit.cs
- GeometryCollection.cs
- SafeLibraryHandle.cs
- IgnoreFlushAndCloseStream.cs
- ReferenceAssemblyAttribute.cs
- HttpDebugHandler.cs
- dataSvcMapFileLoader.cs
- path.cs
- PartialList.cs
- CapabilitiesUse.cs
- WindowsImpersonationContext.cs
- MonthCalendar.cs
- ToolZoneDesigner.cs
- XmlSchemaType.cs
- CompositeActivityTypeDescriptor.cs
- ReturnEventArgs.cs
- MouseGestureValueSerializer.cs
- OleDbTransaction.cs
- CookieProtection.cs
- Rectangle.cs
- TextBoxAutoCompleteSourceConverter.cs
- LostFocusEventManager.cs
- TransactionTraceIdentifier.cs
- EventHandlerList.cs
- CapabilitiesAssignment.cs
- NumberSubstitution.cs
- CompilerGeneratedAttribute.cs
- HTMLTextWriter.cs
- MarkupCompilePass2.cs
- Trace.cs
- Oci.cs
- SendActivityDesigner.cs
- FontCollection.cs
- GraphicsContainer.cs
- Viewport3DVisual.cs
- QilUnary.cs
- WmlLinkAdapter.cs
- LineUtil.cs
- MediaEntryAttribute.cs
- _AutoWebProxyScriptEngine.cs
- ServerValidateEventArgs.cs