Example #1
0
 public Placeholder(IDocument document, PlaceholderType placeholderType, string description)
 {
     _document = document;
     _node = document.CreateNode("placeholder", "text");
     PlaceholderType = placeholderType;
     Description = description;
 }
Example #2
0
 public Placeholder(IDocument document, PlaceholderType placeholderType, string description)
 {
     _document       = document;
     _node           = document.CreateNode("placeholder", "text");
     PlaceholderType = placeholderType;
     Description     = description;
 }
Example #3
0
        public void PlaceholderType_GetterReturnsPlaceholderTypeOfTheShape(IShape shape, PlaceholderType expectedType)
        {
            // Act
            PlaceholderType actualType = shape.Placeholder.Type;

            // Assert
            actualType.Should().Be(expectedType);
        }
Example #4
0
        public ThumbnailPlaceholder()
        {
            m_type      = PlaceholderType.RECTANGLE;
            m_text      = "Placeholder";
            m_sizeText  = 12.0F;
            m_textColor = Color.Black;
            m_fontName  = "Arial";

            InitializeComponent();
        }
Example #5
0
        /// <summary>
        /// Returns the hash calculating upon the formula suggested here: https://stackoverflow.com/a/263416/2948684
        /// </summary>
        /// <remarks></remarks>
        public override int GetHashCode()
        {
            var hash = 17;

            hash = hash * 23 + PlaceholderType.GetHashCode(); //TODO; make readonly
            if (PlaceholderType == PlaceholderType.Custom)
            {
                hash = hash * 23 + Index.GetHashCode();
            }

            return(hash);
        }
Example #6
0
        public Section()
        {
            m_auto   = false;
            m_width  = 128;
            m_height = 128;

            m_type            = PlaceholderType.RECTANGLE;
            m_backgroundColor = Color.White;
            m_borderColor     = Color.Black;
            m_thickness       = 2;

            m_fontName  = "Arial";
            m_textSize  = 12;
            m_textColor = Color.Black;

            m_files = new List <FileSection>();
        }
Example #7
0
 public Placeholder(IDocument document, PlaceholderType placeholderType, string description)
     : this(document, placeholderType)
 {
     Description = description;
 }
Example #8
0
 public Placeholder(IDocument document, PlaceholderType placeholderType)
 {
     Document        = document;
     Node            = new XElement(Ns.Text + "placeholder");
     PlaceholderType = placeholderType;
 }
Example #9
0
 public static string FeedPlaceholderView(long customerId, PlaceholderType placeholderType)
 {
     return($"customers/{customerId}/feedPlaceholderViews/" +
            $"{ProtobufUtilities.GetOriginalEnumFieldName(placeholderType)}");
 }
Example #10
0
 public void VisitPlaceholderType(PlaceholderType placeholderType)
 {
     throw new NotImplementedException();
 }
Example #11
0
 public PlaceholderEffect(string name, PlaceholderType type) : this()
 {
     Name            = name;
     PlaceholderType = type;
 }
Example #12
0
        void IdentifierPattern(out PatternConstruct pattern)
        {
            PatternConstruct inner = null; string name; AstType type = new PlaceholderType(TextLocation.Empty);
            Expect(14);
            name = t.val;
            var ident = AstNode.MakeIdentifier(name, type, CurrentLocation);
            Symbols.AddSymbol(name, ident);

            if (la.kind == 78) {
            Get();
            LhsPattern(out inner);
            }
            pattern = PatternConstruct.MakeIdentifierPattern(ident, inner);
        }
Example #13
0
 public Placeholder(IDocument document, PlaceholderType placeholderType)
 {
     _document = document;
     _node = document.CreateNode("placeholder", "text");
     PlaceholderType = placeholderType;
 }
