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 / SrgsOneOf.cs / 1 / SrgsOneOf.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description:
//
// History:
// 5/1/2004 jeanfp Created from the Kurosawa Code
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.Speech.Internal;
using System.Speech.Internal.SrgsParser;
using System.Text;
using System.Xml;
namespace System.Speech.Recognition.SrgsGrammar
{
/// TODOC <_include file='doc\OneOf.uex' path='docs/doc[@for="OneOf"]/*' />
[Serializable]
[DebuggerDisplay ("{DebuggerDisplayString ()}")]
[DebuggerTypeProxy (typeof (OneOfDebugDisplay))]
public class SrgsOneOf : SrgsElement, IOneOf
{
//*******************************************************************
//
// Constructors
//
//*******************************************************************
#region Constructors
/// TODOC <_include file='doc\OneOf.uex' path='docs/doc[@for="OneOf.OneOf1"]/*' />
public SrgsOneOf ()
{
}
/// TODOC <_include file='doc\OneOf.uex' path='docs/doc[@for="OneOf.OneOf2"]/*' />
public SrgsOneOf (params string [] items)
: this ()
{
Helpers.ThrowIfNull (items, "items");
for (int i = 0; i < items.Length; i++)
{
if (items [i] == null)
{
throw new ArgumentNullException ("items", SR.Get (SRID.ParamsEntryNullIllegal));
}
_items.Add (new SrgsItem (items [i]));
}
}
/// TODOC <_include file='doc\OneOf.uex' path='docs/doc[@for="OneOf.OneOf3"]/*' />
public SrgsOneOf (params SrgsItem [] items)
: this ()
{
Helpers.ThrowIfNull (items, "items");
for (int i = 0; i < items.Length; i++)
{
SrgsItem item = items [i];
if (item == null)
{
throw new ArgumentNullException ("items", SR.Get (SRID.ParamsEntryNullIllegal));
}
_items.Add (item);
}
}
#endregion
//********************************************************************
//
// Public Methods
//
//*******************************************************************
#region public Method
///
/// TODOC
///
///
public void Add (SrgsItem item)
{
Helpers.ThrowIfNull (item, "item");
Items.Add (item);
}
#endregion
//********************************************************************
//
// Public Properties
//
//********************************************************************
#region public Properties
// ISSUE: Do we need more construcors? Take a look at RuleElementCollection.AddOneOf methods. [Bug# 37115]
/// TODOC <_include file='doc\OneOf.uex' path='docs/doc[@for="OneOf.Elements"]/*' />
public Collection Items
{
get
{
return _items;
}
}
#endregion
//*******************************************************************
//
// Internal Methods
//
//********************************************************************
#region internal Methods
internal override void WriteSrgs (XmlWriter writer)
{
// Write ...
writer.WriteStartElement ("one-of");
foreach (SrgsItem element in _items)
{
element.WriteSrgs (writer);
}
writer.WriteEndElement ();
}
internal override string DebuggerDisplayString ()
{
StringBuilder sb = new StringBuilder ("SrgsOneOf Count = ");
sb.Append (_items.Count);
return sb.ToString ();
}
#endregion
//*******************************************************************
//
// Protected Properties
//
//*******************************************************************
#region Protected Properties
///
/// Allows the Srgs Element base class to implement
/// features requiring recursion in the elements tree.
///
///
internal override SrgsElement [] Children
{
get
{
SrgsElement [] elements = new SrgsElement [_items.Count];
int i = 0;
foreach (SrgsItem item in _items)
{
elements [i++] = item;
}
return elements;
}
}
#endregion
//*******************************************************************
//
// Private Fields
//
//********************************************************************
#region Private Fields
private SrgsItemList _items = new SrgsItemList ();
#endregion
//*******************************************************************
//
// Private Types
//
//********************************************************************
#region Private Types
// Used by the debbugger display attribute
internal class OneOfDebugDisplay
{
public OneOfDebugDisplay (SrgsOneOf oneOf)
{
_items = oneOf._items;
}
[DebuggerBrowsable (DebuggerBrowsableState.RootHidden)]
public SrgsItem [] AKeys
{
get
{
SrgsItem [] items = new SrgsItem [_items.Count];
for (int i = 0; i < _items.Count; i++)
{
items [i] = _items [i];
}
return items;
}
}
private Collection _items;
}
#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.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.Speech.Internal;
using System.Speech.Internal.SrgsParser;
using System.Text;
using System.Xml;
namespace System.Speech.Recognition.SrgsGrammar
{
/// TODOC <_include file='doc\OneOf.uex' path='docs/doc[@for="OneOf"]/*' />
[Serializable]
[DebuggerDisplay ("{DebuggerDisplayString ()}")]
[DebuggerTypeProxy (typeof (OneOfDebugDisplay))]
public class SrgsOneOf : SrgsElement, IOneOf
{
//*******************************************************************
//
// Constructors
//
//*******************************************************************
#region Constructors
/// TODOC <_include file='doc\OneOf.uex' path='docs/doc[@for="OneOf.OneOf1"]/*' />
public SrgsOneOf ()
{
}
/// TODOC <_include file='doc\OneOf.uex' path='docs/doc[@for="OneOf.OneOf2"]/*' />
public SrgsOneOf (params string [] items)
: this ()
{
Helpers.ThrowIfNull (items, "items");
for (int i = 0; i < items.Length; i++)
{
if (items [i] == null)
{
throw new ArgumentNullException ("items", SR.Get (SRID.ParamsEntryNullIllegal));
}
_items.Add (new SrgsItem (items [i]));
}
}
/// TODOC <_include file='doc\OneOf.uex' path='docs/doc[@for="OneOf.OneOf3"]/*' />
public SrgsOneOf (params SrgsItem [] items)
: this ()
{
Helpers.ThrowIfNull (items, "items");
for (int i = 0; i < items.Length; i++)
{
SrgsItem item = items [i];
if (item == null)
{
throw new ArgumentNullException ("items", SR.Get (SRID.ParamsEntryNullIllegal));
}
_items.Add (item);
}
}
#endregion
//********************************************************************
//
// Public Methods
//
//*******************************************************************
#region public Method
///
/// TODOC
///
///
public void Add (SrgsItem item)
{
Helpers.ThrowIfNull (item, "item");
Items.Add (item);
}
#endregion
//********************************************************************
//
// Public Properties
//
//********************************************************************
#region public Properties
// ISSUE: Do we need more construcors? Take a look at RuleElementCollection.AddOneOf methods. [Bug# 37115]
/// TODOC <_include file='doc\OneOf.uex' path='docs/doc[@for="OneOf.Elements"]/*' />
public Collection Items
{
get
{
return _items;
}
}
#endregion
//*******************************************************************
//
// Internal Methods
//
//********************************************************************
#region internal Methods
internal override void WriteSrgs (XmlWriter writer)
{
// Write ...
writer.WriteStartElement ("one-of");
foreach (SrgsItem element in _items)
{
element.WriteSrgs (writer);
}
writer.WriteEndElement ();
}
internal override string DebuggerDisplayString ()
{
StringBuilder sb = new StringBuilder ("SrgsOneOf Count = ");
sb.Append (_items.Count);
return sb.ToString ();
}
#endregion
//*******************************************************************
//
// Protected Properties
//
//*******************************************************************
#region Protected Properties
///
/// Allows the Srgs Element base class to implement
/// features requiring recursion in the elements tree.
///
///
internal override SrgsElement [] Children
{
get
{
SrgsElement [] elements = new SrgsElement [_items.Count];
int i = 0;
foreach (SrgsItem item in _items)
{
elements [i++] = item;
}
return elements;
}
}
#endregion
//*******************************************************************
//
// Private Fields
//
//********************************************************************
#region Private Fields
private SrgsItemList _items = new SrgsItemList ();
#endregion
//*******************************************************************
//
// Private Types
//
//********************************************************************
#region Private Types
// Used by the debbugger display attribute
internal class OneOfDebugDisplay
{
public OneOfDebugDisplay (SrgsOneOf oneOf)
{
_items = oneOf._items;
}
[DebuggerBrowsable (DebuggerBrowsableState.RootHidden)]
public SrgsItem [] AKeys
{
get
{
SrgsItem [] items = new SrgsItem [_items.Count];
for (int i = 0; i < _items.Count; i++)
{
items [i] = _items [i];
}
return items;
}
}
private Collection _items;
}
#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
- ParserExtension.cs
- EUCJPEncoding.cs
- QuadraticBezierSegment.cs
- Menu.cs
- TextRunCacheImp.cs
- TraceListeners.cs
- IERequestCache.cs
- CalendarBlackoutDatesCollection.cs
- TCPClient.cs
- EditorPart.cs
- DialogResultConverter.cs
- FixUpCollection.cs
- BrushMappingModeValidation.cs
- TagPrefixInfo.cs
- ArrayElementGridEntry.cs
- DataColumnChangeEvent.cs
- AttributeData.cs
- BaseProcessor.cs
- BaseHashHelper.cs
- SecurityPolicySection.cs
- ColorMap.cs
- TdsValueSetter.cs
- CacheAxisQuery.cs
- Serialization.cs
- SourceItem.cs
- ErrorFormatter.cs
- ProxyAttribute.cs
- InternalBufferOverflowException.cs
- ObjectConverter.cs
- TreeNodeEventArgs.cs
- HtmlInputControl.cs
- AutomationPatternInfo.cs
- CodeMemberMethod.cs
- CustomAssemblyResolver.cs
- RegexCode.cs
- XsltContext.cs
- GridViewColumnCollectionChangedEventArgs.cs
- RequestCache.cs
- WebPartChrome.cs
- SelfIssuedAuthRSAPKCS1SignatureDeformatter.cs
- FormViewInsertedEventArgs.cs
- EncodingDataItem.cs
- SafeArchiveContext.cs
- HttpCapabilitiesBase.cs
- PropertyValue.cs
- ImageAnimator.cs
- Emitter.cs
- NegotiateStream.cs
- PointHitTestResult.cs
- DataGridViewCellStyleChangedEventArgs.cs
- FileLevelControlBuilderAttribute.cs
- ADMembershipProvider.cs
- OrderedDictionary.cs
- ClientApiGenerator.cs
- LambdaCompiler.ControlFlow.cs
- ModifierKeysValueSerializer.cs
- EntityDataSourceContextDisposingEventArgs.cs
- OperatorExpressions.cs
- PageThemeBuildProvider.cs
- DBSqlParser.cs
- GridLengthConverter.cs
- ProvidersHelper.cs
- FeatureAttribute.cs
- DataGridViewDataConnection.cs
- ServiceSecurityAuditBehavior.cs
- TableLayoutRowStyleCollection.cs
- CodeSnippetStatement.cs
- GcSettings.cs
- TextRangeProviderWrapper.cs
- ErrorHandler.cs
- FontCacheUtil.cs
- InternalConfigEventArgs.cs
- SoapElementAttribute.cs
- AccessDataSource.cs
- PixelFormatConverter.cs
- ConfigXmlElement.cs
- EventLogRecord.cs
- XPathAncestorIterator.cs
- WebPartMinimizeVerb.cs
- SystemMulticastIPAddressInformation.cs
- Application.cs
- NameTable.cs
- ReadOnlyMetadataCollection.cs
- DataGridState.cs
- LocalsItemDescription.cs
- ConfigurationSectionCollection.cs
- ReferencedType.cs
- SqlFlattener.cs
- TcpSocketManager.cs
- SafeThreadHandle.cs
- RadioButtonFlatAdapter.cs
- ListControlDesigner.cs
- XmlMemberMapping.cs
- SqlAggregateChecker.cs
- ECDiffieHellmanPublicKey.cs
- ComponentDispatcher.cs
- TypefaceMap.cs
- InternalBufferManager.cs
- DatatypeImplementation.cs
- PrintPreviewControl.cs