Ejemplo n.º 1
0
void FormattingSetting<VerticalFormatting>::writeXMLTagToStream(XMLSerializer& xml_stream) const
{
    if (d_propertySource.empty())
        xml_stream.openTag("VertFormat");
    else
        xml_stream.openTag("VertFormatProperty");
}
Ejemplo n.º 2
0
void Imageset::writeXMLToStream(XMLSerializer& xml_stream) const
{
    // output Imageset tag
    xml_stream.openTag("Imageset")
        .attribute("Name", d_name)
        .attribute("Imagefile", d_textureFilename);

    if (d_nativeHorzRes != DefaultNativeHorzRes)
        xml_stream.attribute("NativeHorzRes", 
          PropertyHelper::uintToString(static_cast<uint>(d_nativeHorzRes)));
    if (d_nativeVertRes != DefaultNativeVertRes)
        xml_stream.attribute("NativeVertRes", 
          PropertyHelper::uintToString(static_cast<uint>(d_nativeVertRes)));

    if (d_autoScale)
        xml_stream.attribute("AutoScaled", "true");

    // output images
    ImageIterator image = getIterator();
    while (!image.isAtEnd())
    {
        image.getCurrentValue().writeXMLToStream(xml_stream);
        ++image;
    }

    // output closing tag
    xml_stream.closeTag();
}
Ejemplo n.º 3
0
//----------------------------------------------------------------------------//
void ComponentArea::writeXMLToStream(XMLSerializer& xml_stream) const
{
    xml_stream.openTag("Area");

    // see if we should write an AreaProperty element
    if (isAreaFetchedFromProperty())
    {
        xml_stream.openTag("AreaProperty")
            .attribute("name", d_namedSource)
            .closeTag();
    }
    else if (isAreaFetchedFromNamedArea())
    {
        xml_stream.openTag("NamedAreaSource")
            .attribute("look", d_namedAreaSourceLook)
            .attribute("name", d_namedSource)
            .closeTag();
    }
    // not a property, write out individual dimensions explicitly.
    else
    {
        d_left.writeXMLToStream(xml_stream);
        d_top.writeXMLToStream(xml_stream);
        d_right_or_width.writeXMLToStream(xml_stream);
        d_bottom_or_height.writeXMLToStream(xml_stream);
    }
    xml_stream.closeTag();
}
Ejemplo n.º 4
0
void FormattingSetting<HorizontalTextFormatting>::writeXMLTagToStream(XMLSerializer& xml_stream) const
{
    if (d_propertySource.empty())
        xml_stream.openTag("HorzFormat");
    else
        xml_stream.openTag("HorzFormatProperty");
}
Ejemplo n.º 5
0
//----------------------------------------------------------------------------//
void WidgetDim::writeXMLElementAttributes_impl(XMLSerializer& xml_stream) const
{
    if (!d_widgetName.empty())
        xml_stream.attribute("widget", d_widgetName);

    xml_stream.attribute("dimension", FalagardXMLHelper<DimensionType>::toString(d_what));
}
Ejemplo n.º 6
0
//----------------------------------------------------------------------------//
bool FalagardComponentBase::writeColoursXML(XMLSerializer& xml_stream) const
{

    if (!d_colourPropertyName.empty())
    {
        xml_stream.openTag("ColourRectProperty");
        xml_stream.attribute("name", d_colourPropertyName)
            .closeTag();
    }
    else if (!d_colours.isMonochromatic() ||
              d_colours.d_top_left != Colour(1,1,1,1))
    {
        xml_stream.openTag("Colours")
            .attribute("topLeft",
                PropertyHelper<Colour>::toString(d_colours.d_top_left))
            .attribute("topRight",
                PropertyHelper<Colour>::toString(d_colours.d_top_right))
            .attribute("bottomLeft",
                PropertyHelper<Colour>::toString(d_colours.d_bottom_left))
            .attribute("bottomRight",
                PropertyHelper<Colour>::toString(d_colours.d_bottom_right))
            .closeTag();
    }
    else
        return false;

    return true;
}
Ejemplo n.º 7
0
void BTPc::writeXML(const char *filename, XMLVector<BTGroup*> &group, XMLVector<BTPc*> &pc)
{
 XMLSerializer parser;
 parser.add("party", &group, &BTGroup::create);
 parser.add("pc", &pc, &BTPc::create);
 parser.write(filename, true);
}
Ejemplo n.º 8
0
 void NamedArea::writeXMLToStream(XMLSerializer& xml_stream) const
 {
     xml_stream.openTag("NamedArea")
         .attribute("name", d_name);
     d_area.writeXMLToStream(xml_stream);
     xml_stream.closeTag();
 }
