Exemplo n.º 1
0
 internal DynamicReader(IReaderAdapter reader, DynamicBoundConfiguration config, object?context)
     : base(reader, config, context, new DynamicRowConstructor(), config.Options.ExtraColumnTreatment)
 {
     NameLookupReferenceCount = 0;
     NameLookup    = NameLookup.Empty;
     DelegateCache = new ConcurrentDictionary <object, Delegate>();
 }
Exemplo n.º 2
0
 internal HeadersReader(
     ReaderStateMachine stateMachine,
     BoundConfigurationBase <T> config,
     CharacterLookup charLookup,
     IReaderAdapter inner,
     BufferWithPushback buffer,
     ReadRowEnding rowEndingOverride
     )
     : this(stateMachine, config, charLookup, inner, null, buffer, rowEndingOverride)
 {
 }
        public Announcement CreateAnnouncementFromReader(IReaderAdapter reader)
        {
            ThrowIfArgumentNull(reader, nameof(reader));

            var text         = reader.GetString("Text");
            var timestamp    = reader.GetDateTime("Timestamp");
            var category     = reader.GetString("Category");
            var user         = CreateUserFromReader(reader);
            var announcement = Announcement.Create(timestamp, user, text, category);

            return(announcement);
        }
        public User CreateUserFromReader(IReaderAdapter reader)
        {
            ThrowIfArgumentNull(reader, nameof(reader));

            var id        = reader.GetInt("User_ID");
            var username  = reader.GetString("Username");
            var firstName = reader.GetString("First_Name");
            var lastName  = reader.GetString("Last_Name");
            var role      = reader.GetString("Role");
            var email     = reader.GetString("Email");

            return(new User(id, firstName, lastName, username, role, email));
        }
Exemplo n.º 5
0
 internal abstract IReader <T> CreateReader(IReaderAdapter reader, object?context = null);
Exemplo n.º 6
0
        private string ParseString(IReaderAdapter adapter)
        {
            var r = JReader.FromAdapter(adapter);

            return(r.String());
        }
Exemplo n.º 7
0
        private double ParseDouble(IReaderAdapter adapter)
        {
            var r = JReader.FromAdapter(adapter);

            return(r.Double());
        }
Exemplo n.º 8
0
        private bool ParseBool(IReaderAdapter adapter)
        {
            var r = JReader.FromAdapter(adapter);

            return(r.Bool());
        }
Exemplo n.º 9
0
 internal SyncReaderBase(IReaderAdapter inner, BoundConfigurationBase <T> config, object?context, IRowConstructor <T> rowBuilder, ExtraColumnTreatment extraTreatment) : base(config, context, rowBuilder, extraTreatment)
 {
     Inner = inner;
 }
Exemplo n.º 10
0
 internal RowEndingDetector(ReaderStateMachine stateMachine, Options options, MemoryPool <char> memPool, CharacterLookup charLookup, IReaderAdapter inner, ReadOnlyMemory <char> valueSeparatorMemory)
     : this(stateMachine, options, memPool, charLookup, inner, null, valueSeparatorMemory)
 {
 }
 internal override IReader <T> CreateReader(IReaderAdapter reader, object context = null)
 {
     throw new NotImplementedException("No sync reader");
 }
Exemplo n.º 12
0
 internal int Read(IReaderAdapter reader, bool canBeServedFromPushback)
 {
     if (InPushBack > 0)
     {
         PushBack[..InPushBack].CopyTo(Buffer);
Exemplo n.º 13
0
 internal Reader(IReaderAdapter inner, ConcreteBoundConfiguration <T> config, object?context, IRowConstructor <T> rowBuilder) : base(inner, config, context, rowBuilder, Utils.EffectiveColumnTreatmentForStatic(config))
 {
 }
Exemplo n.º 14
0
 private JReader(IReaderAdapter d)
 {
     _tr = new TokenReader();
     _awaitingReadValue = false;
     _delegate          = d;
 }
Exemplo n.º 15
0
 private JReader(TokenReader tokenReader)
 {
     _tr = tokenReader;
     _awaitingReadValue = false;
     _delegate          = null;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Creates a <see cref="JReader"/> that processes JSON-equivalent data from a custom
 /// source.
 /// </summary>
 /// <remarks>
 /// This allows deserialization logic based on <see cref="JReader"/> to be used on a custom input
 /// stream without involving the actual JSON parser. For instance, you could define an
 /// implementation of <see cref="IReaderAdapter"/> that consumes YAML data.
 /// </remarks>
 /// <param name="dataAdapter">an implementation of <see cref="IReaderAdapter"/></param>
 /// <returns>a new <see cref="JReader"/></returns>
 /// <seealso cref="IReaderAdapter"/>
 public static JReader FromAdapter(IReaderAdapter dataAdapter) =>
 new JReader(dataAdapter);
        internal override Reader <T> CreateReader(IReaderAdapter inner, object?context = null)
        {
            AssertCanMakeReader();

            return(new Reader <T>(inner, this, context, GetMutableRowBuilder()));
        }
 internal override DynamicReader CreateReader(IReaderAdapter reader, object?context = null)
 {
     return(new DynamicReader(reader, this, context));
 }