2016-08-06 16:19:35 +02:00
|
|
|
//
|
2017-07-13 22:32:11 +02:00
|
|
|
// Copyright (c) 2013-2017 Carsten Sonne Larsen <cs@innolan.net>
|
2016-08-06 16:19:35 +02:00
|
|
|
//
|
2016-04-02 11:22:42 +02:00
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
// furnished to do so, subject to the following conditions:
|
2016-08-06 16:19:35 +02:00
|
|
|
//
|
2016-04-02 11:22:42 +02:00
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
|
// all copies or substantial portions of the Software.
|
2016-08-06 16:19:35 +02:00
|
|
|
//
|
2016-04-02 11:22:42 +02:00
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
// THE SOFTWARE.
|
2016-04-10 11:50:35 +02:00
|
|
|
|
2016-04-02 11:22:42 +02:00
|
|
|
using System.Collections.Generic;
|
2016-08-06 16:19:35 +02:00
|
|
|
using System.Linq;
|
|
|
|
|
using Ntp.Analyzer.Config.Node.Destination;
|
|
|
|
|
using Ntp.Analyzer.Config.Syntax.Setting;
|
|
|
|
|
using Ntp.Analyzer.Config.Table;
|
2016-04-02 11:22:42 +02:00
|
|
|
using Ntp.Analyzer.Export;
|
|
|
|
|
|
2016-08-06 16:19:35 +02:00
|
|
|
namespace Ntp.Analyzer.Config.Syntax
|
2016-04-02 11:22:42 +02:00
|
|
|
{
|
2016-08-13 21:42:25 +02:00
|
|
|
public sealed class FileDestinationSyntaxNode : SyntaxNode<FileCollection>
|
2016-04-02 11:22:42 +02:00
|
|
|
{
|
2016-08-06 16:19:35 +02:00
|
|
|
public FileDestinationSyntaxNode(string name, int line)
|
|
|
|
|
: base(Symbol.KeywordDestinations, name, line)
|
2016-04-02 11:22:42 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-06 16:19:35 +02:00
|
|
|
protected override FileCollection InternalCompile()
|
2016-05-22 23:40:47 +02:00
|
|
|
{
|
2016-08-06 16:19:35 +02:00
|
|
|
var nodes = Nodes.OfType<StringSettingNode>().Where(n => n.Symbol == Symbol.KeywordFile);
|
|
|
|
|
var files = nodes.Select(n => new FileStreamDestination(n.Value));
|
|
|
|
|
return new FileCollection(Name, files);
|
2016-05-22 23:40:47 +02:00
|
|
|
}
|
2016-08-18 19:18:52 +02:00
|
|
|
|
|
|
|
|
protected override void ValidateMandatories()
|
|
|
|
|
{
|
|
|
|
|
CheckAllIsPresent(new List<Symbol> {Symbol.KeywordFile});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void ValidateTypes()
|
|
|
|
|
{
|
|
|
|
|
CheckTypeIs<StringSettingNode>(Symbol.KeywordFile);
|
|
|
|
|
}
|
2016-04-02 11:22:42 +02:00
|
|
|
}
|
2016-03-05 15:25:01 +01:00
|
|
|
}
|