コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BackingStoreParseNodeFactory"/> class given a concrete implementation of <see cref="IParseNodeFactory"/>.
 /// </summary>
 public BackingStoreParseNodeFactory(IParseNodeFactory concrete) : base(
         concrete,
         (x) => {
     if (x is IBackedModel backedModel && backedModel.BackingStore != null)
     {
         backedModel.BackingStore.InitializationCompleted = false;
     }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpCore"/> class.
 /// <param name="authProvider">The authentication provider.</param>
 /// <param name="pNodeFactory">The parse node factory.</param>
 /// <param name="sWriterFactory">The serialization writer factory.</param>
 /// <param name="client">The native HTTP client.</param>
 /// </summary>
 public HttpCore(IAuthenticationProvider authenticationProvider, IParseNodeFactory parseNodeFactory = null, ISerializationWriterFactory serializationWriterFactory = null, System.Net.Http.HttpClient httpClient = null)
 {
     authProvider   = authenticationProvider ?? throw new ArgumentNullException(nameof(authenticationProvider));
     createdClient  = httpClient == null;
     client         = httpClient ?? new System.Net.Http.HttpClient();
     pNodeFactory   = parseNodeFactory ?? ParseNodeFactoryRegistry.DefaultInstance;
     sWriterFactory = serializationWriterFactory ?? SerializationWriterFactoryRegistry.DefaultInstance;
 }
コード例 #3
0
ファイル: ParserFactory.cs プロジェクト: Virtlink/noofax
		/// <summary>
		/// Initializes a new instance of the <see cref="ParserFactory"/> class.
		/// </summary>
		/// <param name="parseTableFormat">The parse table format.</param>
		/// <param name="parseNodeFactory">The parse node factory.</param>
		/// <param name="parseTreeBuilder">The parse tree builder.</param>
		public ParserFactory(IParseTableFormat parseTableFormat, IParseNodeFactory parseNodeFactory, IParseTreeTransformer<ITerm> parseTreeBuilder)
		{
			#region Contract
			Contract.Requires<ArgumentNullException>(parseTableFormat != null);
			Contract.Requires<ArgumentNullException>(parseNodeFactory != null);
			Contract.Requires<ArgumentNullException>(parseTreeBuilder != null);
			#endregion
			this.parseTableFormat = parseTableFormat;
			this.parseNodeFactory = parseNodeFactory;
			this.parseTreeBuilder = parseTreeBuilder;
		}
コード例 #4
0
ファイル: ApiClientBuilder.cs プロジェクト: PureKrome/kiota
        /// <summary>
        /// Enables the backing store on default parse nodes factories and the given parse node factory.
        /// </summary>
        /// <param name="original">The parse node factory to enable the backing store on.</param>
        /// <returns>A new parse node factory with the backing store enabled.</returns>
        public static IParseNodeFactory EnableBackingStoreForParseNodeFactory(IParseNodeFactory original)
        {
            IParseNodeFactory result = original ?? throw new ArgumentNullException(nameof(original));

            if (original is ParseNodeFactoryRegistry registry)
            {
                EnableBackingStoreForParseNodeRegistry(registry);
            }
            else
            {
                result = new BackingStoreParseNodeFactory(original);
            }
            EnableBackingStoreForParseNodeRegistry(ParseNodeFactoryRegistry.DefaultInstance);
            return(result);
        }
コード例 #5
0
 /// <summary>
 /// Creates a new proxy factory that wraps the specified concrete factory while composing the before and after callbacks.
 /// </summary>
 /// <param name="concrete">The concrete factory to wrap.</param>
 /// <param name="onBefore">The callback to invoke before the deserialization of any model object.</param>
 /// <param name="onAfter">The callback to invoke after the deserialization of any model object.</param>
 public ParseNodeProxyFactory(IParseNodeFactory concrete, Action <IParsable> onBefore, Action <IParsable> onAfter)
 {
     _concrete = concrete ?? throw new ArgumentNullException(nameof(concrete));
     _onBefore = onBefore;
     _onAfter  = onAfter;
 }
コード例 #6
0
 /// <summary>
 /// Enables the backing store for the registered serialization and parse node factories
 /// </summary>
 public void EnableBackingStore()
 {
     pNodeFactory   = ApiClientBuilder.EnableBackingStoreForParseNodeFactory(pNodeFactory) ?? throw new InvalidOperationException("Could not enable backing store for the parse node factory");
     sWriterFactory = ApiClientBuilder.EnableBackingStoreForSerializationWriterFactory(sWriterFactory) ?? throw new InvalidOperationException("Could not enable backing store for the serializer writer factory");
 }
コード例 #7
0
ファイル: SglrEngine.cs プロジェクト: Virtlink/noofax
		/// <summary>
		/// Initializes a new instance of the <see cref="SglrEngine"/> class.
		/// </summary>
		/// <param name="reader">The text reader to read from.</param>
		/// <param name="parseTable">The parse table.</param>
		/// <param name="parseNodeFactory">The parse node factory.</param>
		public SglrEngine(TextReader reader, ParseTable parseTable, IParseNodeFactory parseNodeFactory)
		{
			#region Contract
			Contract.Requires<ArgumentNullException>(reader != null);
			Contract.Requires<ArgumentNullException>(parseTable != null);
			Contract.Requires<ArgumentNullException>(parseNodeFactory != null);
			#endregion

			this.reader = reader as PeekingReader ?? new PeekingReader(reader);
			this.parseTable = parseTable;
			this.parseNodeFactory = parseNodeFactory;

			// C0 = (s0 | a1 ... an)
			this.AcceptingStack = null;
			this.StartFrame = new Frame(this.parseTable.InitialState);
			this.activeStacks = new Deque<Frame>() { this.StartFrame };
		}