Exemplo n.º 1
0
        public ProtoSpecSubset GetFullSpec(ProtoSpecAction action)
        {
            ProtoSpecSubset resultSpec = new ProtoSpecSubset(action);

            if (ClassBaseName != null)
            {
                ProtoSpecClassDef classBaseDef = null;

                if (ClassBaseModule != null)
                {
                    classBaseDef = ParentModule.ParentDocument.GetClassDef(ClassBaseModule, ClassBaseName, true);
                }
                else
                {
                    classBaseDef = ParentModule.ParentDocument.GetClassDef(ParentModule.Name, ClassBaseName, true);
                }

                if (classBaseDef == null)
                {
                    if (ClassBaseModule != null)
                    {
                        throw new Exception("无法找到类型'" + ParentModule.Name + "." + ClassName + "'的基类'" + ClassBaseModule + "." + ClassBaseName + "'");
                    }
                    else
                    {
                        throw new Exception("无法找到类型'" + ParentModule.Name + "." + ClassName + "'的基类'" + ClassBaseName + "'");
                    }
                }

                ProtoSpecSubset classBaseSpec = classBaseDef.GetFullSpec(action);


                foreach (ProtoSpecColumn column in classBaseSpec.Columns)
                {
                    resultSpec.Columns.Add(column.Colon(action));
                }
            }

            foreach (ProtoSpecColumn column in ClassBody.Columns)
            {
                resultSpec.Columns.Add(column.Colon(action));
            }

            return(resultSpec);
        }
Exemplo n.º 2
0
        public ProtoSpecColumn Colon(ProtoSpecAction parentAction)
        {
            ProtoSpecColumn result = new ProtoSpecColumn(Name, this.ColumnType);

            result.Values       = this.Values;
            result.ClassModule  = this.ClassModule;
            result.ClassName    = this.ClassName;
            result.ParentAction = parentAction;

            ProtoSpecSubset format = null;

            if (ClassName != null)
            {
                ProtoSpecClassDef classDef = GetClassDef(parentAction, ClassModule, ClassName);

                format = classDef.GetFullSpec(parentAction);
            }
            else
            {
                format = this.Format;
            }

            if (format != null)
            {
                ProtoSpecSubset newformat = new ProtoSpecSubset(parentAction);

                foreach (ProtoSpecColumn column in format.Columns)
                {
                    newformat.Columns.Add(column.Colon(parentAction));
                }

                result.Format = newformat;
            }

            return(result);
        }