Ejemplo n.º 9
0
void SequenceExpr::serializeXML(XMLSerializer &serializer) {
  XMLSerializer::attributes_t attrs;

  addCommonAttributes(attrs);
  serializer.startElement("sequence", attrs);
  serializeChildren(serializer);
  serializer.endElement();
}
Ejemplo n.º 10
0
void ForeachStmt::serializeXML(XMLSerializer &serializer) {
  XMLSerializer::attributes_t attrs;

  addCommonAttributes(attrs);
  serializer.startElement("foreach", attrs);
  serializeChildren(serializer);
  serializer.endElement();
}
Ejemplo n.º 11
0
void ReturnStmt::serializeXML(XMLSerializer &serializer) {
  XMLSerializer::attributes_t attrs;

  addCommonAttributes(attrs);
  serializer.startElement("return", attrs);
  serializeChildren(serializer);
  serializer.endElement();
}
Ejemplo n.º 12
0
//----------------------------------------------------------------------------//
void PropertyDim::writeXMLElementAttributes_impl(XMLSerializer& xml_stream) const
{
    if (!d_childName.empty())
        xml_stream.attribute("widget", d_childName);
    xml_stream.attribute("name", d_property);
    if (d_type != DT_INVALID)
        xml_stream.attribute("type", FalagardXMLHelper<DimensionType>::toString(d_type));
}
Ejemplo n.º 13
0
void FilterExpr::serializeXML(XMLSerializer &serializer) {
  XMLSerializer::attributes_t attrs;

  addCommonAttributes(attrs);
  serializer.startElement("filter", attrs);
  serializeChildren(serializer);
  serializer.endElement();
}
Ejemplo n.º 14
0
void IntPredicate::serializeXML(XMLSerializer &serializer) {
  XMLSerializer::attributes_t attrs;

  addCommonAttributes(attrs);
  serializer.startElement("int-predicate", attrs);
  serializeChildren(serializer);
  serializer.endElement();
}
Ejemplo n.º 15
0
void FormattingSetting<VerticalTextFormatting>::writeXMLAttributesToStream(XMLSerializer& xml_stream) const
{
    if (d_propertySource.empty())
        xml_stream.attribute("type",
            FalagardXMLHelper<VerticalTextFormatting>::toString(d_value));
    else
        xml_stream.attribute("name", d_propertySource);
}
Ejemplo n.º 16
0
    void TextComponent::writeXMLToStream(XMLSerializer& xml_stream) const
    {
        // opening tag
        xml_stream.openTag("TextComponent");
        // write out area
        d_area.writeXMLToStream(xml_stream);

        // write text element
        if (!d_font.empty() && !d_text.empty())
        {
            xml_stream.openTag("Text");
            if (!d_font.empty())
                xml_stream.attribute("font", d_font);
            if (!d_text.empty())
                xml_stream.attribute("string", d_text);
            xml_stream.closeTag();
        }

        // write text property element
        if (!d_textPropertyName.empty())
        {
            xml_stream.openTag("TextProperty")
                .attribute("name", d_textPropertyName)
                .closeTag();
        }

        // write font property element
        if (!d_fontPropertyName.empty())
        {
            xml_stream.openTag("FontProperty")
                .attribute("name", d_fontPropertyName)
                .closeTag();
        }

        // get base class to write colours
        writeColoursXML(xml_stream);

        // write vert format, allowing base class to do this for us if a propety is in use
        if (!writeVertFormatXML(xml_stream))
        {
            // was not a property, so write out explicit formatting in use
            xml_stream.openTag("VertFormat")
                .attribute("type", FalagardXMLHelper::vertTextFormatToString(d_vertFormatting))
                .closeTag();
        }

        // write horz format, allowing base class to do this for us if a propety is in use
        if (!writeHorzFormatXML(xml_stream))
        {
            // was not a property, so write out explicit formatting in use
            xml_stream.openTag("HorzFormat")
                .attribute("type", FalagardXMLHelper::horzTextFormatToString(d_horzFormatting))
                .closeTag();
        }

        // closing tag
        xml_stream.closeTag();
    }
