コード例 #1
0
        protected internal DynamicField(String fieldName, Type fieldType, FieldFlags flags, TypeBuilder builder) : this( builder ) {
            this._fieldBuilder = this._typeBuilder.DefineField(fieldName,
                                                               fieldType,
                                                               (( FieldAttributes )flags));

            return;
        }
コード例 #2
0
        internal RuntimeIshtarField DefineField(string name, FieldFlags flags, VeinClass type)
        {
            var f = new RuntimeIshtarField(this, new FieldName(name, Name), flags, type);

            this.Fields.Add(f);
            return(f);
        }
コード例 #3
0
 public VeinProperty(VeinClass owner, FieldName fullName, FieldFlags flags, VeinClass propType)
 {
     this.Owner    = owner;
     this.FullName = fullName;
     this.Flags    = flags;
     this.PropType = propType;
 }
コード例 #4
0
        FieldProperties ParseField(string tableName, XElement xField)
        {
            string         name           = xField.Attribute("Name").Value;
            var            dataType       = (DataType)Enum.Parse(typeof(DataType), xField.Attribute("DataType").Value);
            FieldFlags     flags          = FieldFlags.None;
            Type           valueType      = null;
            StringEncoding stringEncoding = StringEncoding.Undefined;
            int            maxLength      = 0;
            DateTimeType   dateTimeType   = DateTimeType.Native;
            DateTimeKind   dateTimeKind   = DateTimeKind.Unspecified;
            string         description    = null;

            foreach (XElement element in xField.Elements())
            {
                switch (element.Name.LocalName)
                {
                case "Flags": flags = (FieldFlags)Enum.Parse(typeof(FieldFlags), element.Value); break;

                case "ValueType": valueType = LoadType(element.Value); break;

                case "StringEncoding": stringEncoding = (StringEncoding)Enum.Parse(typeof(StringEncoding), element.Value); break;

                case "MaximumLength": maxLength = int.Parse(element.Value); break;

                case "DateTimeType": dateTimeType = (DateTimeType)Enum.Parse(typeof(DateTimeType), element.Value); break;

                case "DateTimeKind": dateTimeKind = (DateTimeKind)Enum.Parse(typeof(DateTimeKind), element.Value); break;

                case "Description": description = element.Value; break;

                default: throw new InvalidDataException(string.Format("Unknown tree type {0}", element.Name.LocalName));
                }
            }
            return(new FieldProperties(tableName, flags, dataType, valueType, maxLength, name, dataType, dateTimeType, dateTimeKind, stringEncoding, name, description, null, null));
        }
コード例 #5
0
 public VeinField(VeinClass owner, FieldName fullName, FieldFlags flags, VeinClass fieldType)
 {
     this.Owner     = owner;
     this.FullName  = fullName;
     this.Flags     = flags;
     this.FieldType = fieldType;
 }
コード例 #6
0
 public FieldAttribute(string name, FieldFlags flags, string TableReference, string columnReference)
 {
     this.Name            = name;
     this.Flags           = flags;
     this.TableReference  = TableReference;
     this.columnReference = columnReference;
 }
コード例 #7
0
        private IDynamicField AddField(String fieldName, Type fieldType, FieldFlags flags, TypeBuilder builder)
        {
            IDynamicField local = new DynamicField(fieldName, fieldType, flags, builder);

            this._dynamicFields.Add(local);

            return(local);
        }
コード例 #8
0
 public IXDescriptorProperty(string name, string value, byte[] binaryValue, FieldFlags flags, FieldStore store, FieldIndex index)
 {
     this.Name        = name;
     this.StringValue = (binaryValue == null) ? value : null;
     this.BinaryValue = (binaryValue == null) ? null : binaryValue;
     this.Flags       = flags;
     this.Store       = store;
     this.Index       = index;
 }
コード例 #9
0
ファイル: FieldRow.cs プロジェクト: sperling/cskarp
 internal FieldRow(
     FieldFlags flags,
     uint name,
     uint signature)
 {
     this.Flags     = flags;
     this.Name      = name;
     this.Signature = signature;
 }
コード例 #10
0
ファイル: FieldRow.cs プロジェクト: EkardNT/Roslyn
 internal FieldRow(
   FieldFlags flags,
   uint name,
   uint signature)
 {
     this.Flags = flags;
     this.Name = name;
     this.Signature = signature;
 }
コード例 #11
0
 public FieldDef(ComplexTypeDef ownerType, string name, TypeRef typeRef)
 {
     OwnerType = ownerType;
     Name      = name;
     TypeRef   = typeRef;
     if (typeRef.TypeDef.IsComplexReturnType())
     {
         Flags |= FieldFlags.ReturnsComplexType;
     }
 }
コード例 #12
0
 protected IEnumerable <DataField> GetData(FieldFlags flag)
 {
     foreach (var field in m_mapByPostion)
     {
         if (field?.Flags.HasFlag(flag) == true)
         {
             yield return(field);
         }
     }
 }
コード例 #13
0
 internal PipelineFieldAction2(PipelineFieldAction2 template, String name, Regex regex)
     : base(template, name, regex)
 {
     this.toField        = optReplace(regex, name, template.toField);
     this.toVar          = optReplace(regex, name, template.toVar);
     this.toFieldFromVar = optReplace(regex, name, template.toFieldFromVar);
     this.sep            = template.sep;
     this.fieldFlags     = template.fieldFlags;
     toFieldReal         = toField == "*" ? null : toField;
 }
コード例 #14
0
 protected static void addUnique(JArray arr, Object value, FieldFlags flags)
 {
    StringComparison comparison = toComparison(flags);
    String v = value == null ? null : value.ToString();
    for (int i = 0; i < arr.Count; i++)
    {
       if (String.Equals((String)arr[i], v, comparison)) return;
    }
    arr.Add(value);
    return;
 }
コード例 #15
0
        protected Entity()
        {
            // get the entity type...
            this.EntityType = EntityType.GetEntityType(this.GetType());
            if (this.EntityType == null)
                throw new InvalidOperationException("'this.EntityType' is null.");

            // create the slots...
            _values = new object[this.EntityType.Fields.Count];
            _flags = new FieldFlags[this.EntityType.Fields.Count];
        }
