public override AmlElement ToAml() { return(new Attribute { Name = "fixedLength", AttributeDataType = "xs:integer", Value = new Value { Content = FixedLength.ToString() } }); }
/// <summary> /// Remove all facets except Nullable (i.e. the setting of Nullable remains as is). /// </summary> internal void RemoveAllFacetsExceptNullable() { if (null != DefaultValue) { DefaultValue.Delete(); _defaultAttr = null; } if (null != MaxLength) { MaxLength.Delete(); _maxLengthAttr = null; } if (null != FixedLength) { FixedLength.Delete(); _fixedLengthAttr = null; } if (null != Precision) { Precision.Delete(); _precisionAttr = null; } if (null != Scale) { Scale.Delete(); _scaleAttr = null; } if (null != Unicode) { Unicode.Delete(); _unicodeAttr = null; } if (null != Collation) { Collation.Delete(); _collationAttr = null; } }
public Numeric(FixedLength l) : this(ABS_LENGTH, (double)l.MValue(), 0.0, 0.0, 1, null) { }
/// <summary> /// LUA结构支持 /// </summary> /// <returns></returns> public override void GetLuaStruct(StringBuilder code) { base.GetLuaStruct(code); int idx; if (!string.IsNullOrWhiteSpace(PropertyName)) { code.AppendLine($@"['PropertyName'] = '{PropertyName.ToLuaString()}',"); } else { code.AppendLine($@"['PropertyName'] = nil,"); } code.AppendLine($@"['IsCaption'] ={(IsCaption.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Alias)) { code.AppendLine($@"['Alias'] = '{Alias.ToLuaString()}',"); } else { code.AppendLine($@"['Alias'] = nil,"); } if (!string.IsNullOrWhiteSpace(Group)) { code.AppendLine($@"['Group'] = '{Group.ToLuaString()}',"); } else { code.AppendLine($@"['Group'] = nil,"); } code.AppendLine($@"['CreateIndex'] ={(CreateIndex.ToString().ToLower())},"); code.AppendLine($@"['IsPrimaryKey'] ={(IsPrimaryKey.ToString().ToLower())},"); code.AppendLine($@"['IsExtendKey'] ={(IsExtendKey.ToString().ToLower())},"); code.AppendLine($@"['IsIdentity'] ={(IsIdentity.ToString().ToLower())},"); code.AppendLine($@"['IsGlobalKey'] ={(IsGlobalKey.ToString().ToLower())},"); code.AppendLine($@"['UniqueIndex'] ={UniqueIndex},"); code.AppendLine($@"['IsRequired'] ={(IsRequired.ToString().ToLower())},"); code.AppendLine($@"['IsUserReadOnly'] ={(IsUserReadOnly.ToString().ToLower())},"); code.AppendLine($@"['IsMemo'] ={(IsMemo.ToString().ToLower())},"); code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Prefix)) { code.AppendLine($@"['Prefix'] = '{Prefix.ToLuaString()}',"); } else { code.AppendLine($@"['Prefix'] = nil,"); } if (!string.IsNullOrWhiteSpace(Suffix)) { code.AppendLine($@"['Suffix'] = '{Suffix.ToLuaString()}',"); } else { code.AppendLine($@"['Suffix'] = nil,"); } if (!string.IsNullOrWhiteSpace(InputType)) { code.AppendLine($@"['InputType'] = '{InputType.ToLuaString()}',"); } else { code.AppendLine($@"['InputType'] = nil,"); } if (!string.IsNullOrWhiteSpace(ComboBoxUrl)) { code.AppendLine($@"['ComboBoxUrl'] = '{ComboBoxUrl.ToLuaString()}',"); } else { code.AppendLine($@"['ComboBoxUrl'] = nil,"); } code.AppendLine($@"['IsMoney'] ={(IsMoney.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(GridAlign)) { code.AppendLine($@"['GridAlign'] = '{GridAlign.ToLuaString()}',"); } else { code.AppendLine($@"['GridAlign'] = nil,"); } if (!string.IsNullOrWhiteSpace(DataFormater)) { code.AppendLine($@"['DataFormater'] = '{DataFormater.ToLuaString()}',"); } else { code.AppendLine($@"['DataFormater'] = nil,"); } code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},"); code.AppendLine($@"['GridDetails'] ={(GridDetails.ToString().ToLower())},"); code.AppendLine($@"['NoneGrid'] ={(NoneGrid.ToString().ToLower())},"); code.AppendLine($@"['NoneDetails'] ={(NoneDetails.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(GridDetailsCode)) { code.AppendLine($@"['GridDetailsCode'] = '{GridDetailsCode.ToLuaString()}',"); } else { code.AppendLine($@"['GridDetailsCode'] = nil,"); } if (!string.IsNullOrWhiteSpace(CppType)) { code.AppendLine($@"['CppType'] = '{CppType.ToLuaString()}',"); } else { code.AppendLine($@"['CppType'] = nil,"); } if (CppTypeObject != null) { code.AppendLine($@"['CppTypeObject'] ='{CppTypeObject}',"); } if (!string.IsNullOrWhiteSpace(CppName)) { code.AppendLine($@"['CppName'] = '{CppName.ToLuaString()}',"); } else { code.AppendLine($@"['CppName'] = nil,"); } if (!string.IsNullOrWhiteSpace(CppLastType)) { code.AppendLine($@"['CppLastType'] = '{CppLastType.ToLuaString()}',"); } else { code.AppendLine($@"['CppLastType'] = nil,"); } code.AppendLine($@"['IsIntDecimal'] ={(IsIntDecimal.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(CsType)) { code.AppendLine($@"['CsType'] = '{CsType.ToLuaString()}',"); } else { code.AppendLine($@"['CsType'] = nil,"); } if (!string.IsNullOrWhiteSpace(CustomType)) { code.AppendLine($@"['CustomType'] = '{CustomType.ToLuaString()}',"); } else { code.AppendLine($@"['CustomType'] = nil,"); } if (!string.IsNullOrWhiteSpace(LastCsType)) { code.AppendLine($@"['LastCsType'] = '{LastCsType.ToLuaString()}',"); } else { code.AppendLine($@"['LastCsType'] = nil,"); } if (EnumConfig != null) { code.AppendLine($@"['EnumConfig'] = {EnumConfig.GetLuaStruct()},"); } code.AppendLine($@"['IsCompute'] ={(IsCompute.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ComputeGetCode)) { code.AppendLine($@"['ComputeGetCode'] = '{ComputeGetCode.ToLuaString()}',"); } else { code.AppendLine($@"['ComputeGetCode'] = nil,"); } if (!string.IsNullOrWhiteSpace(ComputeSetCode)) { code.AppendLine($@"['ComputeSetCode'] = '{ComputeSetCode.ToLuaString()}',"); } else { code.AppendLine($@"['ComputeSetCode'] = nil,"); } code.AppendLine($@"['IsMiddleField'] ={(IsMiddleField.ToString().ToLower())},"); code.AppendLine($@"['InnerField'] ={(InnerField.ToString().ToLower())},"); code.AppendLine($@"['IsSystemField'] ={(IsSystemField.ToString().ToLower())},"); code.AppendLine($@"['IsInterfaceField'] ={(IsInterfaceField.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Initialization)) { code.AppendLine($@"['Initialization'] = '{Initialization.ToLuaString()}',"); } else { code.AppendLine($@"['Initialization'] = nil,"); } if (!string.IsNullOrWhiteSpace(EmptyValue)) { code.AppendLine($@"['EmptyValue'] = '{EmptyValue.ToLuaString()}',"); } else { code.AppendLine($@"['EmptyValue'] = nil,"); } code.AppendLine($@"['DenyScope'] ='{DenyScope}',"); code.AppendLine($@"['Nullable'] ={(Nullable.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Max)) { code.AppendLine($@"['Max'] = '{Max.ToLuaString()}',"); } else { code.AppendLine($@"['Max'] = nil,"); } if (!string.IsNullOrWhiteSpace(Min)) { code.AppendLine($@"['Min'] = '{Min.ToLuaString()}',"); } else { code.AppendLine($@"['Min'] = nil,"); } code.AppendLine($@"['UniqueString'] ={(UniqueString.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ColumnName)) { code.AppendLine($@"['ColumnName'] = '{ColumnName.ToLuaString()}',"); } else { code.AppendLine($@"['ColumnName'] = nil,"); } code.AppendLine($@"['DbNullable'] ={(DbNullable.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(DbType)) { code.AppendLine($@"['DbType'] = '{DbType.ToLuaString()}',"); } else { code.AppendLine($@"['DbType'] = nil,"); } code.AppendLine($@"['Precision'] ={Datalen},"); if (!string.IsNullOrWhiteSpace(ArrayLen)) { code.AppendLine($@"['ArrayLen'] = '{ArrayLen.ToLuaString()}',"); } else { code.AppendLine($@"['ArrayLen'] = nil,"); } code.AppendLine($@"['Scale'] ={Scale},"); code.AppendLine($@"['DbIndex'] ={DbIndex},"); code.AppendLine($@"['Unicode'] ={(Unicode.ToString().ToLower())},"); code.AppendLine($@"['FixedLength'] ={(FixedLength.ToString().ToLower())},"); code.AppendLine($@"['IsBlob'] ={(IsBlob.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(StorageProperty)) { code.AppendLine($@"['StorageProperty'] = '{StorageProperty.ToLuaString()}',"); } else { code.AppendLine($@"['StorageProperty'] = nil,"); } code.AppendLine($@"['DbInnerField'] ={(DbInnerField.ToString().ToLower())},"); code.AppendLine($@"['NoStorage'] ={(NoStorage.ToString().ToLower())},"); code.AppendLine($@"['KeepStorageScreen'] ='{KeepStorageScreen}',"); code.AppendLine($@"['CustomWrite'] ={(CustomWrite.ToString().ToLower())},"); code.AppendLine($@"['IsLinkField'] ={(IsLinkField.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(LinkTable)) { code.AppendLine($@"['LinkTable'] = '{LinkTable.ToLuaString()}',"); } else { code.AppendLine($@"['LinkTable'] = nil,"); } code.AppendLine($@"['IsLinkKey'] ={(IsLinkKey.ToString().ToLower())},"); code.AppendLine($@"['IsLinkCaption'] ={(IsLinkCaption.ToString().ToLower())},"); code.AppendLine($@"['IsUserId'] ={(IsUserId.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(LinkField)) { code.AppendLine($@"['LinkField'] = '{LinkField.ToLuaString()}',"); } else { code.AppendLine($@"['LinkField'] = nil,"); } code.AppendLine($@"['IsCustomCompute'] ={(IsCustomCompute.ToString().ToLower())},"); code.AppendLine($@"['CanGet'] ={(CanGet.ToString().ToLower())},"); code.AppendLine($@"['CanSet'] ={(CanSet.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(AccessType)) { code.AppendLine($@"['AccessType'] = '{AccessType.ToLuaString()}',"); } else { code.AppendLine($@"['AccessType'] = nil,"); } code.AppendLine($@"['ReadOnly'] ={(ReadOnly.ToString().ToLower())},"); code.AppendLine($@"['CanInput'] ={(CanUserInput.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ExtendRole)) { code.AppendLine($@"['ExtendRole'] = '{ExtendRole.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendRole'] = nil,"); } if (!string.IsNullOrWhiteSpace(ValueSeparate)) { code.AppendLine($@"['ValueSeparate'] = '{ValueSeparate.ToLuaString()}',"); } else { code.AppendLine($@"['ValueSeparate'] = nil,"); } if (!string.IsNullOrWhiteSpace(ArraySeparate)) { code.AppendLine($@"['ArraySeparate'] = '{ArraySeparate.ToLuaString()}',"); } else { code.AppendLine($@"['ArraySeparate'] = nil,"); } code.AppendLine($@"['ExtendArray'] ={(ExtendArray.ToString().ToLower())},"); code.AppendLine($@"['IsKeyValueArray'] ={(IsKeyValueArray.ToString().ToLower())},"); code.AppendLine($@"['IsRelation'] ={(IsRelation.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ExtendPropertyName)) { code.AppendLine($@"['ExtendPropertyName'] = '{ExtendPropertyName.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendPropertyName'] = nil,"); } if (!string.IsNullOrWhiteSpace(ExtendClassName)) { code.AppendLine($@"['ExtendClassName'] = '{ExtendClassName.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendClassName'] = nil,"); } code.AppendLine($@"['ExtendClassIsPredestinate'] ={(ExtendClassIsPredestinate.ToString().ToLower())},"); code.AppendLine($@"['IsRelationField'] ={(IsRelationField.ToString().ToLower())},"); code.AppendLine($@"['IsRelationValue'] ={(IsRelationValue.ToString().ToLower())},"); code.AppendLine($@"['IsRelationArray'] ={(IsRelationArray.ToString().ToLower())},"); code.AppendLine($@"['IsExtendArray'] ={(IsExtendArray.ToString().ToLower())},"); code.AppendLine($@"['IsExtendValue'] ={(IsExtendValue.ToString().ToLower())},"); }
private Property parsePrimaryExpr() { Property prop; switch (currentToken) { case TOK_LPAR: next(); prop = parseAdditiveExpr(); expectRpar(); return(prop); case TOK_LITERAL: prop = new StringProperty(currentTokenValue); break; case TOK_NCNAME: prop = new NCnameProperty(currentTokenValue); break; case TOK_FLOAT: prop = new NumberProperty(ParseDouble(currentTokenValue)); break; case TOK_INTEGER: prop = new NumberProperty(Int32.Parse(currentTokenValue)); break; case TOK_PERCENT: double pcval = ParseDouble( currentTokenValue.Substring(0, currentTokenValue.Length - 1)) / 100.0; IPercentBase pcBase = this.propInfo.GetPercentBase(); if (pcBase != null) { if (pcBase.GetDimension() == 0) { prop = new NumberProperty(pcval * pcBase.GetBaseValue()); } else if (pcBase.GetDimension() == 1) { prop = new LengthProperty(new PercentLength(pcval, pcBase)); } else { throw new PropertyException("Illegal percent dimension value"); } } else { prop = new NumberProperty(pcval); } break; case TOK_NUMERIC: int numLen = currentTokenValue.Length - currentUnitLength; string unitPart = currentTokenValue.Substring(numLen); double numPart = ParseDouble(currentTokenValue.Substring(0, numLen)); Length length = null; if (unitPart.Equals(RELUNIT)) { length = new FixedLength(numPart, propInfo.currentFontSize()); } else { length = new FixedLength(numPart, unitPart); } if (length == null) { throw new PropertyException("unrecognized unit name: " + currentTokenValue); } else { prop = new LengthProperty(length); } break; case TOK_COLORSPEC: prop = new ColorTypeProperty(new ColorType(currentTokenValue)); break; case TOK_FUNCTION_LPAR: { IFunction function = (IFunction)functionTable[currentTokenValue]; if (function == null) { throw new PropertyException("no such function: " + currentTokenValue); } next(); propInfo.pushFunction(function); prop = function.Eval(parseArgs(function.NumArgs), propInfo); propInfo.popFunction(); return(prop); } default: throw new PropertyException("syntax error"); } next(); return(prop); }