Ejemplo n.º 17
0
void BinaryExpr::serializeXML(XMLSerializer &serializer) {
  XMLSerializer::attributes_t attrs;

  attrs["op"] = getOp();
  addCommonAttributes(attrs);
  serializer.startElement("binexpr", attrs);
  serializeChildren(serializer);
  serializer.endElement();
}
Ejemplo n.º 18
0
void BTPc::readXML(const char *filename, XMLVector<BTGroup*> &group, XMLVector<BTPc*> &pc)
{
 XMLSerializer parser;
 parser.add("party", &group, &BTGroup::create);
 parser.add("pc", &pc, &BTPc::create);
 parser.parse(filename, true);
 for (int i = 0; i < pc.size(); ++i)
  pc[i]->updateSkills();
}
Ejemplo n.º 19
0
//----------------------------------------------------------------------------//
void Dimension::writeXMLToStream(XMLSerializer& xml_stream) const
{
    xml_stream.openTag("Dim")
        .attribute("type", FalagardXMLHelper<DimensionType>::toString(d_type));

    if (d_value)
        d_value->writeXMLToStream(xml_stream);
    xml_stream.closeTag();
}
Ejemplo n.º 20
0
void TypeTest::serializeXML(XMLSerializer &serializer) {
  XMLSerializer::attributes_t attrs;

  attrs["type"] = Type::get(getTypeTest()).getName();

  addCommonAttributes(attrs);
  serializer.startElement("typetest", attrs);
  serializeChildren(serializer);
  serializer.endElement();
}
Ejemplo n.º 21
0
	bool Rect::Deserialize(const char* filePath)
	{
		XMLSerializer* serializer = XMLSerializer::Load(filePath);
		if (serializer == nullptr)
			return false;

		this->Deserialize(serializer);

		return serializer->Close();
	}
Ejemplo n.º 22
0
//----------------------------------------------------------------------------//
void UnifiedDim::writeXMLElementAttributes_impl(XMLSerializer& xml_stream) const
{
    if (d_value.d_scale != 0)
        xml_stream.attribute("scale", PropertyHelper<float>::toString(d_value.d_scale));

    if (d_value.d_offset != 0)
        xml_stream.attribute("offset", PropertyHelper<float>::toString(d_value.d_offset));

    xml_stream.attribute("type", FalagardXMLHelper<DimensionType>::toString(d_what));
}
Ejemplo n.º 23
0
//----------------------------------------------------------------------------//
void FrameComponent::writeXMLToStream(XMLSerializer& xml_stream) const
{
    // opening tag
    xml_stream.openTag("FrameComponent");
    // write out area
    d_area.writeXMLToStream(xml_stream);

    // write images
    for (int i = 0; i < FIC_FRAME_IMAGE_COUNT; ++i)
    {
        if (d_frameImages[i].d_specified)
        {
            if (d_frameImages[i].d_propertyName.empty())
                xml_stream.openTag("Image")
                    .attribute("name", d_frameImages[i].d_image->getName())
                    .attribute("component", FalagardXMLHelper<FrameImageComponent>::toString(static_cast<FrameImageComponent>(i)))
                    .closeTag();
            else
                xml_stream.openTag("ImageProperty")
                    .attribute("name", d_frameImages[i].d_propertyName)
                    .attribute("component", FalagardXMLHelper<FrameImageComponent>::toString(static_cast<FrameImageComponent>(i)))
                    .closeTag();
        }
    }

    // get base class to write colours
    writeColoursXML(xml_stream);

    d_backgroundVertFormatting.writeXMLTagToStream(xml_stream);
    d_backgroundVertFormatting.writeXMLAttributesToStream(xml_stream);
    xml_stream.attribute("component", "Background").closeTag();

    d_leftEdgeFormatting.writeXMLTagToStream(xml_stream);
    d_leftEdgeFormatting.writeXMLAttributesToStream(xml_stream);
    xml_stream.attribute("component", "LeftEdge").closeTag();

    d_rightEdgeFormatting.writeXMLTagToStream(xml_stream);
    d_rightEdgeFormatting.writeXMLAttributesToStream(xml_stream);
    xml_stream.attribute("component", "RightEdge").closeTag();

    d_backgroundHorzFormatting.writeXMLTagToStream(xml_stream);
    d_backgroundHorzFormatting.writeXMLAttributesToStream(xml_stream);
    xml_stream.attribute("component", "Background").closeTag();

    d_topEdgeFormatting.writeXMLTagToStream(xml_stream);
    d_topEdgeFormatting.writeXMLAttributesToStream(xml_stream);
    xml_stream.attribute("component", "TopEdge").closeTag();

    d_bottomEdgeFormatting.writeXMLTagToStream(xml_stream);
    d_bottomEdgeFormatting.writeXMLAttributesToStream(xml_stream);
    xml_stream.attribute("component", "BottomEdge").closeTag();

    // closing tag
    xml_stream.closeTag();
}
Ejemplo n.º 24
0
void ImportDecl::serializeXML(XMLSerializer &serializer) {
  XMLSerializer::attributes_t attrs;

  attrs["name"] = name.getFullRealName();
  if (name.hasPseudonym()) attrs["as"] = name.getFullName();

  addCommonAttributes(attrs);
  serializer.startElement("import", attrs);
  serializeChildren(serializer);
  serializer.endElement();
}
Ejemplo n.º 25
0
	bool Rect::Serialize(const char* filePath)
	{
		XMLSerializer* serializer = new XMLSerializer(filePath);

		if (false == Serialize(serializer))
			return serializer->Close();

		serializer->Save();

		return serializer->Close();
	}
