/// <summary> /// Creates a <see cref="MultipartBlockParser{T}"/>. /// </summary> /// <param name="multipartBlockFactory">The factory for creating <typeparamref name="T"/>s.</param> /// <param name="name"><typeparamref name="T"/>'s name. Expected in its opening line.</param> /// <param name="partTypes">The <see cref="PartType"/> of each part of a <typeparamref name="T"/>.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="multipartBlockFactory"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException">Thrown if <paramref name="name"/> is <c>null</c>, whitespace or an empty string.</exception> /// <exception cref="ArgumentException">Thrown if <paramref name="partTypes"/> is <c>null</c> or empty.</exception> protected MultipartBlockParser(IMultipartBlockFactory <T> multipartBlockFactory, string name, PartType[] partTypes) { _multipartBlockFactory = multipartBlockFactory ?? throw new ArgumentNullException(nameof(multipartBlockFactory)); if (!(partTypes?.Length > 0)) { throw new ArgumentException(nameof(partTypes)); } if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException(nameof(name)); } OpeningCharacters = new char[] { '+' }; _name = name; _nameLength = _name.Length; _partTypes = partTypes; _numParts = _partTypes.Length; }
/// <summary> /// Creates a <see cref="FlexiCardBlockParser"/>. /// </summary> /// <param name="flexiCardBlockFactory">The factory for building <see cref="FlexiCardBlock"/>s.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="flexiCardBlockFactory"/> is <c>null</c>.</exception> public FlexiCardBlockParser(IMultipartBlockFactory <FlexiCardBlock> flexiCardBlockFactory) : base(flexiCardBlockFactory, "card", new PartType[] { PartType.Leaf, PartType.Container, PartType.Leaf }) { }
/// <summary> /// Creates a <see cref="FlexiTabBlockParser"/>. /// </summary> /// <param name="flexiTabBlockFactory">The factory for building <see cref="FlexiTabBlock"/>s.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="flexiTabBlockFactory"/> is <c>null</c>.</exception> public FlexiTabBlockParser(IMultipartBlockFactory <FlexiTabBlock> flexiTabBlockFactory) : base(flexiTabBlockFactory, "tab", new PartType[] { PartType.Leaf, PartType.Container }) { }
/// <summary> /// Creates a <see cref="FlexiQuoteBlockParser"/>. /// </summary> /// <param name="flexiQuoteBlockFactory">The factory for building <see cref="FlexiQuoteBlock"/>s.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="flexiQuoteBlockFactory"/> is <c>null</c>.</exception> public FlexiQuoteBlockParser(IMultipartBlockFactory <FlexiQuoteBlock> flexiQuoteBlockFactory) : base(flexiQuoteBlockFactory, "quote", new PartType[] { PartType.Container, PartType.Leaf }) { }
public ExposedMultipartBlockParser(IMultipartBlockFactory <DummyMultipartBlock> multipartBlockFactory, string name, PartType[] partTypes) : base(multipartBlockFactory, name, partTypes) { }
/// <summary> /// Creates a <see cref="FlexiBannerBlockParser"/>. /// </summary> /// <param name="flexiBannerBlockFactory">The factory for building <see cref="FlexiBannerBlock"/>s.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="flexiBannerBlockFactory"/> is <c>null</c>.</exception> public FlexiBannerBlockParser(IMultipartBlockFactory <FlexiBannerBlock> flexiBannerBlockFactory) : base(flexiBannerBlockFactory, "banner", new PartType[] { PartType.Leaf, PartType.Leaf }) { }