Esempio n. 1
0
        public void AddElement(string propertyName, CppType propType, MSXML2.ISchemaElement elem)
        {
            // serialization
            getValItf();
            if (propType.Array == CppType.ArrayType.Literal)
            {
            }
            else
            {
                m_impl.WriteLine("\t{0} {1};", propType.LocalStorageName, propertyName);
                m_impl.WriteLine("\t_HR(obj->get_{0}(&{0}));", propertyName);
                m_impl.WriteLine("\t_HR(dest->SerializeValue(&CComVariant({0}), CComBSTR(OLESTR(\"{1}\")), CComBSTR(OLESTR(\"{2}\"))));", propertyName, elem.name, elem.namespaceURI);
            }

            // de-serialization
            m_deserE.Add(string.Format("\tif (wcscmp(name, L\"{0}\") == 0 && wcscmp(namespaceURI, L\"{1}\") == 0)", elem.name, elem.namespaceURI));
            m_deserE.Add("\t{");
            m_deserE.Add(string.Format("\t\treturn m_obj->put_{0}(v.{1});", propertyName, propType.VariantFieldName));
            m_deserE.Add("\t}");

            if (propType.Array == CppType.ArrayType.Literal)
            {
            }
            else
            {
            }
        }
Esempio n. 2
0
        public static CppType FromParticle(ProxyWriter pw, MSXML2.ISchemaParticle p)
        {
            MSXML2.ISchemaElement e     = p as MSXML2.ISchemaElement;
            wsdlParser.qname      ptype = new wsdlParser.qnameClass();
            ptype.localname  = e.type.name;
            ptype.@namespace = e.type.namespaceURI;
            CppType itemType  = pw.mapType(ptype);
            int     minOccurs = int.Parse(p.minOccurs.ToString());
            int     maxOccurs = int.Parse(p.maxOccurs.ToString());

            if ((maxOccurs == 1) && (minOccurs == 0))
            {
                itemType.Optional = true;
            }
            else if ((maxOccurs != 1) || (minOccurs != 1))
            {
                itemType.Array = ArrayType.Literal;
            }
            else if (e != null && e.isNillable)
            {
                itemType.Optional = true;
            }

            return(itemType);
        }
Esempio n. 3
0
        void AddElementsToContainer(wsdlParser.qname xmlName, MSXML2.ISchemaModelGroup smg, ComplexTypeWriter ctw, SerializerWriter sw)
        {
            foreach (MSXML2.ISchemaParticle particle in smg.particles)
            {
                if ((particle.itemType == MSXML2.SOMITEMTYPE.SOMITEM_ALL) || (particle.itemType == MSXML2.SOMITEMTYPE.SOMITEM_SEQUENCE))
                {
                    AddElementsToContainer(xmlName, particle as MSXML2.ISchemaModelGroup, ctw, sw);
                }
                else if (particle.itemType == MSXML2.SOMITEMTYPE.SOMITEM_ELEMENT)
                {
                    MSXML2.ISchemaElement e = (MSXML2.ISchemaElement)particle;
                    CppType itemType        = CppType.FromParticle(this, particle);
                    string  itemName        = vcProject.safeClassName(particle.name);

                    ctw.AddPropertyField(itemName, itemType);
                    sw.AddElement(itemName, itemType, e);
                }
            }
        }