MCPcopy Create free account
hub / github.com/buggins/coolreader / testAuthorDotTitleFormat

Method testAuthorDotTitleFormat

crengine/src/lvxml.cpp:1564–1583  ·  view source on GitHub ↗

Leo Tolstoy. War and Peace

Source from the content-addressed store, hash-verified

1562
1563 // Leo Tolstoy. War and Peace
1564 bool testAuthorDotTitleFormat()
1565 {
1566 int i = 0;
1567 for ( ; i<length() && get(i)->rpos==0; i++ )
1568 ;
1569 if ( i>=length() )
1570 return false;
1571 bookTitle.clear();
1572 bookAuthors.clear();
1573 lString16 firstLine = get(i)->text;
1574 firstLine.trim();
1575 int dotPos = firstLine.pos(L". ");
1576 if ( dotPos<=0 )
1577 return false;
1578 bookAuthors = firstLine.substr( 0, dotPos );
1579 bookTitle = firstLine.substr( dotPos + 2, firstLine.length() - dotPos - 2);
1580 if ( bookTitle.empty() || (lGetCharProps(bookTitle[bookTitle.length()]) & CH_PROP_PUNCT) )
1581 return false;
1582 return true;
1583 }
1584
1585 /// check beginning of file for book title, author and series
1586 bool DetectBookDescription(LVXMLParserCallback * callback)

Callers

nothing calls this directly

Calls 7

lGetCharPropsFunction · 0.85
clearMethod · 0.45
trimMethod · 0.45
posMethod · 0.45
substrMethod · 0.45
lengthMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected