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

Method getObjectImageRefName

crengine/src/lvtinydom.cpp:10541–10580  ·  view source on GitHub ↗

returns object image ref name

Source from the content-addressed store, hash-verified

10539
10540/// returns object image ref name
10541lString16 ldomNode::getObjectImageRefName()
10542{
10543 if ( !this || !isElement() )
10544 return lString16();
10545 //printf("ldomElement::getObjectImageSource() ... ");
10546 const css_elem_def_props_t * et = getDocument()->getElementTypePtr(getNodeId());
10547 if (!et || !et->is_object)
10548 return lString16();
10549 lUInt16 hrefId = getDocument()->getAttrNameIndex(L"href");
10550 lUInt16 srcId = getDocument()->getAttrNameIndex(L"src");
10551 lUInt16 recIndexId = getDocument()->getAttrNameIndex(L"recindex");
10552 lString16 refName = getAttributeValue( getDocument()->getNsNameIndex(L"xlink"),
10553 hrefId );
10554
10555 if ( refName.empty() )
10556 refName = getAttributeValue( getDocument()->getNsNameIndex(L"l"), hrefId );
10557 if ( refName.empty() )
10558 refName = getAttributeValue( LXML_NS_ANY, hrefId ); //LXML_NS_NONE
10559 if ( refName.empty() )
10560 refName = getAttributeValue( LXML_NS_ANY, srcId ); //LXML_NS_NONE
10561 if (refName.empty()) {
10562 lString16 recindex = getAttributeValue( LXML_NS_ANY, recIndexId );
10563 if (!recindex.empty()) {
10564 int n;
10565 if (recindex.atoi(n)) {
10566 refName = lString16(MOBI_IMAGE_NAME_PREFIX) + lString16::itoa(n);
10567 //CRLog::debug("get mobi image %s", LCSTR(refName));
10568 }
10569 }
10570// else {
10571// for (int k=0; k<getAttrCount(); k++) {
10572// CRLog::debug("attr %s=%s", LCSTR(getAttributeName(k)), LCSTR(getAttributeValue(getAttributeName(k).c_str())));
10573// }
10574// }
10575 }
10576 if ( refName.length()<2 )
10577 return lString16();
10578 refName = DecodeHTMLUrlString(refName);
10579 return refName;
10580}
10581
10582
10583/// returns object image stream

Callers

nothing calls this directly

Calls 8

lString16Class · 0.85
DecodeHTMLUrlStringFunction · 0.85
getAttrNameIndexMethod · 0.80
getNsNameIndexMethod · 0.80
atoiMethod · 0.80
getElementTypePtrMethod · 0.45
emptyMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected