LCOV - code coverage report
Current view: top level - src/parsers - parserfromxml.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 475 632 75.2 %
Date: 2019-05-08 03:46:12 Functions: 58 61 95.1 %

          Line data    Source code
       1             : #include "parserfromxml.hpp"
       2             : 
       3             : #include <QFile>
       4             : #include <QMessageBox>
       5             : #include <QDebug>
       6             : 
       7             : namespace qtreports
       8             : {
       9             :     namespace detail
      10             :     {
      11             : 
      12        1598 :         ParserFromXML::ParseFunc    bindParseFunc( ParserFromXML * obj, ParserFromXML::ParseMethodPtr method )
      13             :         {
      14             :             using namespace std::placeholders;
      15        1598 :             auto func = std::bind( method, obj, _1, _2 );
      16        1598 :             return func;
      17             :         }
      18             : 
      19             :         template < typename T1 >
      20        1598 :         ParserFromXML::ParseFunc    toParseFunc( ParserFromXML * obj, bool( ParserFromXML::*method )( QXmlStreamReader &, const T1 & ) )
      21             :         {
      22             :             //Cast second parameter to ObjectPtr type;
      23        1598 :             auto parseMethodPtr = reinterpret_cast< ParserFromXML::ParseMethodPtr >( method );
      24        1598 :             return bindParseFunc( obj, parseMethodPtr );
      25             :         }
      26             : 
      27         226 :         bool    toBool( const QString & string )
      28             :         {
      29         226 :             return isEquals( string, "true" ) || isEquals( string, "1" );
      30             :         }
      31             : 
      32          47 :         ParserFromXML::ParserFromXML() : m_log( new QString() ) //MB Memory Leak
      33             :         {
      34          47 :             m_functions["report"]               = toParseFunc(this, &ParserFromXML::parseReport);
      35          47 :             m_functions["style"]                = toParseFunc(this, &ParserFromXML::parseStyle);
      36          47 :             m_functions["queryString"]          = toParseFunc(this, &ParserFromXML::parseQueryString);
      37          47 :             m_functions["field"]                = toParseFunc(this, &ParserFromXML::parseField);
      38          47 :             m_functions["group"]                = toParseFunc(this, &ParserFromXML::parseGroup);
      39          47 :             m_functions["groupExpression"]      = toParseFunc(this, &ParserFromXML::parseGroupExpression);
      40          47 :             m_functions["groupHeader"]          = toParseFunc(this, &ParserFromXML::parseGroupHeader);
      41          47 :             m_functions["groupFooter"]          = toParseFunc(this, &ParserFromXML::parseGroupFooter);
      42          47 :             m_functions["title"]                = toParseFunc(this, &ParserFromXML::parseTitle);
      43          47 :             m_functions["detail"]               = toParseFunc(this, &ParserFromXML::parseDetail);
      44          47 :             m_functions["summary"]              = toParseFunc(this, &ParserFromXML::parseSummary);
      45          47 :             m_functions["band"]                 = toParseFunc(this, &ParserFromXML::parseBand);
      46          47 :             m_functions["staticText"]           = toParseFunc(this, &ParserFromXML::parseStaticText);
      47          47 :             m_functions["textField"]            = toParseFunc(this, &ParserFromXML::parseTextField);
      48          47 :             m_functions["line"]                 = toParseFunc(this, &ParserFromXML::parseLine);
      49          47 :             m_functions["rect"]                 = toParseFunc(this, &ParserFromXML::parseRect);
      50          47 :             m_functions["ellipse"]              = toParseFunc(this, &ParserFromXML::parseEllipse);
      51          47 :             m_functions["image"]                = toParseFunc(this, &ParserFromXML::parseImage);
      52          47 :             m_functions["imageExpression"]      = toParseFunc(this, &ParserFromXML::parseImageExpression);
      53          47 :             m_functions["reportElement"]        = toParseFunc(this, &ParserFromXML::parseReportElement);
      54          47 :             m_functions["textElement"]          = toParseFunc(this, &ParserFromXML::parseTextElement);
      55          47 :             m_functions["font"]                 = toParseFunc(this, &ParserFromXML::parseFont);
      56          47 :             m_functions["text"]                 = toParseFunc(this, &ParserFromXML::parseText);
      57          47 :             m_functions["textFieldExpression"]  = toParseFunc(this, &ParserFromXML::parseTextFieldExpression);
      58          47 :             m_functions["crosstab"]             = toParseFunc(this, &ParserFromXML::parseCrosstab);
      59          47 :             m_functions["rowGroup"]             = toParseFunc(this, &ParserFromXML::parseRowGroup);
      60          47 :             m_functions["columnGroup"]          = toParseFunc(this, &ParserFromXML::parseColumnGroup);
      61          47 :             m_functions["crosstabCell"]         = toParseFunc(this, &ParserFromXML::parseCrosstabCell);
      62          47 :             m_functions["crosstabRowHeader"]    = toParseFunc(this, &ParserFromXML::parseCrosstabRowHeader);
      63          47 :             m_functions["crosstabColumnHeader"] = toParseFunc(this, &ParserFromXML::parseCrosstabColumnHeader);
      64          47 :             m_functions["cellContents"]         = toParseFunc(this, &ParserFromXML::parseCrosstabCellContents);
      65          47 :             m_functions[ "variable" ] = toParseFunc( this, &ParserFromXML::parseVariable );
      66          47 :             m_functions[ "variableExpression" ] = toParseFunc( this, &ParserFromXML::parseVariableExpression );
      67          47 :             m_functions[ "initialValueExpression" ] = toParseFunc( this, &ParserFromXML::parseInitialValueExpression );
      68          47 :         }
      69             : 
      70          47 :         ParserFromXML::~ParserFromXML() {}
      71             : 
      72          49 :         bool    ParserFromXML::parse( const QString & path )
      73             :         {
      74          49 :             m_report.clear();
      75          49 :             m_lastError = "";
      76          49 :             m_log.setString( new QString() ); //MB Memory Leak
      77             : 
      78          49 :             if( !QFile::exists( path ) )
      79             :             {
      80           3 :                 m_lastError = "The file not exists";
      81           3 :                 return false;
      82             :             }
      83             : 
      84          92 :             QFile file( path );
      85          46 :             file.open( QIODevice::OpenModeFlag::ReadOnly | QIODevice::Text );
      86          46 :             if( !file.isOpen() )
      87             :             {
      88           1 :                 m_lastError = "The file can not be opened";
      89           1 :                 return false;
      90             :             }
      91             : 
      92          45 :             return parseDocument( file.readAll() );//.replace( " ", "" )
      93             :         }
      94             : 
      95         221 :         bool    ParserFromXML::getValue( QXmlStreamReader & reader, QString & data )
      96             :         {
      97         221 :             m_log << "getValue():\tstart" << endl;
      98        1585 :             while( !reader.atEnd() && !reader.isEndElement() )
      99             :             {
     100         682 :                 data += reader.text().toString();
     101         682 :                 reader.readNext();
     102             :             }
     103             : 
     104         221 :             if( reader.hasError() )
     105             :             {
     106           0 :                 m_log << "getValue():\terror" << endl;
     107           0 :                 m_lastError = reader.errorString();
     108           0 :                 return false;
     109             :             }
     110             : 
     111         221 :             m_log << "getValue():\tend. data: " << data << endl;
     112             : 
     113         221 :             return true;
     114             :         }
     115             : 
     116        3081 :         bool    ParserFromXML::getAttribute( QXmlStreamReader & reader, const QString & name, QString & data, AttributeOption option )
     117             :         {
     118        3081 :             m_log << "getAttribute():\tstart. name: " << name << endl;
     119        6162 :             auto && attributes = reader.attributes();
     120        3081 :             if( !attributes.hasAttribute( name ) )
     121             :             {
     122         578 :                 m_log << "getAttribute():\tnot have attribute: " + name << endl;
     123         578 :                 if( option == AttributeOption::Optional )
     124             :                 {
     125         578 :                     return true;
     126             :                 }
     127           0 :                 m_log << "getAttribute():\terror" << endl;
     128           0 :                 auto elementName = reader.name().toString();
     129           0 :                 m_lastError = "Element \"" + reader.name().toString() +
     130           0 :                     "\" not have attribute: " + name;
     131           0 :                 return false;
     132             :             }
     133        2503 :             data = attributes.value( name ).toString();
     134        2503 :             m_log << "getAttribute():\tend. name: " << name << ",\t data: " << data << endl;
     135        2503 :             return true;
     136             :         }
     137             : 
     138        1784 :         bool    ParserFromXML::getRequiredAttribute( QXmlStreamReader & reader, const QString & name, QString & data )
     139             :         {
     140        1784 :             return getAttribute( reader, name, data, AttributeOption::Required );
     141             :         }
     142             : 
     143        1297 :         bool    ParserFromXML::getOptionalAttribute( QXmlStreamReader & reader, const QString & name, QString & data )
     144             :         {
     145        1297 :             return getAttribute( reader, name, data, AttributeOption::Optional );
     146             :         }
     147             : 
     148         414 :         bool    ParserFromXML::goToElementEnd( QXmlStreamReader & reader )
     149             :         {
     150         414 :             m_log << "goToEnd():\tstart" << endl;
     151         414 :             int level = 0;
     152         422 :             while( !reader.atEnd() )
     153             :             {
     154         418 :                 reader.readNext();
     155         418 :                 if( reader.isEndElement() )
     156             :                 {
     157         414 :                     if( level <= 0 )
     158             :                     {
     159         414 :                         break;
     160             :                     }
     161           0 :                     --level;
     162             :                 }
     163           4 :                 if( reader.isStartElement() )
     164             :                 {
     165           0 :                     ++level;
     166             :                 }
     167             :             }
     168             : 
     169         414 :             if( reader.hasError() )
     170             :             {
     171           0 :                 m_log << "goToEnd():\terror" << endl;
     172           0 :                 m_lastError = reader.errorString();
     173           0 :                 return false;
     174             :             }
     175         414 :             m_log << "goToEnd():\tend" << endl;
     176             : 
     177         414 :             return true;
     178             :         }
     179             : 
     180         788 :         bool    ParserFromXML::parseChilds( QXmlStreamReader & reader, const ObjectPtr & object )
     181             :         {
     182         788 :             m_log << "parseChilds():\tstart" << endl;
     183        7788 :             while( !reader.atEnd() )
     184             :             {
     185        4243 :                 reader.readNext();
     186        4243 :                 if( reader.isEndElement() )
     187             :                 {
     188         740 :                     break;
     189             :                 }
     190        3503 :                 if( !reader.isStartElement() )
     191             :                 {
     192        2087 :                     continue;
     193             :                 }
     194             : 
     195        2829 :                 auto name = reader.name().toString();
     196        1416 :                 m_log << "parseChilds():\tcurrent tag: " << name << endl;
     197        1416 :                 if( m_functions.contains( name ) )
     198             :                 {
     199        1406 :                     m_log << "parseChilds():\tuse func for: " << name << endl;
     200        2809 :                     auto func = m_functions[ name ];
     201        1406 :                     if( !func( reader, object ) )
     202             :                     {
     203           3 :                         return false;
     204             :                     }
     205             :                 }
     206             :                 else
     207             :                 {
     208          10 :                     m_log << "parseChilds():\tgoToElementEnd: " << name << endl;
     209          10 :                     if( !goToElementEnd( reader ) )
     210             :                     {
     211           0 :                         return false;
     212             :                     }
     213             :                 }
     214             :             }
     215             : 
     216         785 :             if( reader.hasError() )
     217             :             {
     218           3 :                 m_log << "parseChilds():\terror" << endl;
     219           3 :                 m_lastError = reader.errorString();
     220           3 :                 return false;
     221             :             }
     222             : 
     223         782 :             m_log << "parseChilds():\tend" << endl;
     224         782 :             return true;
     225             :         }
     226             : 
     227          45 :         bool    ParserFromXML::parseDocument( const QString & text )
     228             :         {
     229          90 :             QXmlStreamReader reader( text );
     230             : 
     231          45 :             m_report = ReportPtr( new Report() );
     232          45 :             if( !parseChilds( reader, m_report ) )
     233             :             {
     234           3 :                 return false;
     235             :             }
     236             : 
     237          42 :             return !reader.hasError();
     238             :         }
     239             : 
     240          45 :         bool    ParserFromXML::parseReport( QXmlStreamReader & reader, const ReportPtr & report )
     241             :         {
     242          90 :             QString name;
     243          45 :             if( !getRequiredAttribute( reader, "name", name ) )
     244             :             {
     245           0 :                 return false;
     246             :             }
     247             : 
     248          90 :             QString leftMargin;
     249          45 :             if( !getOptionalAttribute( reader, "leftMargin", leftMargin ) )
     250             :             {
     251           0 :                 return false;
     252             :             }
     253             : 
     254          90 :             QString rightMargin;
     255          45 :             if( !getOptionalAttribute( reader, "rightMargin", rightMargin ) )
     256             :             {
     257           0 :                 return false;
     258             :             }
     259             : 
     260          90 :             QString topMargin;
     261          45 :             if( !getOptionalAttribute( reader, "topMargin", topMargin ) )
     262             :             {
     263           0 :                 return false;
     264             :             }
     265             : 
     266          90 :             QString bottomMargin;
     267          45 :             if( !getOptionalAttribute( reader, "bottomMargin", bottomMargin ) )
     268             :             {
     269           0 :                 return false;
     270             :             }
     271             : 
     272          90 :             QString orientationString;
     273          45 :             if( !getOptionalAttribute( reader, "orientation", orientationString ) )
     274             :             {
     275           0 :                 return false;
     276             :             }
     277             : 
     278          90 :             QString pageWidthString;
     279          45 :             if( !getOptionalAttribute( reader, "pageWidth", pageWidthString ) )
     280             :             {
     281           0 :                 return false;
     282             :             }
     283             : 
     284          90 :             QString pageHeightString;
     285          45 :             if( !getOptionalAttribute( reader, "pageHeight", pageHeightString ) )
     286             :             {
     287           0 :                 return false;
     288             :             }
     289             : 
     290          45 :             if( !parseChilds( reader, report ) )
     291             :             {
     292           3 :                 return false;
     293             :             }
     294             : 
     295          42 :             report->setTagName( "report" );
     296          42 :             report->setName( name );
     297             : 
     298          42 :             if( !leftMargin.isEmpty() )
     299             :             {
     300           6 :                 report->setLeftMargin( leftMargin.toInt() );
     301             :             }
     302             : 
     303          42 :             if( !topMargin.isEmpty() )
     304             :             {
     305           6 :                 report->setTopMargin( topMargin.toInt() );
     306             :             }
     307             : 
     308          42 :             if( !rightMargin.isEmpty() )
     309             :             {
     310           6 :                 report->setRightMargin( rightMargin.toInt() );
     311             :             }
     312             : 
     313          42 :             if( !bottomMargin.isEmpty() )
     314             :             {
     315           6 :                 report->setBottomMargin( bottomMargin.toInt() );
     316             :             }
     317             : 
     318          42 :             if( !orientationString.isEmpty() )
     319             :             {
     320          18 :                 auto orientation = isEquals( orientationString, "portrait" ) ?
     321             :                     QPrinter::Orientation::Portrait :
     322           9 :                     QPrinter::Orientation::Landscape;
     323           9 :                 report->setOrientation( orientation );
     324             :             }
     325             : 
     326          42 :             if( !pageWidthString.isEmpty() )
     327             :             {
     328           7 :                 report->setWidth( pageWidthString.toInt() );
     329             :             }
     330             : 
     331          42 :             if( !pageHeightString.isEmpty() )
     332             :             {
     333           7 :                 report->setHeight( pageHeightString.toInt() );
     334             :             }
     335             : 
     336          42 :             return !reader.hasError();
     337             :         }
     338             : 
     339             : 
     340          38 :         bool    ParserFromXML::parseStyle( QXmlStreamReader & reader, const ReportPtr & report )
     341             :         {
     342          76 :             QString nameString;
     343          38 :             if( !getRequiredAttribute( reader, "name", nameString ) )
     344             :             {
     345           0 :                 return false;
     346             :             }
     347             : 
     348          76 :             QString isDefaultString;
     349          38 :             if( !getOptionalAttribute( reader, "isDefault", isDefaultString ) )
     350             :             {
     351           0 :                 return false;
     352             :             }
     353             : 
     354          76 :             QString fontNameString;
     355          38 :             if( !getOptionalAttribute( reader, "fontName", fontNameString ) )
     356             :             {
     357           0 :                 return false;
     358             :             }
     359             : 
     360          76 :             QString fontSizeString;
     361          38 :             if( !getOptionalAttribute( reader, "fontSize", fontSizeString ) )
     362             :             {
     363           0 :                 return false;
     364             :             }
     365             : 
     366          76 :             QString fontColorString;
     367          38 :             if( !getOptionalAttribute( reader, "fontColor", fontColorString ) )
     368             :             {
     369           0 :                 return false;
     370             :             }
     371             : 
     372          76 :             QString isBoldString;
     373          38 :             if( !getOptionalAttribute( reader, "isBold", isBoldString ) )
     374             :             {
     375           0 :                 return false;
     376             :             }
     377             : 
     378          76 :             QString isItalicString;
     379          38 :             if( !getOptionalAttribute( reader, "isItalic", isItalicString ) )
     380             :             {
     381           0 :                 return false;
     382             :             }
     383             : 
     384          76 :             QString isUnderlineString;
     385          38 :             if( !getOptionalAttribute( reader, "isUnderline", isUnderlineString ) )
     386             :             {
     387           0 :                 return false;
     388             :             }
     389             : 
     390          76 :             QString isStrikeThroughString;
     391          38 :             if( !getOptionalAttribute( reader, "isStrikeThrough", isStrikeThroughString ) )
     392             :             {
     393           0 :                 return false;
     394             :             }
     395             : 
     396          76 :             QString pdfFontNameString;
     397          38 :             if( !getOptionalAttribute( reader, "pdfFontName", pdfFontNameString ) )
     398             :             {
     399           0 :                 return false;
     400             :             }
     401             : 
     402          76 :             QString pdfEncodingString;
     403          38 :             if( !getOptionalAttribute( reader, "pdfEncoding", pdfEncodingString ) )
     404             :             {
     405           0 :                 return false;
     406             :             }
     407             : 
     408          76 :             QString isPdfEmbeddedString;
     409          38 :             if( !getOptionalAttribute( reader, "isPdfEmbedded", isPdfEmbeddedString ) )
     410             :             {
     411           0 :                 return false;
     412             :             }
     413             : 
     414         114 :             while( !reader.atEnd() && !reader.isEndElement() )
     415             :             {
     416          38 :                 reader.readNext();
     417             :             }
     418             : 
     419          38 :             if( reader.hasError() )
     420             :             {
     421           0 :                 m_lastError = reader.errorString();
     422           0 :                 return false;
     423             :             }
     424             : 
     425             :             //isBold = "false" isItalic = "false" isUnderline = "false" isStrikeThrough = "false"
     426             : 
     427          76 :             StylePtr style( new Style() );
     428          38 :             style->setTagName( "style" );
     429          38 :             style->setName( nameString );
     430             : 
     431          38 :             if( !isDefaultString.isEmpty() )
     432             :             {
     433          37 :                 bool isDefault = toBool( isDefaultString );
     434          37 :                 style->setAsDefault( isDefault );
     435          37 :                 if( isDefault )
     436             :                 {
     437          37 :                     report->setDefaultStyle( style );
     438             :                 }
     439             :             }
     440             : 
     441          38 :             if( !fontNameString.isEmpty() )
     442             :             {
     443          37 :                 style->setFontName( fontNameString );
     444             :             }
     445             : 
     446          38 :             if( !fontColorString.isEmpty() )
     447             :             {
     448           7 :                 style->setFontColor( QColor( fontColorString ) );
     449             :             }
     450             : 
     451          38 :             if( !fontSizeString.isEmpty() )
     452             :             {
     453          37 :                 style->setFontSize( fontSizeString.toInt() );
     454             :             }
     455             : 
     456          38 :             if( !isBoldString.isEmpty() )
     457             :             {
     458           7 :                 style->setBold( toBool( isBoldString ) );
     459             :             }
     460             : 
     461          38 :             if( !isItalicString.isEmpty() )
     462             :             {
     463           7 :                 style->setItalic( toBool( isItalicString ) );
     464             :             }
     465             : 
     466          38 :             if( !isUnderlineString.isEmpty() )
     467             :             {
     468           6 :                 style->setUnderline( toBool( isUnderlineString ) );
     469             :             }
     470             : 
     471          38 :             if( !isStrikeThroughString.isEmpty() )
     472             :             {
     473           6 :                 style->setStrikeThrough( toBool( isStrikeThroughString ) );
     474             :             }
     475             : 
     476          38 :             if( !pdfFontNameString.isEmpty() )
     477             :             {
     478          37 :                 style->setPDFFontName( pdfFontNameString );
     479             :             }
     480             : 
     481          38 :             if( !pdfEncodingString.isEmpty() )
     482             :             {
     483          37 :                 style->setPDFEncoding( pdfEncodingString );
     484             :             }
     485             : 
     486          38 :             if( !isPdfEmbeddedString.isEmpty() )
     487             :             {
     488          37 :                 style->setPDFEmbedded( toBool( isPdfEmbeddedString ) );
     489             :             }
     490             : 
     491          38 :             report->addStyle( nameString, style );
     492             : 
     493          38 :             return !reader.hasError();
     494             :         }
     495             : 
     496         120 :         bool    ParserFromXML::parseField( QXmlStreamReader & reader, const ReportPtr & report )
     497             :         {
     498         240 :             QString name;
     499         120 :             if( !getRequiredAttribute( reader, "name", name ) )
     500             :             {
     501           0 :                 return false;
     502             :             }
     503             : 
     504         240 :             QString className;
     505         120 :             if( !getRequiredAttribute( reader, "class", className ) )
     506             :             {
     507           0 :                 return false;
     508             :             }
     509             :             /*
     510             :             while( !reader.atEnd() && !reader.isEndElement() ) {
     511             :                 reader.readNext();
     512             :             }
     513             : 
     514             :             if( reader.hasError() ) {
     515             :                 m_lastError = reader.errorString();
     516             :                 return false;
     517             :             }
     518             :             */
     519         240 :             FieldPtr field( new Field() );
     520         120 :             if( !parseChilds( reader, field ) )
     521             :             {
     522           0 :                 return false;
     523             :             }
     524             : 
     525         120 :             field->setTagName( "field" );
     526         120 :             field->setName( name );
     527         120 :             field->setClassName( className );
     528         120 :             report->setField( name, field );
     529             : 
     530         120 :             return !reader.hasError();
     531             :         }
     532             : 
     533           7 :         bool    ParserFromXML::parseGroup( QXmlStreamReader & reader, const ReportPtr & report )
     534             :         {
     535          14 :             QString nameString;
     536           7 :             if( !getRequiredAttribute( reader, "name", nameString ) )
     537             :             {
     538           0 :                 return false;
     539             :             }
     540             : 
     541          14 :             GroupPtr group( new Group() );
     542           7 :             group->setTagName( "group" );
     543           7 :             group->setName( nameString );
     544             : 
     545           7 :             if( !parseChilds( reader, group ) )
     546             :             {
     547           0 :                 return false;
     548             :             }
     549             : 
     550           7 :             report->addGroup( nameString, group );
     551             : 
     552           7 :             return !reader.hasError();
     553             :         }
     554             : 
     555           7 :         bool    ParserFromXML::parseGroupExpression( QXmlStreamReader & reader, const GroupPtr & group )
     556             :         {
     557          14 :             QString text;
     558           7 :             if( !getValue( reader, text ) )
     559             :             {
     560           0 :                 return false;
     561             :             }
     562             : 
     563           7 :             group->setExpression( text );
     564             : 
     565           7 :             return !reader.hasError();
     566             :         }
     567             : 
     568           6 :         bool    ParserFromXML::parseGroupHeader( QXmlStreamReader & reader, const GroupPtr & group )
     569             :         {
     570          12 :             SectionPtr header( new Section() );
     571           6 :             header->setTagName( "groupHeader" );
     572             : 
     573           6 :             if( !parseChilds( reader, header ) )
     574             :             {
     575           0 :                 return false;
     576             :             }
     577             : 
     578           6 :             group->setHeader( header );
     579             : 
     580           6 :             return !reader.hasError();
     581             :         }
     582             : 
     583           6 :         bool    ParserFromXML::parseGroupFooter( QXmlStreamReader & reader, const GroupPtr & group )
     584             :         {
     585          12 :             SectionPtr footer( new Section() );
     586           6 :             footer->setTagName( "groupFooter" );
     587             : 
     588           6 :             if( !parseChilds( reader, footer ) )
     589             :             {
     590           0 :                 return false;
     591             :             }
     592             : 
     593           6 :             group->setFooter( footer );
     594             : 
     595           6 :             return !reader.hasError();
     596             :         }
     597             : 
     598           9 :         bool    ParserFromXML::parseTitle( QXmlStreamReader & reader, const ReportPtr & report )
     599             :         {
     600          18 :             TitlePtr title( new Title() );
     601           9 :             if( !parseChilds( reader, title ) )
     602             :             {
     603           0 :                 return false;
     604             :             }
     605             : 
     606           9 :             title->setTagName( "title" );
     607             :             //title->setWidth( report->getWidth() );
     608           9 :             report->setTitle( title );
     609             : 
     610           9 :             return !reader.hasError();
     611             :         }
     612             : 
     613          30 :         bool    ParserFromXML::parseDetail( QXmlStreamReader & reader, const ReportPtr & report )
     614             :         {
     615          60 :             DetailPtr detail( new Detail() );
     616          30 :             if( !parseChilds( reader, detail ) )
     617             :             {
     618           0 :                 return false;
     619             :             }
     620             : 
     621          30 :             detail->setTagName( "detail" );
     622             :             //detail->setWidth( report->getWidth() );
     623          30 :             report->setDetail( detail );
     624             : 
     625          30 :             return !reader.hasError();
     626             :         }
     627             : 
     628           9 :         bool ParserFromXML::parseSummary(QXmlStreamReader &reader, const ReportPtr &report)
     629             :         {
     630          18 :             SummaryPtr summary(new Summary());
     631           9 :             if( !parseChilds(reader, summary))
     632             :             {
     633           0 :                 return false;
     634             :             }
     635             : 
     636           9 :             summary->setTagName( "summary" );
     637           9 :             report->setSummary(summary);
     638             : 
     639           9 :             return !reader.hasError();
     640             :         }
     641             : 
     642          70 :         bool    ParserFromXML::parseBand( QXmlStreamReader & reader, const SectionPtr & section )
     643             :         {
     644         140 :             QString height;
     645          70 :             if( !getRequiredAttribute( reader, "height", height ) )
     646             :             {
     647           0 :                 return false;
     648             :             }
     649             : 
     650         140 :             BandPtr band( new Band() );
     651          70 :             if( !parseChilds( reader, band ) )
     652             :             {
     653           0 :                 return false;
     654             :             }
     655             : 
     656          70 :             band->setTagName( "band" );
     657          70 :             band->setHeight( height.toInt() );
     658             :             //band->setWidth( section->getWidth() );
     659          70 :             section->addBand( band );
     660             : 
     661          70 :             return !reader.hasError();
     662             :         }
     663             : 
     664           3 :         bool    ParserFromXML::parseCrosstab( QXmlStreamReader & reader, const BandPtr & band )
     665             :         {
     666           6 :             CrosstabPtr crosstab(new Crosstab());
     667           6 :             QString attribute;
     668           3 :             getOptionalAttribute( reader, "isRepeatColumnHeaders", attribute );
     669           3 :                 crosstab->setColumnHeadersRepeating(static_cast<QVariant>(attribute).toBool() );//Исправь, если можешь сделать каст лучше
     670           3 :             getOptionalAttribute( reader, "isRepeatRowHeaders", attribute );
     671           3 :                 crosstab->setRowHeadersRepeating(static_cast<QVariant>(attribute).toBool() );//Исправь, если можешь сделать каст лучше
     672           3 :             getOptionalAttribute( reader, "ignoreWigth", attribute );
     673           3 :                 crosstab->setWidthIgnoring(static_cast<QVariant>(attribute).toBool() );//Исправь, если можешь сделать каст лучше
     674           3 :             getOptionalAttribute( reader, "runDirection", attribute );
     675           3 :             if(attribute.toLower() == ("rtl"))
     676           0 :                 crosstab->setRunDirectionLeftToRight(false);
     677             :             else
     678           3 :                 crosstab->setRunDirectionLeftToRight(true);
     679           3 :             getOptionalAttribute( reader, "columnBreakOffset", attribute );
     680           3 :                 crosstab->setColumnBreakOffset(attribute.toInt());
     681           3 :             if(!parseChilds(reader, crosstab))
     682             :             {
     683           0 :                 return false;
     684             :             }
     685             : 
     686           3 :             crosstab->setTagName("crosstab");
     687           3 :             band->addCrosstab(crosstab);
     688             : 
     689           3 :             return !reader.hasError();
     690             :         }
     691             : 
     692           3 :         bool ParserFromXML::parseRowGroup(QXmlStreamReader &reader, const CrosstabPtr &crosstab)
     693             :         {
     694           6 :             CrosstabGroupPtr rowGroup(new CrosstabGroup(CrosstabGroupType::ROW));
     695             : 
     696           6 :             QString width;
     697           3 :             if(!getRequiredAttribute(reader, "width", width))
     698             :             {
     699           0 :                 return false;
     700             :             }
     701             : 
     702           6 :             QString name = "";
     703           3 :             getOptionalAttribute(reader, "name", name);
     704             : 
     705           3 :             if(name != "")
     706           3 :                 rowGroup->setName(name);
     707             : 
     708           3 :             if(!parseChilds(reader, rowGroup))
     709             :             {
     710           0 :                 return false;
     711             :             }
     712             : 
     713           3 :             rowGroup->setWidth(width.toInt());
     714           3 :             rowGroup->setTagName("rowGroup");
     715           3 :             crosstab->setRowGroup(rowGroup);
     716             : 
     717           3 :             return !reader.hasError();
     718             :         }
     719             : 
     720           3 :         bool ParserFromXML::parseColumnGroup(QXmlStreamReader &reader, const CrosstabPtr &crosstab)
     721             :         {
     722           6 :             CrosstabGroupPtr columnGroup(new CrosstabGroup(CrosstabGroupType::COLUMN));
     723             : 
     724           6 :             QString height;
     725           3 :             if(!getRequiredAttribute(reader, "height", height))
     726             :             {
     727           0 :                 return false;
     728             :             }
     729             : 
     730           6 :             QString name = "";
     731           3 :             getOptionalAttribute(reader, "name", name);
     732             : 
     733           3 :             if(name != "")
     734           3 :                 columnGroup->setName(name);
     735             : 
     736           3 :             if(!parseChilds(reader, columnGroup))
     737             :             {
     738           0 :                 return false;
     739             :             }
     740             : 
     741           3 :             columnGroup->setHeight(height.toInt());
     742           3 :             columnGroup->setTagName("columnGroup");
     743           3 :             crosstab->setColumnGroup(columnGroup);
     744             : 
     745           3 :             return !reader.hasError();
     746             :         }
     747             : 
     748           3 :         bool ParserFromXML::parseCrosstabCell(QXmlStreamReader &reader, const CrosstabPtr &crosstab)
     749             :         {
     750           6 :             CrosstabCellPtr crosstabCell(new CrosstabCell());
     751             : 
     752           6 :             QString width;
     753           3 :             if(!getRequiredAttribute(reader, "width", width))
     754             :             {
     755           0 :                 return false;
     756             :             }
     757             : 
     758           6 :             QString height;
     759           3 :             if(!getRequiredAttribute(reader, "height", height))
     760             :             {
     761           0 :                 return false;
     762             :             }
     763             : 
     764           3 :             if(!parseChilds(reader, crosstabCell))
     765             :             {
     766           0 :                 return false;
     767             :             }
     768             : 
     769           3 :             crosstabCell->setWidth(width.toInt());
     770           3 :             crosstabCell->setHeight(height.toInt());
     771           3 :             crosstabCell->setTagName("crosstabCell");
     772           3 :             crosstab->setCrosstabCell(crosstabCell);
     773             : 
     774           3 :             return !reader.hasError();
     775             :         }
     776             : 
     777           3 :         bool ParserFromXML::parseCrosstabRowHeader(QXmlStreamReader &reader, const CrosstabGroupPtr &rowGroup)
     778             :         {
     779           6 :             CrosstabHeaderPtr crosstabRowHeader(new CrosstabHeader());
     780           3 :             if(!parseChilds(reader, crosstabRowHeader))
     781             :             {
     782           0 :                 return false;
     783             :             }
     784             : 
     785           3 :             crosstabRowHeader->setTagName("crosstabRowHeader");
     786           3 :             rowGroup->setHeader(crosstabRowHeader);
     787             : 
     788           3 :             return !reader.hasError();
     789             :         }
     790             : 
     791           3 :         bool ParserFromXML::parseCrosstabColumnHeader(QXmlStreamReader &reader, const CrosstabGroupPtr &columnGroup)
     792             :         {
     793           6 :             CrosstabHeaderPtr crosstabColumnHeader(new CrosstabHeader());
     794           3 :             if(!parseChilds(reader, crosstabColumnHeader))
     795             :             {
     796           0 :                 return false;
     797             :             }
     798             : 
     799           3 :             crosstabColumnHeader->setTagName("crosstabColumnHeader");
     800           3 :             columnGroup->setHeader(crosstabColumnHeader);
     801             : 
     802           3 :             return !reader.hasError();
     803             :         }
     804             : 
     805           9 :         bool ParserFromXML::parseCrosstabCellContents(QXmlStreamReader &reader, const CrosstabCellPtr &crosstabSection)
     806             :         {
     807          18 :             CellContentsPtr cellContents(new CellContents());
     808           9 :             if(!parseChilds(reader, cellContents))
     809             :             {
     810           0 :                 return false;
     811             :             }
     812             : 
     813           9 :             cellContents->setTagName("cellContents");
     814           9 :             crosstabSection->setCellContents(cellContents);
     815             : 
     816           9 :             return !reader.hasError();
     817             :         }
     818             : 
     819          51 :         bool    ParserFromXML::parseStaticText( QXmlStreamReader & reader, const BandPtr & band )
     820             :         {
     821         102 :             StaticTextPtr staticText( new StaticText() );
     822          51 :             if( !parseChilds( reader, staticText ) )
     823             :             {
     824           0 :                 return false;
     825             :             }
     826             : 
     827          51 :             staticText->setTagName( "staticText" );
     828          51 :             band->addStaticText( staticText );
     829             : 
     830          51 :             return !reader.hasError();
     831             :         }
     832             : 
     833         122 :         bool    ParserFromXML::parseTextField(QXmlStreamReader & reader, const WidgetPtr &widget)
     834             :         {
     835         244 :             TextFieldPtr textField(new TextField());
     836         122 :             if(!parseChilds(reader, textField))
     837             :             {
     838           0 :                 return false;
     839             :             }
     840             : 
     841         122 :             textField->setTagName( "textField" );
     842             : 
     843             :             // TextField может находится в Band или CellContents (Crosstab)
     844             :             // Нужно понять метод какого именно клаcса нужно вызывать
     845         122 :             auto data = widget.data();
     846         122 :             Band* band = dynamic_cast<Band*>(data);
     847         122 :             if(band)
     848             :             {
     849         226 :                 BandPtr band = qSharedPointerCast<Band>(widget);
     850         113 :                 band->addTextField(textField);
     851             :             }
     852         122 :             CellContents* cell = dynamic_cast<CellContents*>(data);
     853         122 :             if(cell)
     854             :             {
     855          18 :                 CellContentsPtr cell = qSharedPointerCast<CellContents>(widget);
     856           9 :                 cell->setTextField(textField);
     857             :             }
     858             : 
     859         122 :             return !reader.hasError();
     860             :         }
     861             : 
     862          54 :         bool    ParserFromXML::parseLine( QXmlStreamReader & reader, const BandPtr & band )
     863             :         {
     864         108 :             LinePtr line( new Line() );
     865          54 :             if( !parseChilds( reader, line ) )
     866             :             {
     867           0 :                 return false;
     868             :             }
     869             : 
     870          54 :             line->setTagName( "line" );
     871          54 :             band->addLine( line );
     872             : 
     873          54 :             return !reader.hasError();
     874             :         }
     875             : 
     876          24 :         bool    ParserFromXML::parseRect( QXmlStreamReader & reader, const BandPtr & band )
     877             :         {
     878          48 :             RectPtr rect( new Rect() );
     879          24 :             if( !parseChilds( reader, rect ) )
     880             :             {
     881           0 :                 return false;
     882             :             }
     883             : 
     884          24 :             rect->setTagName( "rect" );
     885          24 :             band->addRect( rect );
     886             : 
     887          24 :             return !reader.hasError();
     888             :         }
     889             : 
     890          12 :         bool    ParserFromXML::parseEllipse( QXmlStreamReader & reader, const BandPtr & band )
     891             :         {
     892          24 :             EllipsePtr ellipse( new Ellipse() );
     893          12 :             if( !parseChilds( reader, ellipse ) )
     894             :             {
     895           0 :                 return false;
     896             :             }
     897             : 
     898          12 :             ellipse->setTagName( "ellipse" );
     899          12 :             band->addEllipse( ellipse );
     900             : 
     901          12 :             return !reader.hasError();
     902             :         }
     903             : 
     904          12 :         bool    ParserFromXML::parseImage( QXmlStreamReader & reader, const BandPtr & band )
     905             :         {
     906          24 :             ImagePtr image( new Image() );
     907          12 :             if( !parseChilds( reader, image ) )
     908             :             {
     909           0 :                 return false;
     910             :             }
     911             : 
     912          12 :             image->setTagName( "image" );
     913          12 :             band->addImage( image );
     914             : 
     915          12 :             return !reader.hasError();
     916             :         }
     917             : 
     918         278 :         bool    ParserFromXML::parseReportElement( QXmlStreamReader & reader, const WidgetPtr & widget )
     919             :         {
     920         556 :             QString xString;
     921         278 :             if( !getRequiredAttribute( reader, "x", xString ) )
     922             :             {
     923           0 :                 return false;
     924             :             }
     925             : 
     926         556 :             QString yString;
     927         278 :             if( !getRequiredAttribute( reader, "y", yString ) )
     928             :             {
     929           0 :                 return false;
     930             :             }
     931             : 
     932         556 :             QString widthString;
     933         278 :             if( !getRequiredAttribute( reader, "width", widthString ) )
     934             :             {
     935           0 :                 return false;
     936             :             }
     937             : 
     938         556 :             QString heightString;
     939         278 :             if( !getRequiredAttribute( reader, "height", heightString ) )
     940             :             {
     941           0 :                 return false;
     942             :             }
     943             : 
     944         556 :             QString styleString;
     945         278 :             if( !getOptionalAttribute( reader, "style", styleString ) )
     946             :             {
     947           0 :                 return false;
     948             :             }
     949             : 
     950         278 :             if( !goToElementEnd( reader ) )
     951             :             {
     952           0 :                 return false;
     953             :             }
     954             : 
     955         278 :             if( !xString.isEmpty() )
     956             :             {
     957         278 :                 widget->setX( xString.toInt() );
     958             :             }
     959             : 
     960         278 :             if( !yString.isEmpty() )
     961             :             {
     962         278 :                 widget->setY( yString.toInt() );
     963             :             }
     964             : 
     965         278 :             if( !widthString.isEmpty() )
     966             :             {
     967         278 :                 auto width = widthString.toInt();
     968             :                 //if( widthString.contains( "%" ) )
     969             :                 //{
     970             :                     //auto percentString = widthString.split( "%" ).at( 0 );
     971             :                     //auto percent = 0.01 * std::max( 0, std::min( 100, percentString.toInt() ) );
     972             :                     //width = static_cast< int >( percent * m_report->getWidth() );
     973             :                 //}
     974         278 :                 widget->setWidth( width );
     975             :             }
     976             : 
     977         278 :             if( !heightString.isEmpty() )
     978             :             {
     979         278 :                 widget->setHeight( heightString.toInt() );
     980             :             }
     981             :             
     982         278 :             if( !styleString.isEmpty() )
     983             :             {
     984         126 :                 widget->setStyle( styleString );
     985             :             }
     986             : 
     987             :             //widget->setRect( QRect( x, y, width, height ) );
     988             : 
     989         278 :             return !reader.hasError();
     990             :         }
     991             : 
     992         139 :         bool    ParserFromXML::parseTextElement( QXmlStreamReader & reader, const WidgetPtr & widget )
     993             :         {
     994         278 :             QString textAlignment;
     995         139 :             if( !getRequiredAttribute( reader, "textAlignment", textAlignment ) )
     996             :             {
     997           0 :                 return false;
     998             :             }
     999             : 
    1000         278 :             QString textVAlignment;
    1001         139 :             if( !getOptionalAttribute( reader, "textVAlignment", textVAlignment ) )
    1002             :             {
    1003           0 :                 return false;
    1004             :             }
    1005             : 
    1006         139 :             if( !parseChilds( reader, widget ) )
    1007             :             {
    1008           0 :                 return false;
    1009             :             }
    1010             : 
    1011         139 :             auto isCenter = isEquals( textAlignment, "Center" );
    1012         139 :             auto isRight = isEquals( textAlignment, "Right" );
    1013             : 
    1014         139 :             auto isVTop = isEquals( textVAlignment, "Top" );
    1015         139 :             auto isVBottom = isEquals( textVAlignment, "Bottom" );
    1016             : 
    1017         139 :             auto hFlag = isCenter ? Qt::AlignCenter : isRight ? Qt::AlignRight : Qt::AlignLeft;
    1018         139 :             auto vFlag = isVTop ? Qt::AlignTop : isVBottom ? Qt::AlignBottom : Qt::AlignVCenter;
    1019             : 
    1020         139 :             widget->setAlignment( hFlag | vFlag );
    1021             : 
    1022         139 :             return !reader.hasError();
    1023             :         }
    1024             : 
    1025         126 :         bool    ParserFromXML::parseFont( QXmlStreamReader & reader, const WidgetPtr & widget )
    1026             :         {
    1027         252 :             QString isBold;
    1028         126 :             if( !getOptionalAttribute( reader, "isBold", isBold ) )
    1029             :             {
    1030           0 :                 return false;
    1031             :             }
    1032             : 
    1033         126 :             if( !goToElementEnd( reader ) )
    1034             :             {
    1035           0 :                 return false;
    1036             :             }
    1037             : 
    1038         126 :             if( !isBold.isEmpty() )
    1039             :             {
    1040         126 :                 widget->setBold( toBool( isBold ) );
    1041             :             }
    1042             : 
    1043         126 :             return !reader.hasError();
    1044             :         }
    1045             : 
    1046          52 :         bool    ParserFromXML::parseText( QXmlStreamReader & reader, const StaticTextPtr & staticText )
    1047             :         {
    1048         104 :             QString text;
    1049          52 :             if( !getValue( reader, text ) )
    1050             :             {
    1051           0 :                 return false;
    1052             :             }
    1053             : 
    1054          52 :             staticText->setOriginalText( text );
    1055             : 
    1056          52 :             return !reader.hasError();
    1057             :         }
    1058             : 
    1059         121 :         bool    ParserFromXML::parseTextFieldExpression( QXmlStreamReader & reader, const TextFieldPtr & textField )
    1060             :         {
    1061         242 :             QString className;
    1062         121 :             if( !getRequiredAttribute( reader, "class", className ) )
    1063             :             {
    1064           0 :                 return false;
    1065             :             }
    1066             : 
    1067         242 :             QString text;
    1068         121 :             if( !getValue( reader, text ) )
    1069             :             {
    1070           0 :                 return false;
    1071             :             }
    1072             : 
    1073         121 :             textField->setOriginalText( text );
    1074         121 :             textField->setClassName( className );
    1075             : 
    1076         121 :             return !reader.hasError();
    1077             :         }
    1078             : 
    1079          12 :         bool    ParserFromXML::parseImageExpression( QXmlStreamReader & reader, const ImagePtr & image )
    1080             :         {
    1081             :             //QString className;
    1082             :             //if( !getRequiredAttribute( reader, "class", className ) )
    1083             :             //{
    1084             :             //    return false;
    1085             :             //}
    1086             : 
    1087          24 :             QString text;
    1088          12 :             if( !getValue( reader, text ) )
    1089             :             {
    1090           0 :                 return false;
    1091             :             }
    1092             : 
    1093          12 :             image->setOriginalText( text );
    1094             :             //image->setClassName( className );
    1095             : 
    1096          12 :             return !reader.hasError();
    1097             :         }
    1098             : 
    1099           0 :         bool ParserFromXML::parseVariable(QXmlStreamReader& reader, const ReportPtr &report)
    1100             :         {
    1101           0 :             QString variableName;
    1102           0 :             if( !getRequiredAttribute( reader, "name", variableName ) )
    1103             :             {
    1104           0 :                 return false;
    1105             :             }
    1106             : 
    1107           0 :             QString className;
    1108           0 :             if( !getRequiredAttribute( reader, "class", className ) )
    1109             :             {
    1110           0 :                 className = "QString";
    1111             :             }
    1112             : 
    1113           0 :             QString resetType;
    1114           0 :             if( !getRequiredAttribute( reader, "resetType", resetType ) )
    1115             :             {
    1116           0 :                 resetType = "Report";
    1117             :             }
    1118             : 
    1119           0 :             QString incrementType;
    1120           0 :             if( !getRequiredAttribute( reader, "incrementType", incrementType ) )
    1121             :             {
    1122           0 :                 incrementType = "None";
    1123             :             }
    1124             : 
    1125           0 :             QString resetGroup;
    1126           0 :             if( !getRequiredAttribute( reader, "resetGroup", resetGroup ) )
    1127             :             {
    1128           0 :                 resetGroup = QString();
    1129             :             }
    1130             : 
    1131           0 :             QString incrementGroup;
    1132           0 :             if( !getRequiredAttribute( reader, "incrementGroup", incrementGroup ) )
    1133             :             {
    1134           0 :                 incrementGroup = QString();
    1135             :             }
    1136             : 
    1137           0 :             QString calculation;
    1138           0 :             if( !getRequiredAttribute( reader, "calculation", calculation ) )
    1139             :             {
    1140           0 :                 return false;
    1141             :             }
    1142             : 
    1143           0 :             VariablePtr variable( new Variable() );
    1144           0 :             variable->setTagName( "variable" );
    1145           0 :             variable->setName( variableName );
    1146           0 :             variable->setClassName( className );
    1147           0 :             variable->setResetGroup( resetGroup );
    1148           0 :             variable->setIncrementGroup( incrementGroup );
    1149             : 
    1150           0 :             if (resetType == "None") {
    1151           0 :                 variable->setResetType(VariableResetType::None);
    1152           0 :             } else if (resetType == "Report") {
    1153           0 :                 variable->setResetType(VariableResetType::Report);
    1154           0 :             } else if (resetType == "Page") {
    1155           0 :                 variable->setResetType(VariableResetType::Page);
    1156           0 :             } else if (resetType == "Column") {
    1157           0 :                 variable->setResetType(VariableResetType::Column);
    1158           0 :             } else if (resetType == "Group") {
    1159           0 :                 variable->setResetType(VariableResetType::Group);
    1160             :             }
    1161             : 
    1162           0 :             if (incrementType == "None") {
    1163           0 :                 variable->setIncrementType(VariableIncrementType::None);
    1164           0 :             } else if (incrementType == "Report") {
    1165           0 :                 variable->setIncrementType(VariableIncrementType::Report);
    1166           0 :             } else if (incrementType == "Page") {
    1167           0 :                 variable->setIncrementType(VariableIncrementType::Page);
    1168           0 :             } else if (incrementType == "Column") {
    1169           0 :                 variable->setIncrementType(VariableIncrementType::Column);
    1170           0 :             } else if (incrementType == "Group") {
    1171           0 :                 variable->setIncrementType(VariableIncrementType::Group);
    1172             :             }
    1173             : 
    1174           0 :             if (calculation == "Count") {
    1175           0 :                 variable->setCalculation(VariableCalculation::Count);
    1176           0 :             } else if (calculation == "Sum") {
    1177           0 :                 variable->setCalculation(VariableCalculation::Sum);
    1178           0 :             } else if (calculation == "Average") {
    1179           0 :                 variable->setCalculation(VariableCalculation::Average);
    1180           0 :             } else if (calculation == "Lowest") {
    1181           0 :                 variable->setCalculation(VariableCalculation::Lowest);
    1182           0 :             } else if (calculation == "Highest") {
    1183           0 :                 variable->setCalculation(VariableCalculation::Highest);
    1184             :             }
    1185           0 :             report->addVaraible(variable);
    1186           0 :             if( !parseChilds( reader, variable ) )
    1187             :             {
    1188           0 :                 return false;
    1189             :             }
    1190           0 :             return !reader.hasError();
    1191             :         }
    1192             : 
    1193           0 :         bool ParserFromXML::parseVariableExpression(QXmlStreamReader &reader, const VariablePtr &variable)
    1194             :         {
    1195           0 :             QString text;
    1196           0 :             if (!getValue(reader, text)) {
    1197           0 :                 return false;
    1198             :             }
    1199           0 :             variable->setExpression(text);
    1200           0 :             return !reader.hasError();
    1201             :         }
    1202             : 
    1203           0 :         bool ParserFromXML::parseInitialValueExpression(QXmlStreamReader &reader, const VariablePtr &variable)
    1204             :         {
    1205           0 :             QString text;
    1206           0 :             if (!getValue(reader, text)) {
    1207           0 :                 return false;
    1208             :             }
    1209           0 :             variable->setValue(text);
    1210           0 :             return !reader.hasError();
    1211             :         }
    1212             : 
    1213             : 
    1214          29 :         bool    ParserFromXML::parseQueryString( QXmlStreamReader & reader, const ReportPtr & report )
    1215             :         {
    1216          58 :             QString text;
    1217          29 :             if( !getValue( reader, text ) )
    1218             :             {
    1219           0 :                 return false;
    1220             :             }
    1221             : 
    1222          29 :             report->setQuery( text );
    1223          29 :             report->setTagName( "queryString" );
    1224             : 
    1225          29 :             return !reader.hasError();
    1226             :         }
    1227             : 
    1228          43 :         const ReportPtr     ParserFromXML::getReport() const
    1229             :         {
    1230          43 :             return m_report;
    1231             :         }
    1232             : 
    1233          15 :         const QString       ParserFromXML::getLastError() const
    1234             :         {
    1235          15 :             return m_lastError;
    1236             :         }
    1237             : 
    1238           3 :         const QString       ParserFromXML::getLog() const
    1239             :         {
    1240           3 :             return *m_log.string();
    1241             :         }
    1242             : 
    1243             :     }
    1244             : }

Generated by: LCOV version 1.14-2-gaa56a43