コード例 #16
0
 private bool IsFlagSet(int index, FieldFlags flag)
 {
     if ((_flags[index] & flag) == flag)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #17
0
        static void CreateField(ref List <IFieldProperties> fields, FieldFlags flags, DataType dataType, string name, Type valueType = null)
        {
            var field = new FieldProperties()
            {
                Index     = fields.Count,
                Name      = name,
                Flags     = flags,
                DataType  = dataType,
                ValueType = valueType,
            }.Validate();

            fields.Add(field);
        }
コード例 #18
0
        protected Entity()
        {
            // get the entity type...
            this.EntityType = EntityType.GetEntityType(this.GetType());
            if (this.EntityType == null)
            {
                throw new InvalidOperationException("'this.EntityType' is null.");
            }

            // create the slots...
            _values = new object[this.EntityType.Fields.Count];
            _flags  = new FieldFlags[this.EntityType.Fields.Count];
        }
コード例 #19
0
        public MSSQLField(string name, MemberInfo member, FieldFlags flags)
        {
            this.name  = name;
            this.flags = flags;

            if (member.MemberType == MemberTypes.Property)
            {
                property = member as PropertyInfo;
            }
            else
            {
                field = member as FieldInfo;
            }
        }
コード例 #20
0
ファイル: Field.cs プロジェクト: fzhenmei/Serenity
 protected Field(ICollection<Field> fields, FieldType type, string name, LocalText caption, int size, FieldFlags flags)
 {
     this.name = name;
     expression = "T0." + SqlSyntax.AutoBracket(name);
     this.size = size;
     this.flags = flags;
     this.type = type;
     index = -1;
     minSelectLevel = SelectLevel.Default;
     naturalOrder = 0;
     this.caption = caption;
     if (fields != null)
         fields.Add(this);
 }
コード例 #21
0
        public void AddField <U>(string fieldName, FieldFlags flags = FieldFlags.None)
        {
            if (FieldLocator.LocateName(fieldName) is null)
            {
                if (Owner.CFlags.HasFlag(ControlFlags.EnablePages))
                {
                    AddField_PagesFlagEnabled();
                }
                else
                {
                    AddField_PagesFlagDisabled();
                }
            }

            void AddField_PagesFlagEnabled()
            {
RECALC:
                var actualPage = PageLocator.LocateLast();

                var newY = (actualPage.Horizontal_Spacing * actualPage.Fields.Count) + (actualPage.Fields.Count * actualPage.FieldHeight);

                // Predict if the the bounds of the new field will overlap with
                // the controls. If so, create a new page
                if (newY + actualPage.FieldHeight > actualPage.Size.Height - 35)
                {
                    actualPage.Modify.AddPage();
                    goto RECALC;
                }
                actualPage.Fields.Add(new Fieldset(
                                          actualPage,
                                          actualPage.Fields.Count + 1,
                                          fieldName,
                                          typeof(U),
                                          0,
                                          newY,
                                          flags));
            }

            void AddField_PagesFlagDisabled()
            {
                Owner.Fields.Add(new Fieldset(
                                     Owner,
                                     Owner.Fields.Count + 1,
                                     fieldName,
                                     typeof(U),
                                     0,
                                     (Owner.Horizontal_Spacing * Owner.Fields.Count) + (Owner.Fields.Count * Owner.FieldHeight),
                                     flags));
            }
        }
コード例 #22
0
ファイル: Field.cs プロジェクト: ganeshan/Serenity
 protected Field(ICollection <Field> fields, FieldType type, string name, LocalText caption, int size, FieldFlags flags)
 {
     this.name      = name;
     expression     = "T0." + name;
     this.size      = size;
     this.flags     = flags;
     this.type      = type;
     index          = -1;
     minSelectLevel = SelectLevel.Default;
     naturalOrder   = 0;
     this.caption   = caption;
     if (fields != null)
     {
         fields.Add(this);
     }
 }
コード例 #23
0
ファイル: OrmSchema.Field.cs プロジェクト: wangfujia/iridium
            public void UpdateFlags(FieldFlags flags, bool?state)
            {
                if (state == null)
                {
                    return;
                }

                if (state.Value)
                {
                    Flags |= flags;
                }
                else
                {
                    Flags &= ~flags;
                }
            }
コード例 #24
0
        //---------------------------------------------------------------------------------------------------------------------

        protected override int WriteItemContents(int id, string query, FieldFlags flags, int level)
        {
            int count = base.WriteItemContents(id, query, flags, level);

            if (AllowAll)
            {
                xmlWriter.WriteStartElement("item");
                xmlWriter.WriteAttributeString("link", String.Format("{0}?{1}=assign", webContext.ScriptName, IfyWebContext.OperationParameterName));
                xmlWriter.WriteAttributeString("input", "true");
                xmlWriter.WriteElementString("caption", "Sign in with an OpenID");
                xmlWriter.WriteElementString("inputCaption", "Full OpenID");
                xmlWriter.WriteEndElement(); // </item>
                count++;
            }
            return(count);
        }
コード例 #25
0
ファイル: ModelClasses.cs プロジェクト: rivantsov/ngraphql
        public FieldDef(ComplexTypeDef ownerType, string name, TypeRef typeRef)
        {
            OwnerType = ownerType;
            Name      = name;
            TypeRef   = typeRef;
            Index     = ownerType.Fields.Count;
            var typeDef = TypeRef.TypeDef;

            if (typeDef.IsComplexReturnType())
            {
                Flags |= FieldFlags.ReturnsComplexType;
            }
            if (ownerType.TypeRole != TypeRole.Data)
            {
                Flags |= FieldFlags.Static;
            }
        }
コード例 #26
0
ファイル: Field.cs プロジェクト: mohdjuwaiser/Serenity
 protected Field(ICollection <Field> fields, FieldType type, string name, LocalText caption, int size, FieldFlags flags)
 {
     this.name        = name;
     expression       = "T0." + SqlSyntax.AutoBracket(name);
     this.size        = size;
     this.flags       = flags;
     this.type        = type;
     index            = -1;
     minSelectLevel   = SelectLevel.Auto;
     naturalOrder     = 0;
     this.caption     = caption;
     customAttributes = Array.Empty <object>();
     if (fields != null)
     {
         fields.Add(this);
     }
 }
コード例 #27
0
        public PipelineFieldAction(Pipeline pipeline, XmlNode node)
            : base(pipeline, node)
        {
            fieldSource = FieldSource.Event;
            toVar       = node.ReadStr("@tovar", null);
            fromVar     = node.ReadStr("@fromvar", null);
            fromField   = node.ReadStr("@fromfield", null);
            fromValue   = node.ReadStr("@fromvalue", null);

            int cnt = 0;

            if (fromVar != null)
            {
                cnt++;
                fieldSource = FieldSource.Variable;
            }
            if (fromField != null)
            {
                cnt++;
                fieldSource = FieldSource.Field;
            }
            if (fromValue != null)
            {
                cnt++;
                fieldSource = FieldSource.Value;
            }
            if (cnt > 1)
            {
                throw new BMNodeException(node, "Cannot specify fromvar, fromfield or fromvalue together.");
            }

            toField        = node.ReadStr("@field", null);
            toFieldFromVar = node.ReadStr("@fieldfromvar", null);
            sep            = node.ReadStr("@sep", null);
            fieldFlags     = node.ReadEnum("@flags", sep == null ? FieldFlags.OverWrite : FieldFlags.Append);

            if (toField == null && toVar == null && base.scriptName == null && toFieldFromVar == null)
            {
                throw new BMNodeException(node, "At least one of 'field', 'toFieldFromVar', 'tovar', 'script'-attributes is mandatory.");
            }

            toFieldReal = toField == "*" ? null : toField;
        }
コード例 #28
0
        protected virtual FieldFlags SetFieldFlags(Epi.Fields.RenderableField field)
        {
            FieldFlags flags = new FieldFlags(false, false, false, false);

            if (field is TableBasedDropDownField || field is YesNoField || field is CheckBoxField)
            {
                flags.IsDropDownListField = true;
                if (field is DDLFieldOfCommentLegal)
                {
                    flags.IsCommentLegalField = true;
                }
            }
            else if (field is OptionField)
            {
                flags.IsOptionField = true;
            }

            return(flags);
        }
コード例 #29
0
        public PipelineFieldAction2(Pipeline pipeline, XmlNode node)
            : base(pipeline, node)
        {
            toVar          = node.ReadStr("@tovar", null);
            toField        = node.ReadStr("@field", null);
            toFieldFromVar = node.ReadStr("@fieldfromvar", null);
            sep            = node.ReadStr("@sep", null);
            fieldFlags     = node.ReadEnum("@flags", sep == null ? FieldFlags.OverWrite : FieldFlags.Append);

            if (toField == null && toVar == null && base.scriptName == null && toFieldFromVar == null && base.bodyFunc == null)
            {
                throw new BMNodeException(node, "At least one of 'field', 'toFieldFromVar', 'tovar', 'script'-attributes is mandatory.");
            }

            toFieldReal = toField == "*" ? null : toField;

            if (node.ReadStr("@fromvar", null) != null || node.ReadStr("@fromfield", null) != null || node.ReadStr("@fromvalue", null) != null)
            {
                throw new BMNodeException(node, "fromvar|fromfield|fromvalue not supported. Use source=xxxx or type='orgfield' for the deprecated action.");
            }
        }
コード例 #30
0
 public GenericField(ICollection <Field> collection, FieldType type, string name, string caption, int size, FieldFlags flags,
                     Func <IRow, TValue> getValue, Action <IRow, TValue> setValue)
     : base(collection, type, name, caption, size, flags)
 {
     _getValue = getValue;
     _setValue = setValue;
 }
コード例 #31
0
 private void SetFlag(int ordinal, FieldFlags flag)
 {
     _flags[ordinal] = _flags[ordinal] | flag;
 }
コード例 #32
0
ファイル: Nodes.cs プロジェクト: modulexcite/SHFB-1
 public virtual System.Reflection.FieldInfo GetFieldInfo()
 {
     if(this.fieldInfo == null)
     {
         TypeNode tn = this.DeclaringType;
         if(tn == null)
             return null;
         Type t = tn.GetRuntimeType();
         if(t == null)
             return null;
         System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.DeclaredOnly;
         if(this.IsPublic)
             flags |= System.Reflection.BindingFlags.Public;
         else
             flags |= System.Reflection.BindingFlags.NonPublic;
         if(this.IsStatic)
             flags |= System.Reflection.BindingFlags.Static;
         else
             flags |= System.Reflection.BindingFlags.Instance;
         this.fieldInfo = t.GetField(this.Name.ToString(), flags);
     }
     return this.fieldInfo;
 }
コード例 #33
0
 /// <summary>
 /// Turn on or off field flags.
 /// </summary>
 /// <param name="add">Set of flags to turn on (include)</param>
 /// <param name="remove">Set of flags to turn off (exclude)</param>
 public SetFieldFlagsAttribute(FieldFlags add, FieldFlags remove = FieldFlags.None)
 {
     this.Add = add;
     this.Remove = remove;
 }
コード例 #34
0
ファイル: Rewriter.cs プロジェクト: nbulp/CodeContracts
    private Field GetReturnValueClosureField(TypeNode declaringType, TypeNode resultType, FieldFlags flags, int uniqueKey)
    {
      Contract.Requires(declaringType != null);
      
      Contract.Assume(declaringType.Template == null);
      Identifier name = Identifier.For("_result" + uniqueKey.ToString()); // unique name for this field

      Field f = declaringType.GetField(name);
      if (f != null) return f;

      f = new Field(declaringType,
        null,
        flags,
        name,
        resultType,
        null);

      declaringType.Members.Add(f);
      // remember we added it so we can make it part of initializations
      if (f.IsStatic)
      {
        topLevelStaticResultField = f;
      }
      else
      {
        topLevelClosureResultField = f;
      }
      return f;
    }
コード例 #35
0
 private bool IsFlagSet(int index, FieldFlags flag)
 {
     if ((_flags[index] & flag) == flag)
         return true;
     else
         return false;
 }
コード例 #36
0
      public virtual void SetField(String fld, Object value, FieldFlags fieldFlags=FieldFlags.OverWrite, String sep=null)
      {
         //Logs.DebugLog.Log("SetField ({0}, {1})", fld, value);
         if (String.IsNullOrEmpty(fld))
         {
            if (value == null) return;
            accumulator = (JObject)value;
            goto EXIT_RTN; 
         }
         if ((flags & Bitmanager.ImportPipeline.Endpoint.DebugFlags._LogField) != 0) addLogger.Log("-- setfield {0}: '{1}'", fld, value);
         //if (value == null) addLogger.Log("Field {0}==null", fld);

         //Test for empty fields
         if ((fieldFlags & FieldFlags.SkipEmpty) != 0)
         {
            if (value == null) goto EXIT_RTN; ;
            String tmp = value as String;
            if (tmp != null && tmp.Length == 0) goto EXIT_RTN; ;
         }

         switch (fieldFlags & (FieldFlags.Append | FieldFlags.OverWrite | FieldFlags.ToArray | FieldFlags.KeepFirst | FieldFlags.KeepSmallest | FieldFlags.KeepLargest))
         {
            case 0:
            case FieldFlags.OverWrite:
               goto WRITE_TOKEN;

            case FieldFlags.KeepFirst:
               Object obj = accumulator[fld];
               if (obj != null) goto EXIT_RTN;
               goto WRITE_TOKEN;

            case FieldFlags.KeepSmallest:
               if (compareToken (accumulator[fld], value, fieldFlags) <= 0) goto EXIT_RTN;
               goto WRITE_TOKEN;

            case FieldFlags.KeepLargest:
               if (compareToken (accumulator[fld], value, fieldFlags) >= 0) goto EXIT_RTN;
               goto WRITE_TOKEN;

            case FieldFlags.Append:
               String existing = accumulator.ReadStr (fld, null);
               if (existing == null) goto WRITE_TOKEN;
               accumulator.WriteToken(fld, existing + sep + value);
               goto EXIT_RTN;

            default:
               JToken token = accumulator.SelectToken(fld, false);
               JArray arr = token as JArray;
               if (arr != null)
               {
                  if (0 != (fieldFlags & FieldFlags.Unique))
                      addUnique(arr, value, fieldFlags); 
                  else
                     arr.Add(value); 
                  goto EXIT_RTN;
               }
               arr = accumulator.AddArray (fld);
               if (token != null) arr.Add(token);
               arr.Add(value);
               return;
         }

         WRITE_TOKEN:
         accumulator.WriteToken(fld, value);
         EXIT_RTN:;
      }
コード例 #37
0
 protected static StringComparison toComparison(FieldFlags flags)
 {
    return (flags & FieldFlags.KeepSmallestCaseSensitive) != 0 ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase;
 }
コード例 #38
0
ファイル: Nodes.cs プロジェクト: modulexcite/SHFB-1
 public Field(TypeNode declaringType, AttributeList attributes, FieldFlags flags, Identifier name,
   TypeNode type, Literal defaultValue)
     : base(declaringType, attributes, name, NodeType.Field)
 {
     this.defaultValue = defaultValue;
     this.flags = flags;
     this.type = type;
 }
コード例 #39
0
        public static (string, int) TypeToT(int type, FieldFlags flag)
        {
            switch (type)
            {
            case 0:
                switch (flag)
                {
                case 0 | 0 | 0 | 0:
                case 0 | 0 | 0 | FieldFlags.f_maybe_fk:
                case 0 | 0 | FieldFlags.f_maybe_compressed | 0:
                case 0 | 0 | FieldFlags.f_maybe_compressed | FieldFlags.f_maybe_fk:
                    return("int", 32);

                case 0 | FieldFlags.f_unsigned | 0 | 0:
                case 0 | FieldFlags.f_unsigned | 0 | FieldFlags.f_maybe_fk:
                case 0 | FieldFlags.f_unsigned | FieldFlags.f_maybe_compressed | 0:
                case 0 | FieldFlags.f_unsigned | FieldFlags.f_maybe_compressed | FieldFlags.f_maybe_fk:
                    return("uint", 32);

                default:
                    throw new Exception("Unknown flag combination!");
                }

            case 1:
                switch (flag)
                {
                case 0 | 0 | 0 | 0:
                    return("int", 64);

                case 0 | FieldFlags.f_unsigned | 0 | 0:
                case 0 | FieldFlags.f_unsigned | 0 | FieldFlags.f_maybe_fk:
                    return("uint", 64);

                default:
                    throw new Exception("Unknown flag combination!");
                }

            case 2:
                switch (flag)
                {
                case 0 | 0 | 0 | 0:
                    return("string", 0);

                case FieldFlags.f_localized | 0 | 0 | 0:
                    return("locstring", 0);

                default:
                    throw new Exception("Unknown flag combination!");
                }

            case 3:
                switch (flag)
                {
                case 0 | 0 | 0 | 0:
                case 0 | 0 | FieldFlags.f_maybe_compressed | 0:
                    return("float", 0);

                default:
                    throw new Exception("Unknown flag combination!");
                }

            case 4:
                switch (flag)
                {
                case 0 | 0 | 0 | 0:
                case 0 | 0 | FieldFlags.f_maybe_compressed | 0:
                    return("int", 8);

                case 0 | FieldFlags.f_unsigned | 0 | 0:
                case 0 | FieldFlags.f_unsigned | FieldFlags.f_maybe_compressed | 0:
                    return("uint", 8);

                default:
                    throw new Exception("Unknown flag combination!");
                }

            case 5:
                switch (flag)
                {
                case 0 | 0 | 0 | 0:
                case 0 | 0 | 0 | FieldFlags.f_maybe_fk:
                case 0 | 0 | FieldFlags.f_maybe_compressed | 0:
                case 0 | 0 | FieldFlags.f_maybe_compressed | FieldFlags.f_maybe_fk:
                    return("int", 16);

                case 0 | FieldFlags.f_unsigned | 0 | 0:
                case 0 | FieldFlags.f_unsigned | 0 | FieldFlags.f_maybe_fk:
                case 0 | FieldFlags.f_unsigned | FieldFlags.f_maybe_compressed | 0:
                case 0 | FieldFlags.f_unsigned | FieldFlags.f_maybe_compressed | FieldFlags.f_maybe_fk:
                    return("uint", 16);

                default:
                    throw new Exception("Unknown flag combination!");
                }

            default:
                throw new Exception("Ran into unknown field type: " + type);
            }
        }
コード例 #40
0
ファイル: Nodes.cs プロジェクト: modulexcite/SHFB-1
 public ParameterField(TypeNode declaringType, AttributeList attributes, FieldFlags flags, Identifier name,
   TypeNode Type, Literal defaultValue)
     : base(declaringType, attributes, flags, name, Type, defaultValue)
 {
 }