コード例 #1
0
        public CsStructureMember(StructureMember member, CsType type, CsStructure structure)
            : base(member)
        {
            _member = member;
            _type = type;
            _structure = structure;

            _containedInStructure = member.Parent.Implementation as CsStructure;
        }
コード例 #2
0
ファイル: CsLanguage.cs プロジェクト: gregorypilar/interlace
        public override object CreateStructureMemberImplementationHelper(StructureMember member)
        {
            if (member.FieldTypeReference is IntrinsicTypeReference)
            {
                IntrinsicTypeReference reference = member.FieldTypeReference as IntrinsicTypeReference;

                return new CsStructureMember(member, _intrinsics[reference.Type], null);
            }
            else
            {
                DeclarationTypeReference reference = member.FieldTypeReference as DeclarationTypeReference;

                NamespaceName name = reference.Declaration.QualifiedName;
                string codecName = reference.Declaration.Identifier;
                bool isReferenceType = !(reference.Declaration is Enumeration);

                if (reference.Declaration.Implementation is CsStructure)
                {
                    CsStructure structure = (CsStructure)reference.Declaration.Implementation;

                    name = structure.ReferenceTypeName;
                    codecName = structure.Identifier;
                    isReferenceType = structure.IsReferenceType;
                }

                bool isInProtocolNamespace =
                    name.ContainingName.Equals(member.Parent.Parent.Name);

                CsType type;

                if (isInProtocolNamespace)
                {
                    type = new CsType(name.UnqualifiedName, isReferenceType);
                }
                else
                {
                    type = new CsType(name.ToString(), isReferenceType);
                }

                return new CsStructureMember(member, type, reference.Declaration.Implementation as CsStructure);
            }
        }
コード例 #3
0
 public CppStructureMember(StructureMember member, CppType type)
     : base(member)
 {
     _type = type;
 }
コード例 #4
0
ファイル: Language.cs プロジェクト: gregorypilar/interlace
 public virtual object CreateStructureMemberImplementationHelper(StructureMember member)
 {
     return null;
 }
コード例 #5
0
ファイル: CppLanguage.cs プロジェクト: gregorypilar/interlace
        public override object CreateStructureMemberImplementationHelper(StructureMember member)
        {
            if (member.FieldTypeReference is IntrinsicTypeReference)
            {
                IntrinsicTypeReference reference = member.FieldTypeReference as IntrinsicTypeReference;

                return new CppStructureMember(member, _intrinsics[new Pair<IntrinsicType, FieldModifier>(reference.Type, member.Modifier)]);
            }
            else
            {
                DeclarationTypeReference reference = member.FieldTypeReference as DeclarationTypeReference;

                bool isInProtocolNamespace =
                    reference.Declaration.QualifiedName.ContainingName.Equals(member.Parent.Parent.Name);

                CppType type;

                string referenceClassName = IdentifierToClassName(reference.Declaration.Identifier);

                if (reference.Declaration is Enumeration)
                {
                    string typeName = string.Format("{0}::Enumeration", referenceClassName);

                    if (member.Modifier == FieldModifier.Optional) typeName = string.Format("CNullable<{0}>", typeName);

                    if (isInProtocolNamespace)
                    {
                        type = new CppType(typeName, typeName);
                    }
                    else
                    {
                        type = new CppType(typeName, typeName);
                    }
                }
                else if (reference.Declaration.Implementation is CppStructure)
                {
                    CppStructure structure = (CppStructure)reference.Declaration.Implementation;

                    if (!structure.IsSurrogate)
                    {
                        type = new CppType(
                            string.Format("boost::shared_ptr<{0}>", referenceClassName),
                            string.Format("const boost::shared_ptr<{0}>", referenceClassName),
                            null, referenceClassName, structure);
                    }
                    else
                    {
                        type = new CppType(
                            member.Modifier == FieldModifier.Required ? structure.SurrogateValueType : structure.SurrogateNullableValueType,
                            member.Modifier == FieldModifier.Required ? structure.SurrogateReferenceType : structure.SurrogateNullableReferenceType,
                            null, referenceClassName, structure);
                    }
                }
                else
                {
                    throw new InvalidOperationException();
                }

                return new CppStructureMember(member, type);
            }
        }
コード例 #6
0
        public override object CreateStructureMemberImplementationHelper(StructureMember member)
        {
            if (member.FieldTypeReference is IntrinsicTypeReference)
            {
                IntrinsicTypeReference reference = member.FieldTypeReference as IntrinsicTypeReference;

                return new PythonStructureMember(member, _intrinsics[reference.Type], null);
            }
            else
            {
                DeclarationTypeReference reference = member.FieldTypeReference as DeclarationTypeReference;

                return new PythonStructureMember(member, new PythonType("object", "None"), reference.Declaration.Implementation as PythonStructure);
            }
        }