Example #14
0
        void Type(out AstType type)
        {
            var start_loc = NextLocation; type = new PlaceholderType(NextLocation);
            var is_reference = false; string name = null;

            if (la.kind == 44) {
            Get();
            is_reference = true;
            }
            switch (la.kind) {
            case 45: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 46: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 47: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 48: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 49: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 50: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 51: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 52: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 53: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 8: {
            TupleTypeSignature(out type);
            break;
            }
            case 54: {
            Get();
            name = t.val;
            break;
            }
            case 55: {
            Get();
            name = t.val;
            break;
            }
            case 56: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 57: {
            Get();
            type = CreateType(t.val, start_loc, is_reference);
            break;
            }
            case 58: {
            Get();
            type = AstType.MakeSimpleType("tuple", Enumerable.Empty<AstType>(), start_loc, CurrentLocation);
            break;
            }
            case 14: {
            TypePathExpression(out type);
            if(is_reference) type = AstType.MakeReferenceType(type, TextLocation.Empty);
            break;
            }
            default: SynErr(112); break;
            }
            start_loc = NextLocation;
            if (la.kind == 42) {
            GenericTypeSignature(name, is_reference, start_loc, out type);
            if(!IsPrimitiveGenericType(name)){
               SemanticError("Error ES0006: `{0}` is not a generic type!", name);
               return;
            }

            }
            while (la.kind == 9) {
            Get();
            Expect(3);
            if(type.IsNull)
               SemanticError("Error ES0007: Array of unknown type is specified. Unknown type is just unknown!");

            type = AstType.MakeSimpleType("array", new []{type}, start_loc, CurrentLocation);

            }
        }
Example #15
0
        void Identifier(out Identifier ident)
        {
            string name; AstType type = new PlaceholderType(TextLocation.Empty); var start_loc = CurrentLocation;
            Expect(14);
            name = t.val;
            if(CheckKeyword(t.val)){
               ident = null;
               return;
            }

            if (la.kind == 41) {
            Get();
            Type(out type);
            }
            ident = AstNode.MakeIdentifier(name, type, start_loc, CurrentLocation);
        }
Example #16
0
 public static string FeedPlaceholderView(long customerId, PlaceholderType placeholderType)
 {
     return($"customers/{customerId}/feedPlaceholderViews/{placeholderType.ToString().ToUpper()}");
 }
Example #17
0
        private static Type GetTypeFromDescriptor(string descriptor)
        {
            if (descriptor.Length == 1)
            {
                switch (descriptor)
                {
                    case "B":
                        return PrimativeTypes.Byte;
                    case "C":
                        return PrimativeTypes.Char;
                    case "D":
                        return PrimativeTypes.Double;
                    case "F":
                        return PrimativeTypes.Float;
                    case "I":
                        return PrimativeTypes.Int;
                    case "J":
                        return PrimativeTypes.Long;
                    case "S":
                        return PrimativeTypes.Short;
                    case "Z":
                        return PrimativeTypes.Boolean;
                    case "V":
                        return PrimativeTypes.Void;
                    default:
                        throw new NotImplementedException();
                }
            }

            int arrayDimensions = descriptor.TakeWhile(x => x == '[').Count();
            descriptor = new string(descriptor.SkipWhile(x => x == '[').ToArray());

            if (descriptor.Length == 1)
            {
                Type type = GetTypeFromDescriptor(descriptor);

                for (var i = 0; i < arrayDimensions; i++)
                {
                    type = new Array(type);
                }

                return type;
            }

            if (descriptor[0] != 'L') throw new ArgumentException();
            if (descriptor[descriptor.Length - 1] != ';') throw new ArgumentException();

            {
                Type type = new PlaceholderType
                               {
                                   Name = descriptor.Replace('/', '.').Substring(1, descriptor.Length - 2)
                               };

                for (var i = 0; i < arrayDimensions; i++)
                {
                    type = new Array(type);
                }

                return type;
            }
        }
