Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / 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
- ProcessHostConfigUtils.cs
- FaultFormatter.cs
- peersecuritysettings.cs
- FixedSOMTableCell.cs
- ServerValidateEventArgs.cs
- SimpleType.cs
- ResXDataNode.cs
- CodeIdentifiers.cs
- AssemblyBuilder.cs
- DbExpressionVisitor.cs
- SrgsGrammarCompiler.cs
- NativeMethodsCLR.cs
- ProtocolsSection.cs
- SerialPort.cs
- StorageEndPropertyMapping.cs
- DataGridComboBoxColumn.cs
- Stack.cs
- BrowserCapabilitiesFactoryBase.cs
- WindowsStatic.cs
- HttpWriter.cs
- HTMLTextWriter.cs
- ValueConversionAttribute.cs
- EventLogPermissionEntryCollection.cs
- Gdiplus.cs
- LookupBindingPropertiesAttribute.cs
- EventLogPermissionEntry.cs
- SafeSecurityHandles.cs
- BackStopAuthenticationModule.cs
- RegistrationServices.cs
- RepeatBehavior.cs
- ObjectStateEntryDbDataRecord.cs
- EventSinkHelperWriter.cs
- SqlInfoMessageEvent.cs
- OpCodes.cs
- TypeSemantics.cs
- EditorOptionAttribute.cs
- FontInfo.cs
- SqlClientWrapperSmiStreamChars.cs
- Effect.cs
- QilReplaceVisitor.cs
- OletxVolatileEnlistment.cs
- TransactionInformation.cs
- ListDictionary.cs
- TargetFrameworkAttribute.cs
- _PooledStream.cs
- FormViewDeleteEventArgs.cs
- GridEntryCollection.cs
- ExceptionUtil.cs
- RawStylusInputCustomDataList.cs
- HttpValueCollection.cs
- DescendantOverDescendantQuery.cs
- AttributeEmitter.cs
- SqlOuterApplyReducer.cs
- DefinitionUpdate.cs
- VisualBrush.cs
- ListViewEditEventArgs.cs
- DataFormats.cs
- RemoteWebConfigurationHost.cs
- DisableDpiAwarenessAttribute.cs
- CapabilitiesUse.cs
- TypeUnloadedException.cs
- UIElement3D.cs
- SamlAdvice.cs
- ClientConvert.cs
- ConfigurationSectionCollection.cs
- XPathAncestorIterator.cs
- ReadOnlyDictionary.cs
- Dictionary.cs
- DataBindingHandlerAttribute.cs
- MenuBindingsEditor.cs
- DocumentAutomationPeer.cs
- CacheEntry.cs
- Accessible.cs
- SectionUpdates.cs
- AllMembershipCondition.cs
- XmlDataSourceNodeDescriptor.cs
- PropertyGrid.cs
- ByteStreamGeometryContext.cs
- RectIndependentAnimationStorage.cs
- DataRelationCollection.cs
- UrlEncodedParameterWriter.cs
- StdValidatorsAndConverters.cs
- BaseCollection.cs
- MultiPageTextView.cs
- InstanceHandleReference.cs
- ValidatedControlConverter.cs
- UniqueConstraint.cs
- StorageComplexPropertyMapping.cs
- ObjectResult.cs
- LockingPersistenceProvider.cs
- CommonDialog.cs
- TextTreeText.cs
- TableRow.cs
- FlowDecisionDesigner.xaml.cs
- DesignTimeXamlWriter.cs
- Rules.cs
- LongCountAggregationOperator.cs
- SharedStatics.cs
- WebBrowserEvent.cs
- NamespaceDecl.cs