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
- Debug.cs
- HWStack.cs
- TreeNodeStyleCollection.cs
- CheckBoxBaseAdapter.cs
- FormsAuthenticationConfiguration.cs
- ContextBase.cs
- Vars.cs
- CryptoProvider.cs
- QueryStringParameter.cs
- AuthenticationConfig.cs
- ColorTranslator.cs
- HtmlFormParameterWriter.cs
- AnimationTimeline.cs
- ExpiredSecurityTokenException.cs
- CfgParser.cs
- PropertyConverter.cs
- BCLDebug.cs
- ControlPropertyNameConverter.cs
- SchemaCollectionPreprocessor.cs
- BindingRestrictions.cs
- InvalidProgramException.cs
- HandledMouseEvent.cs
- ObjectStateEntryDbDataRecord.cs
- VariableElement.cs
- ServicePointManager.cs
- DBPropSet.cs
- SocketAddress.cs
- SQLConvert.cs
- GorillaCodec.cs
- ProcessModule.cs
- HttpServerUtilityBase.cs
- Assert.cs
- GeometryCollection.cs
- ScriptControlManager.cs
- AssemblyBuilder.cs
- HtmlInputImage.cs
- RelationshipFixer.cs
- SourceElementsCollection.cs
- XamlToRtfParser.cs
- Filter.cs
- TreeView.cs
- HttpCookieCollection.cs
- CompilerScopeManager.cs
- CompiledXpathExpr.cs
- invalidudtexception.cs
- ParagraphResult.cs
- XmlCharCheckingWriter.cs
- PropertyConverter.cs
- SqlParameter.cs
- BamlReader.cs
- SqlClientWrapperSmiStream.cs
- WebRequestModulesSection.cs
- AnnotationService.cs
- ConfigXmlComment.cs
- PartManifestEntry.cs
- ExceptionCollection.cs
- RenamedEventArgs.cs
- CombinedGeometry.cs
- XamlPoint3DCollectionSerializer.cs
- XmlSchemaComplexType.cs
- CodeTypeParameter.cs
- BigInt.cs
- PKCS1MaskGenerationMethod.cs
- InvalidPropValue.cs
- DataGridSortCommandEventArgs.cs
- XmlnsCompatibleWithAttribute.cs
- AutoResetEvent.cs
- WSSecureConversationFeb2005.cs
- SourceChangedEventArgs.cs
- ExtendedPropertiesHandler.cs
- ClientBuildManagerCallback.cs
- ControlPaint.cs
- DataGridItemAutomationPeer.cs
- TextRunTypographyProperties.cs
- HttpCapabilitiesEvaluator.cs
- CodeCommentStatement.cs
- ObjectStateFormatter.cs
- StylusPointDescription.cs
- FileDialogCustomPlace.cs
- AppliedDeviceFiltersEditor.cs
- TimelineGroup.cs
- EntityDataSourceWrapper.cs
- TileModeValidation.cs
- NumericUpDown.cs
- PersonalizationDictionary.cs
- ResolveMatchesCD1.cs
- DllHostInitializer.cs
- ISAPIApplicationHost.cs
- CompoundFileIOPermission.cs
- ThreadStateException.cs
- XmlSchemaAnnotation.cs
- SamlAudienceRestrictionCondition.cs
- LeafCellTreeNode.cs
- CompoundFileStorageReference.cs
- TableCellAutomationPeer.cs
- TranslateTransform3D.cs
- Rule.cs
- DropSource.cs
- SingleObjectCollection.cs
- ValidatorCompatibilityHelper.cs