equal
deleted
inserted
replaced
21 #pragma warning(disable: 4786 4250 4503 4541) |
21 #pragma warning(disable: 4786 4250 4503 4541) |
22 |
22 |
23 |
23 |
24 #include "MLCompDataParse.h" |
24 #include "MLCompDataParse.h" |
25 |
25 |
26 #include <akndef.hrh> |
26 #include <AknDef.hrh> |
27 |
27 |
28 #include <sstream> |
28 #include <sstream> |
29 #include <fstream> |
29 #include <fstream> |
30 #include <algorithm> |
30 #include <algorithm> |
31 #include <iostream> // !!! for debug output only |
31 #include <iostream> // !!! for debug output only |
487 iIsMirroredHorizontally = (mirroredStr == KCompDataParseTextComponentMirrorTrue); // will be false if empty, eg for a non-mirrored layout |
487 iIsMirroredHorizontally = (mirroredStr == KCompDataParseTextComponentMirrorTrue); // will be false if empty, eg for a non-mirrored layout |
488 |
488 |
489 string maxVarietyStr = aAttribs.getValue(KCompDataParseNodeComponentAttributeMaxVariety); |
489 string maxVarietyStr = aAttribs.getValue(KCompDataParseNodeComponentAttributeMaxVariety); |
490 if(!maxVarietyStr.empty()) // screen doesn't have maxVariety for some reason |
490 if(!maxVarietyStr.empty()) // screen doesn't have maxVariety for some reason |
491 { |
491 { |
492 int maxVariety = CdlTkUtil::ParseInt(maxVarietyStr) - 2; |
492 //int maxVariety = CdlTkUtil::ParseInt(maxVarietyStr) - 2; |
493 // we ignore the maxVariety for now, as it will be calculated by parsing the values |
493 // we ignore the maxVariety for now, as it will be calculated by parsing the values |
494 } |
494 } |
495 } |
495 } |
496 |
496 |
497 MSaxLayoutHandler* TMLCompDataParseLayoutLine::HandleSaxParent(const std::string& aElement, const TAttribs& aAttribs) |
497 MSaxLayoutHandler* TMLCompDataParseLayoutLine::HandleSaxParent(const std::string& aElement, const TAttribs& aAttribs) |
692 auto_ptr<TMLCompDataParseLayout> TMLCompDataParseLayout::Parse(const string& aLayName) |
692 auto_ptr<TMLCompDataParseLayout> TMLCompDataParseLayout::Parse(const string& aLayName) |
693 { |
693 { |
694 auto_ptr<TMLCompDataParseLayout> layout(new TMLCompDataParseLayout); |
694 auto_ptr<TMLCompDataParseLayout> layout(new TMLCompDataParseLayout); |
695 int pos=0; |
695 int pos=0; |
696 string layName = aLayName; |
696 string layName = aLayName; |
697 int next = layName.find('+', pos); |
697 string::size_type next = layName.find('+', pos); |
698 if (next != string::npos) |
698 if (next != string::npos) |
699 { |
699 { |
700 throw GeneralErr(layName + " TMLCompDataParseLayout::Parse() - doesn't support multiple files"); |
700 throw GeneralErr(layName + " TMLCompDataParseLayout::Parse() - doesn't support multiple files"); |
701 } |
701 } |
702 |
702 |
722 iStack.push(aHandler); |
722 iStack.push(aHandler); |
723 } |
723 } |
724 |
724 |
725 void TLayoutSaxParser::Parse(const std::string& aFileName) |
725 void TLayoutSaxParser::Parse(const std::string& aFileName) |
726 { |
726 { |
727 SAX::basic_InputSource<std::string> is(aFileName); |
727 Arabica::SAX::InputSource<std::string> is(aFileName); |
728 SAX::XMLReader<std::string> parser; |
728 Arabica::SAX::XMLReader<std::string> parser; |
729 parser.setContentHandler(*this); |
729 parser.setContentHandler(*this); |
730 parser.setErrorHandler(*this); |
730 parser.setErrorHandler(*this); |
731 parser.parse(is); |
731 parser.parse(is); |
732 } |
732 } |
733 |
733 |
734 void TLayoutSaxParser::startElement(const std::string& /*namespaceURI*/, const std::string& localName, |
734 void TLayoutSaxParser::startElement(const std::string& /*namespaceURI*/, const std::string& localName, |
735 const std::string& /*qName*/, const SAX::basic_Attributes<std::string>& atts) |
735 const std::string& /*qName*/, const Arabica::SAX::Attributes<std::string>& atts) |
736 { |
736 { |
737 MSaxLayoutHandler* handler = iStack.top(); |
737 MSaxLayoutHandler* handler = iStack.top(); |
738 if (!handler) |
738 if (!handler) |
739 throw GeneralErr("SAX: No element handler"); |
739 throw GeneralErr("SAX: No element handler"); |
740 MSaxLayoutHandler* next = handler->HandleSax(localName, atts); |
740 MSaxLayoutHandler* next = handler->HandleSax(localName, atts); |