From 9687382b803ec0dc5a7dd55be88b53a4264215f9 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sun, 23 Apr 2017 21:24:26 +0200 Subject: Initial commit --- lib/Config/Exception/FileNotFoundException.pm6 | 11 +++++++++++ lib/Config/Exception/UnimplementedMethodException.pm6 | 11 +++++++++++ lib/Config/Exception/UnknownTypeException.pm6 | 11 +++++++++++ lib/Config/Exception/UnsupportedTypeException.pm6 | 11 +++++++++++ lib/Config/Parser.pm6 | 18 ++++++++++++++++++ lib/Config/Type.pm6 | 8 ++++++++ 6 files changed, 70 insertions(+) create mode 100644 lib/Config/Exception/FileNotFoundException.pm6 create mode 100644 lib/Config/Exception/UnimplementedMethodException.pm6 create mode 100644 lib/Config/Exception/UnknownTypeException.pm6 create mode 100644 lib/Config/Exception/UnsupportedTypeException.pm6 create mode 100644 lib/Config/Parser.pm6 create mode 100644 lib/Config/Type.pm6 (limited to 'lib/Config') diff --git a/lib/Config/Exception/FileNotFoundException.pm6 b/lib/Config/Exception/FileNotFoundException.pm6 new file mode 100644 index 0000000..74d7bc1 --- /dev/null +++ b/lib/Config/Exception/FileNotFoundException.pm6 @@ -0,0 +1,11 @@ +#! /usr/bin/env false + +use v6.c; + +class Config::Exception::FileNotFoundException is Exception +{ + method message() + { + "Could not find file" + } +} diff --git a/lib/Config/Exception/UnimplementedMethodException.pm6 b/lib/Config/Exception/UnimplementedMethodException.pm6 new file mode 100644 index 0000000..ae87db9 --- /dev/null +++ b/lib/Config/Exception/UnimplementedMethodException.pm6 @@ -0,0 +1,11 @@ +#! /usr/bin/env false + +use v6.c; + +class Config::Exception::UnimplementedMethodException is Exception +{ + method message() + { + "This method is not implemented" + } +} diff --git a/lib/Config/Exception/UnknownTypeException.pm6 b/lib/Config/Exception/UnknownTypeException.pm6 new file mode 100644 index 0000000..de58755 --- /dev/null +++ b/lib/Config/Exception/UnknownTypeException.pm6 @@ -0,0 +1,11 @@ +#! /usr/bin/env false + +use v6.c; + +class Config::Exception::UnknownTypeException is Exception +{ + method message() + { + "Could not deduce loader type." + } +} diff --git a/lib/Config/Exception/UnsupportedTypeException.pm6 b/lib/Config/Exception/UnsupportedTypeException.pm6 new file mode 100644 index 0000000..c2f6f10 --- /dev/null +++ b/lib/Config/Exception/UnsupportedTypeException.pm6 @@ -0,0 +1,11 @@ +#! /usr/bin/env false + +use v6.c; + +class Config::Exception::UnsupportedTypeException is Exception +{ + method message() + { + "No parser support for the given file. Have you imported a correct parser?" + } +} diff --git a/lib/Config/Parser.pm6 b/lib/Config/Parser.pm6 new file mode 100644 index 0000000..23effc0 --- /dev/null +++ b/lib/Config/Parser.pm6 @@ -0,0 +1,18 @@ +#! /usr/bin/env false + +use v6.c; + +use Config::Exception::UnimplementedMethodException; + +class Config::Parser +{ + method read(Str $path --> Hash) + { + Config::Exception::UnimplementedMethodException.new.throw(); + } + + method write(Str $path, Hash $config --> Hash) + { + Config::Exception::UnimplementedMethodException.new.throw(); + } +} diff --git a/lib/Config/Type.pm6 b/lib/Config/Type.pm6 new file mode 100644 index 0000000..f348985 --- /dev/null +++ b/lib/Config/Type.pm6 @@ -0,0 +1,8 @@ +#! /usr/bin/env false + +use v6.c; + +enum Config::Type < + unknown + yaml +>; -- cgit v1.1