diff src/Core/RazorEngine.Core/AttributeValue.cs @ 0:5bca2d201ad8

initial commit
author cin
date Sun, 24 Aug 2014 11:14:55 +0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Core/RazorEngine.Core/AttributeValue.cs	Sun Aug 24 11:14:55 2014 +0400
@@ -0,0 +1,38 @@
+namespace RazorEngine
+{
+    using System;
+
+    public class AttributeValue
+    {
+        public AttributeValue(PositionTagged<string> prefix, PositionTagged<object> value, bool literal)
+        {
+            Prefix = prefix;
+            Value = value;
+            Literal = literal;
+        }
+
+        public PositionTagged<string> Prefix { get; private set; }
+        public PositionTagged<object> Value { get; private set; }
+        public bool Literal { get; private set; }
+
+        public static AttributeValue FromTuple(Tuple<Tuple<string, int>, Tuple<object, int>, bool> value)
+        {
+            return new AttributeValue(value.Item1, value.Item2, value.Item3);
+        }
+
+        public static AttributeValue FromTuple(Tuple<Tuple<string, int>, Tuple<string, int>, bool> value)
+        {
+            return new AttributeValue(value.Item1, new PositionTagged<object>(value.Item2.Item1, value.Item2.Item2), value.Item3);
+        }
+
+        public static implicit operator AttributeValue(Tuple<Tuple<string, int>, Tuple<object, int>, bool> value)
+        {
+            return FromTuple(value);
+        }
+
+        public static implicit operator AttributeValue(Tuple<Tuple<string, int>, Tuple<string, int>, bool> value)
+        {
+            return FromTuple(value);
+        }
+    }
+}
\ No newline at end of file