Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / Internal / SrgsCompiler / propertytag.cs / 1 / propertytag.cs
//------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System; using System.Runtime.InteropServices; using System.Speech.Internal.SrgsParser; #pragma warning disable 1634, 1691 // Allows suppression of certain PreSharp messages. namespace System.Speech.Internal.SrgsCompiler { ////// Summary description for Rule. /// internal sealed class PropertyTag : ParseElement, IPropertyTag { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors internal PropertyTag (ParseElement parent, Backend backend) : base (parent._rule) { } #endregion //******************************************************************** // // Internal Methods // //******************************************************************* #region Internal Methods #pragma warning disable 56507 /// TODOC <_include file='doc\Tag.uex' path='docs/doc[@for="Tag.RepeatProbability"]/*' /> // The probability that this item will be repeated. void IPropertyTag.NameValue (IElement parent, string name, object value) { //Return if the Tag content is empty string sValue = value as string; if (string.IsNullOrEmpty (name) && (value == null || (sValue != null && string.IsNullOrEmpty ((sValue).Trim ())))) { return; } // Build semantic properties to attach to epsilon transition. //Name= pszValue = null vValue = VT_EMPTY //Name="string" pszValue = "string" vValue = VT_EMPTY //Name=true pszValue = null vValue = VT_BOOL //Name=123 pszValue = null vValue = VT_I4 //Name=3.14 pszValue = null vValue = VT_R8 if (!string.IsNullOrEmpty (name)) { // Set property name _propInfo._pszName = name; } else { // If no property, set the name to the anonymous property name _propInfo._pszName = "="; } // Set property value _propInfo._comValue = value; if (value == null) { _propInfo._comType = VarEnum.VT_EMPTY; } else if (sValue != null) { _propInfo._comType = VarEnum.VT_EMPTY; } else if (value is int) { _propInfo._comType = VarEnum.VT_I4; } else if (value is double) { _propInfo._comType = VarEnum.VT_R8; } else if (value is bool) { _propInfo._comType = VarEnum.VT_BOOL; } else { // should never get here System.Diagnostics.Debug.Assert (false); } } void IElement.PostParse (IElement parentElement) { ParseElementCollection parent = (ParseElementCollection) parentElement; _propInfo._ulId = (uint) parent._rule._iSerialize2; // Attach the semantic properties on the parent element. parent.AddSementicPropertyTag (_propInfo); } #pragma warning restore 56507 #endregion //******************************************************************** // // Private Fields // //******************************************************************** #region Private Fields private CfgGrammar.CfgProperty _propInfo = new CfgGrammar.CfgProperty (); #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------- using System; using System.Runtime.InteropServices; using System.Speech.Internal.SrgsParser; #pragma warning disable 1634, 1691 // Allows suppression of certain PreSharp messages. namespace System.Speech.Internal.SrgsCompiler { ////// Summary description for Rule. /// internal sealed class PropertyTag : ParseElement, IPropertyTag { //******************************************************************* // // Constructors // //******************************************************************* #region Constructors internal PropertyTag (ParseElement parent, Backend backend) : base (parent._rule) { } #endregion //******************************************************************** // // Internal Methods // //******************************************************************* #region Internal Methods #pragma warning disable 56507 /// TODOC <_include file='doc\Tag.uex' path='docs/doc[@for="Tag.RepeatProbability"]/*' /> // The probability that this item will be repeated. void IPropertyTag.NameValue (IElement parent, string name, object value) { //Return if the Tag content is empty string sValue = value as string; if (string.IsNullOrEmpty (name) && (value == null || (sValue != null && string.IsNullOrEmpty ((sValue).Trim ())))) { return; } // Build semantic properties to attach to epsilon transition. //Name= pszValue = null vValue = VT_EMPTY //Name="string" pszValue = "string" vValue = VT_EMPTY //Name=true pszValue = null vValue = VT_BOOL //Name=123 pszValue = null vValue = VT_I4 //Name=3.14 pszValue = null vValue = VT_R8 if (!string.IsNullOrEmpty (name)) { // Set property name _propInfo._pszName = name; } else { // If no property, set the name to the anonymous property name _propInfo._pszName = "="; } // Set property value _propInfo._comValue = value; if (value == null) { _propInfo._comType = VarEnum.VT_EMPTY; } else if (sValue != null) { _propInfo._comType = VarEnum.VT_EMPTY; } else if (value is int) { _propInfo._comType = VarEnum.VT_I4; } else if (value is double) { _propInfo._comType = VarEnum.VT_R8; } else if (value is bool) { _propInfo._comType = VarEnum.VT_BOOL; } else { // should never get here System.Diagnostics.Debug.Assert (false); } } void IElement.PostParse (IElement parentElement) { ParseElementCollection parent = (ParseElementCollection) parentElement; _propInfo._ulId = (uint) parent._rule._iSerialize2; // Attach the semantic properties on the parent element. parent.AddSementicPropertyTag (_propInfo); } #pragma warning restore 56507 #endregion //******************************************************************** // // Private Fields // //******************************************************************** #region Private Fields private CfgGrammar.CfgProperty _propInfo = new CfgGrammar.CfgProperty (); #endregion } } // 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
- Queue.cs
- StrokeNode.cs
- NumberFunctions.cs
- GuidelineSet.cs
- MonikerSyntaxException.cs
- ValueQuery.cs
- WebPartTracker.cs
- CanonicalFontFamilyReference.cs
- EmptyEnumerable.cs
- CleanUpVirtualizedItemEventArgs.cs
- VerificationAttribute.cs
- HandleDictionary.cs
- TemplateBamlRecordReader.cs
- TraceUtility.cs
- BuildResult.cs
- DataServices.cs
- Message.cs
- DynamicMetaObject.cs
- Journaling.cs
- ClientRuntimeConfig.cs
- SchemaInfo.cs
- Drawing.cs
- TypeConverterMarkupExtension.cs
- EditingCommands.cs
- RegexTree.cs
- ToolStripDesignerAvailabilityAttribute.cs
- LockCookie.cs
- CodeGenerationManager.cs
- NameScopePropertyAttribute.cs
- Thread.cs
- SQLBinaryStorage.cs
- WSSecurityPolicy.cs
- TdsParserSessionPool.cs
- TextParaClient.cs
- ProvidersHelper.cs
- CompositeFontInfo.cs
- IdentityNotMappedException.cs
- Point3DConverter.cs
- DataObjectPastingEventArgs.cs
- ParserStreamGeometryContext.cs
- ConfigXmlSignificantWhitespace.cs
- NavigationService.cs
- HostSecurityManager.cs
- MatrixTransform.cs
- DBDataPermission.cs
- ControlValuePropertyAttribute.cs
- AssemblyAssociatedContentFileAttribute.cs
- CompiledQueryCacheEntry.cs
- SqlCacheDependencyDatabaseCollection.cs
- UnlockInstanceAsyncResult.cs
- HierarchicalDataBoundControl.cs
- XmlIncludeAttribute.cs
- Style.cs
- RegistrationServices.cs
- QueryGenerator.cs
- IdentityVerifier.cs
- NamespaceImport.cs
- TextControlDesigner.cs
- Substitution.cs
- TypeSystemHelpers.cs
- CodeDelegateInvokeExpression.cs
- PriorityChain.cs
- TextSyndicationContentKindHelper.cs
- UiaCoreApi.cs
- EntityDataSourceStatementEditor.cs
- SmtpNegotiateAuthenticationModule.cs
- DataGridViewAccessibleObject.cs
- ListenerElementsCollection.cs
- SystemWebExtensionsSectionGroup.cs
- SchemaImporterExtension.cs
- sqlnorm.cs
- Socket.cs
- XmlAutoDetectWriter.cs
- Message.cs
- XpsS0ValidatingLoader.cs
- UnSafeCharBuffer.cs
- DecimalAnimationBase.cs
- CompatibleIComparer.cs
- TableFieldsEditor.cs
- ToolStripGripRenderEventArgs.cs
- FixedDocument.cs
- ToolStripContentPanelRenderEventArgs.cs
- FixedHighlight.cs
- IxmlLineInfo.cs
- UIElement.cs
- Matrix3DValueSerializer.cs
- ClientApiGenerator.cs
- ManipulationCompletedEventArgs.cs
- ClientConfigurationSystem.cs
- AdRotator.cs
- PublishLicense.cs
- EntityDesignPluralizationHandler.cs
- DataGridViewComboBoxCell.cs
- BindingMAnagerBase.cs
- Perspective.cs
- ArrangedElementCollection.cs
- BamlRecordWriter.cs
- CharacterBuffer.cs
- TransformerConfigurationWizardBase.cs
- TreeBuilderBamlTranslator.cs