Example #18
0
        private static Tuple<List<Type>, Type> GetMethodTypeFromDescriptor(string descriptor)
        {
            int i = 0;
            if (descriptor[i++] != '(') throw new ArgumentException();

            var parameterTypes = new List<Type>();

            while (descriptor[i] != ')')
            {
                switch (descriptor[i++])
                {
                    case 'B':
                    case 'C':
                    case 'D':
                    case 'F':
                    case 'I':
                    case 'J':
                    case 'S':
                    case 'Z':
                        parameterTypes.Add(GetTypeFromDescriptor(new string(new[] { descriptor[i - 1] })));
                        break;
                    case 'L':
                        {
                            string typeName = "";
                            while (descriptor[i] != ';')
                            {
                                typeName += descriptor[i++];
                            }
                            i++;

                            parameterTypes.Add(new PlaceholderType { Name = typeName.Replace('/', '.') });
                        }
                        break;
                    case '[':
                        {
                            int arrayDimensions = 1;
                            while (descriptor[i] == '[')
                            {
                                arrayDimensions++;
                                i++;
                            }

                            Type type;
                            if (descriptor[i] == 'L')
                            {
                                var typeName = "";

                                i++;

                                while (descriptor[i] != ';')
                                {
                                    typeName += descriptor[i++];
                                }

                                type = new PlaceholderType { Name = typeName.Replace('/', '.') };
                            }
                            else
                            {
                                type = GetTypeFromDescriptor(new string(new[] { descriptor[i] }));
                            }
                            i++;

                            for (var x = 0; x < arrayDimensions; x++)
                            {
                                type = new Array(type);
                            }

                            parameterTypes.Add(type);
                        }
                        break;
                    default:
                        throw new NotImplementedException();
                }
            }

            if (descriptor[i++] != ')') throw new ArgumentException();

            Type returnType = GetTypeFromDescriptor(descriptor.Substring(i));

            return new Tuple<List<Type>, Type>(parameterTypes, returnType);
        }
Example #19
0
 internal PlaceHolder (string name, string label, PlaceholderType tagOrId)
 {
     this.name = name;
     this.label = label;
     this.tagOrId = tagOrId;
 }
Example #20
0
 internal PlaceHolder(string name, string label, PlaceholderType tagOrId)
 {
     this.name    = name;
     this.label   = label;
     this.tagOrId = tagOrId;
 }
Example #21
0
 public Placeholder(IDocument document, PlaceholderType placeholderType)
 {
     _document       = document;
     _node           = document.CreateNode("placeholder", "text");
     PlaceholderType = placeholderType;
 }
Example #22
0
 internal PlaceHolder(string name, string label, PlaceholderType tagOrId, Type dataType, string formatString)
     : this(name, label, tagOrId)
 {
     this.dataType     = dataType;
     this.formatString = formatString;
 }
Example #23
0
 internal PlaceHolder (string name, string label, PlaceholderType tagOrId, Type dataType, string formatString)
     : this(name, label, tagOrId)
 {
     this.dataType = dataType;
     this.formatString = formatString;
 }
 public void VisitPlaceholderType(PlaceholderType placeholderType)
 {
     // no op
 }
Example #25
0
        void FuncDecl(out EntityDeclaration decl, Modifiers modifiers)
        {
            Identifier ident = null;
            string name; AstType type = null; BlockStatement block;
            var type_params = new List<ParameterType>();
            var @params = new List<ParameterDeclaration>();
            var start_loc = NextLocation;

            while (!(la.kind == 0 || la.kind == 38)) {SynErr(105); Get();}
            Expect(38);
            Symbols.AddScope();
            Expect(14);
            name = t.val;
            if(!CheckKeyword(name)){
               ident = AstNode.MakeIdentifier(name, new PlaceholderType(TextLocation.Empty), CurrentLocation);
               Symbols.AddSymbol(name, ident);
            }else{
               // The name is unsuitable for a method or a function name.
               // Leave the parser to recover its state.
            }

            if (la.kind == 42) {
            GenericTypeParameters(ref type_params);
            }
            Expect(8);
            GoDownScope();
            Symbols.Name = "func " + name + "`" + ScopeId++;

            if (la.kind == 14) {
            ParamList(type_params, ref @params);
            }
            Expect(10);
            if (la.kind == 39) {
            Get();
            Type(out type);
            }
            if(type == null)
               type = new PlaceholderType(TextLocation.Empty);

            if(type_params.Any(tp => tp.Identifier == type.Name)){
               var type_param = type_params.Where(tp => tp.Identifier == type.Name)
               .Select(tp => tp)
               .First()
               .Clone();

            }

            Block(out block);
            decl = EntityDeclaration.MakeFunc(ident, @params, block, type, modifiers, start_loc);
                GoUpScope();
        }