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

Method getFirstTextChild

crengine/src/lvtinydom.cpp:9844–9869  ·  view source on GitHub ↗

returns first text child element

Source from the content-addressed store, hash-verified

9842
9843/// returns first text child element
9844ldomNode * ldomNode::getFirstTextChild(bool skipEmpty)
9845{
9846 ASSERT_NODE_NOT_NULL;
9847 if ( isText() ) {
9848 if ( !skipEmpty )
9849 return this;
9850 lString16 txt = getText();
9851 bool nonSpaceFound = false;
9852 for ( unsigned i=0; i<txt.length(); i++ ) {
9853 lChar16 ch = txt[i];
9854 if ( ch!=' ' && ch!='\t' && ch!='\r' && ch!='\n' ) {
9855 nonSpaceFound = true;
9856 break;
9857 }
9858 }
9859 if ( nonSpaceFound )
9860 return this;
9861 return NULL;
9862 }
9863 for ( int i=0; i<(int)getChildCount(); i++ ) {
9864 ldomNode * p = getChildNode(i)->getFirstTextChild(skipEmpty);
9865 if (p)
9866 return p;
9867 }
9868 return NULL;
9869}
9870
9871/// returns last text child element
9872ldomNode * ldomNode::getLastTextChild()

Callers 2

createXPointerMethod · 0.80
runBasicTinyDomUnitTestsFunction · 0.80

Calls 1

lengthMethod · 0.45

Tested by

no test coverage detected