Ejemplo n.º 26
0
void Argument::serializeXML(XMLSerializer &serializer) {
  XMLSerializer::attributes_t attrs;

  attrs["name"] = arg.name.getName();
  attrs["type"] = Type::get(arg.type).getName();

  addCommonAttributes(attrs);
  serializer.startElement("arg", attrs);
  serializeChildren(serializer);
  serializer.endElement();
}
Ejemplo n.º 27
0
    void WidgetLookFeel::writeXMLToStream(XMLSerializer& xml_stream) const
    {

        xml_stream.openTag("WidgetLook")
                .attribute("name", d_lookName);

        // These sub-scobes of the loops avoid the "'curr'-already-initialized" compile error on VC6++
        {
          // output property definitions
          for (PropertyDefinitionList::const_iterator curr = d_propertyDefinitions.begin(); curr != d_propertyDefinitions.end(); ++curr)
              (*curr).writeXMLToStream(xml_stream);
        }

        {
          // output property link definitions
          for (PropertyLinkDefinitionList::const_iterator curr = d_propertyLinkDefinitions.begin(); curr != d_propertyLinkDefinitions.end(); ++curr)
              (*curr).writeXMLToStream(xml_stream);
        }

        {
          // output property initialisers.
          for (PropertyList::const_iterator curr = d_properties.begin(); curr != d_properties.end(); ++curr)
              (*curr).writeXMLToStream(xml_stream);
        }

        {
          // output named areas
          for (NamedAreaList::const_iterator curr = d_namedAreas.begin(); curr != d_namedAreas.end(); ++curr)
              (*curr).second.writeXMLToStream(xml_stream);
        }

        {
          // output child widgets
          for (WidgetList::const_iterator curr = d_childWidgets.begin(); curr != d_childWidgets.end(); ++curr)
              (*curr).writeXMLToStream(xml_stream);
        }

        {
          // output imagery sections
          for (ImageryList::const_iterator curr = d_imagerySections.begin(); curr != d_imagerySections.end(); ++curr)
              (*curr).second.writeXMLToStream(xml_stream);
        }

        {
          // output states
          for (StateList::const_iterator curr = d_stateImagery.begin(); curr != d_stateImagery.end(); ++curr)
              (*curr).second.writeXMLToStream(xml_stream);
        }

        xml_stream.closeTag();
    }
Ejemplo n.º 28
0
    void StateImagery::writeXMLToStream(XMLSerializer& xml_stream) const
    {
        xml_stream.openTag(Falagard_xmlHandler::StateImageryElement)
            .attribute(Falagard_xmlHandler::NameAttribute, d_stateName);

        if (d_clipToDisplay)
            xml_stream.attribute(Falagard_xmlHandler::ClippedAttribute, PropertyHelper<bool>::Falsee);

        // output all layers defined for this state
        for(LayersList::const_iterator curr = d_layers.begin(); curr != d_layers.end(); ++curr)
            (*curr).writeXMLToStream(xml_stream);
        // write closing </StateImagery> tag
        xml_stream.closeTag();
    }
Ejemplo n.º 29
0
    void StateImagery::writeXMLToStream(XMLSerializer& xml_stream) const
    {
        xml_stream.openTag("StateImagery")
            .attribute("name", d_stateName);

        if (d_clipToDisplay)
            xml_stream.attribute("clipped", "false");

        // output all layers defined for this state
        for(LayersList::const_iterator curr = d_layers.begin(); curr != d_layers.end(); ++curr)
            (*curr).writeXMLToStream(xml_stream);
        // write closing </StateImagery> tag
        xml_stream.closeTag();
    }
Ejemplo n.º 30
0
JSValue* jsXMLSerializerPrototypeFunctionSerializeToString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
    if (!thisValue->isObject(&JSXMLSerializer::s_info))
        return throwError(exec, TypeError);
    JSXMLSerializer* castedThisObj = static_cast<JSXMLSerializer*>(thisValue);
    XMLSerializer* imp = static_cast<XMLSerializer*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    Node* node = toNode(args[0]);


    KJS::JSValue* result = jsString(exec, imp->serializeToString(node, ec));
    setDOMException(exec, ec);
    return result;
}