aknlayoutcompiler/src/MLAttributesParse.cpp
changeset 1 b700e12870ca
parent 0 f58d6ec98e88
equal deleted inserted replaced
0:f58d6ec98e88 1:b700e12870ca
    23 
    23 
    24 
    24 
    25 #include "MLAttributesParse.h"
    25 #include "MLAttributesParse.h"
    26 #include "MLCompDataParse.h" // for converting zoom strings
    26 #include "MLCompDataParse.h" // for converting zoom strings
    27 
    27 
    28 #include <akndef.hrh> // for logical font ids
    28 #include <AknDef.hrh> // for logical font ids
    29 
    29 
    30 #include <sstream>
    30 #include <sstream>
    31 #include <fstream>
    31 #include <fstream>
    32 #include <algorithm>
    32 #include <algorithm>
    33 #include <iostream> // !!! for debug output only
    33 #include <iostream> // !!! for debug output only
   138 // class TMLAttributesParse
   138 // class TMLAttributesParse
   139 //
   139 //
   140 auto_ptr<TMLAttributesParse> TMLAttributesParse::Parse(const string& aLayName)
   140 auto_ptr<TMLAttributesParse> TMLAttributesParse::Parse(const string& aLayName)
   141 	{
   141 	{
   142 	auto_ptr<TMLAttributesParse> layout(new TMLAttributesParse);
   142 	auto_ptr<TMLAttributesParse> layout(new TMLAttributesParse);
   143 	int pos=0;
   143 
   144 	string layName = aLayName;
   144 	string layName = aLayName;
   145 
   145 
   146 	if (layName.size() >= 2 && layName.substr(0,2) == "-m")
   146 	if (layName.size() >= 2 && layName.substr(0,2) == "-m")
   147 		{
   147 		{
   148 		layName = layName.substr(2);
   148 		layName = layName.substr(2);
   208 	iStack.push(aHandler);
   208 	iStack.push(aHandler);
   209 	}
   209 	}
   210 
   210 
   211 void TLayoutAttributesSaxParser::Parse(const std::string& aFileName)
   211 void TLayoutAttributesSaxParser::Parse(const std::string& aFileName)
   212 	{
   212 	{
   213 	SAX::basic_InputSource<std::string> is(aFileName);
   213 	Arabica::SAX::InputSource<std::string> is(aFileName);
   214 	SAX::XMLReader<std::string> parser;
   214 	Arabica::SAX::XMLReader<std::string> parser;
   215 	parser.setContentHandler(*this);
   215 	parser.setContentHandler(*this);
   216 	parser.setErrorHandler(*this);
   216 	parser.setErrorHandler(*this);
   217 	parser.parse(is);
   217 	parser.parse(is);
   218 	}
   218 	}
   219 
   219 
   220 void TLayoutAttributesSaxParser::startElement(const std::string& /*namespaceURI*/, const std::string& localName,
   220 void TLayoutAttributesSaxParser::startElement(const std::string& /*namespaceURI*/, const std::string& localName,
   221                               const std::string& /*qName*/, const SAX::basic_Attributes<std::string>& atts)
   221                               const std::string& /*qName*/, const Arabica::SAX::Attributes<std::string>& atts)
   222     {
   222     {
   223 	MSaxLayoutAttributesHandler* handler = iStack.top();
   223 	MSaxLayoutAttributesHandler* handler = iStack.top();
   224 	if (!handler)
   224 	if (!handler)
   225 		throw GeneralErr("SAX: No element handler");
   225 		throw GeneralErr("SAX: No element handler");
   226 	MSaxLayoutAttributesHandler* next = handler->HandleSax(localName, atts);
   226 	MSaxLayoutAttributesHandler* next = handler->HandleSax(localName, atts);