Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / 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
- ContainerUIElement3D.cs
- FileDataSourceCache.cs
- MethodImplAttribute.cs
- BinHexDecoder.cs
- DrawItemEvent.cs
- Operand.cs
- CompatibleIComparer.cs
- ToolboxService.cs
- DataGridLength.cs
- PeerCustomResolverSettings.cs
- StateWorkerRequest.cs
- LineBreakRecord.cs
- FilterEventArgs.cs
- WebPartTransformerAttribute.cs
- DefaultParameterValueAttribute.cs
- WindowsGrip.cs
- ServiceReference.cs
- DummyDataSource.cs
- XsdBuildProvider.cs
- IndicFontClient.cs
- RtfFormatStack.cs
- XamlFigureLengthSerializer.cs
- DbConnectionOptions.cs
- xdrvalidator.cs
- XmlSchema.cs
- ETagAttribute.cs
- XmlParserContext.cs
- SqlClientWrapperSmiStream.cs
- UnlockInstanceCommand.cs
- XmlIgnoreAttribute.cs
- TraceInternal.cs
- CommandArguments.cs
- InvalidComObjectException.cs
- XPathNodeList.cs
- SelectedDatesCollection.cs
- CallSiteHelpers.cs
- RenderData.cs
- VirtualizedContainerService.cs
- TemplatePropertyEntry.cs
- JoinSymbol.cs
- CopyAttributesAction.cs
- RSAPKCS1KeyExchangeFormatter.cs
- LayoutEditorPart.cs
- Matrix3D.cs
- XslAst.cs
- FileLogRecordStream.cs
- TextCompositionEventArgs.cs
- SortableBindingList.cs
- DataFormat.cs
- Array.cs
- StylusButtonEventArgs.cs
- MetadataWorkspace.cs
- TextWriter.cs
- CardSpacePolicyElement.cs
- DbTransaction.cs
- NamespaceEmitter.cs
- ToolStripItemImageRenderEventArgs.cs
- WorkflowInstanceExtensionProvider.cs
- SharedPersonalizationStateInfo.cs
- SqlException.cs
- LineBreakRecord.cs
- WebPartMinimizeVerb.cs
- Misc.cs
- InvokeAction.cs
- CodeGeneratorOptions.cs
- LoginAutoFormat.cs
- XmlSchemaInclude.cs
- GenerateScriptTypeAttribute.cs
- BasicExpressionVisitor.cs
- IHttpResponseInternal.cs
- Matrix3D.cs
- InkCanvasInnerCanvas.cs
- _BasicClient.cs
- CertificateManager.cs
- UserMapPath.cs
- XmlCharCheckingWriter.cs
- ListViewDataItem.cs
- PreviewControlDesigner.cs
- GridView.cs
- Helpers.cs
- DoubleCollection.cs
- FastEncoder.cs
- SaveFileDialog.cs
- ContourSegment.cs
- UpdateDelegates.Generated.cs
- Parameter.cs
- TreeViewHitTestInfo.cs
- AssertFilter.cs
- RelationshipEnd.cs
- DateTimeFormatInfoScanner.cs
- InteropBitmapSource.cs
- HostingEnvironment.cs
- TypedAsyncResult.cs
- WsatStrings.cs
- ResXResourceWriter.cs
- DBConnection.cs
- SafeMarshalContext.cs
- TextTrailingWordEllipsis.cs
- PropertyCollection.cs
- AppSettingsReader.cs