本文整理汇总了C++中DOMString::length方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMString::length方法的具体用法?C++ DOMString::length怎么用?C++ DOMString::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMString
的用法示例。
在下文中一共展示了DOMString::length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: formatForDebugger
void ElementImpl::formatForDebugger(char *buffer, unsigned length) const
{
DOMString result;
DOMString s;
s = nodeName();
if (s.length() > 0) {
result += s;
}
s = getAttribute(ATTR_ID);
if (s.length() > 0) {
if (result.length() > 0)
result += "; ";
result += "id=";
result += s;
}
s = getAttribute(ATTR_CLASS);
if (s.length() > 0) {
if (result.length() > 0)
result += "; ";
result += "class=";
result += s;
}
strncpy(buffer, result.string().latin1(), length - 1);
}
示例2: setPrefix
void ElementNSImpl::setPrefix(const DOMString &prefix)
{
DOMString xml = NodeImpl::getXmlString();
DOMString xmlURI = NodeImpl::getXmlURIString();
if (ownerDocument->getErrorChecking()) {
if (isReadOnly()) {
throw DOM_DOMException(
DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,
null);
}
if (prefix != null && !((DocumentImpl *)this->getOwnerDocument())->isXMLName(prefix)) {
throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,
null);
}
if (namespaceURI == null) {
throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
}
}
if (prefix == null || prefix.length() == 0) {
name = localName;
return;
}
if (ownerDocument->getErrorChecking() &&
(prefix.equals(xml) && !namespaceURI.equals(xmlURI))) {
throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
}
const XMLCh *p = prefix.rawBuffer();
for (int i = prefix.length(); --i >= 0;)
if (*p++ == chColon) //prefix is malformed
throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
name = prefix + chColon + localName; //nodeName is changed too
}
示例3: if
EppCommandInfoLaunchRegistration* EppCommandInfoLaunchRegistration::fromXML( const DOMNode& root )
{
EppCommandInfoLaunchRegistration* cmd = new EppCommandInfoLaunchRegistration();
if( cmd == null )
{
return null;
}
DOMNodeList* list = root.getChildNodes();
DOMNamedNodeMap* attrs = root.getAttributes();
for( unsigned int i = 0; i < list->getLength(); i++ )
{
DOMNode* node = list->item(i);
DOMString name = node->getLocalName();
if( name.isNull() )
{
name = node->getNodeName();
}
if( name.isNull() )
{
continue;
}
if( (name.length() > 7) && name.substringData(0, 7).equals("launch:") )
{
name = name.substringData(7, name.length() - 7);
}
if( name.equals("phase") )
{
EppLaunchPhase *_pptr = EppLaunchPhase::fromXML(*node);
if( null != _pptr )
{
cmd->_phase = *_pptr;
delete _pptr;
}
_pptr = null;
}
else if ( name.equals("applicationID") )
{
cmd->_appId = EppUtil::getText(*node);
}
}
for( unsigned int i = 0;i<attrs->getLength();i++ )
{
DOMNode* attr = attrs->item(i);
if( XS(attr->getNodeName()).equals("includeMark") )
{
DOMString _v = attr->getNodeValue();
if( _v.length() > 0 )
{
if( _v.equals("true") )
{
cmd->includeMark(true);
}
}
break;
}
}
return cmd;
}
示例4: strncmp
bool DOM::strncmp( const DOMString &a, const DOMString &b, unsigned int len)
{
if(a.length() < len || b.length() < len) return false;
if(memcmp(a.unicode(), b.unicode(), len*sizeof(QChar)))
return true;
return false;
}
示例5:
bool DOM::operator==( const DOMString &a, const DOMString &b )
{
unsigned int l = a.length();
if( l != b.length() ) return false;
if(!memcmp(a.unicode(), b.unicode(), l*sizeof(QChar)))
return true;
return false;
}
示例6: strcasecmp
bool DOM::strcasecmp( const DOMString &as, const DOMString &bs )
{
if ( as.length() != bs.length() ) return true;
const QChar *a = as.unicode();
const QChar *b = bs.unicode();
if ( a == b ) return false;
if ( !( a && b ) ) return true;
int l = as.length();
while ( l-- ) {
if ( *a != *b && a->lower() != b->lower() ) return true;
a++,b++;
}
return false;
}
示例7: initKeyboardEvent
void KeyboardEventImpl::initKeyboardEvent(const DOMString &typeArg, bool canBubbleArg, bool cancelableArg, const AbstractView &viewArg,
const DOMString &keyIdentifierArg, unsigned long keyLocationArg, const DOMString &modifiersList)
{
unsigned keyVal = 0;
unsigned virtKeyVal = 0;
m_keyLocation = keyLocationArg;
// Figure out the code information from the key identifier.
if(keyIdentifierArg.length() == 1)
{
// Likely to be normal unicode id, unless it's one of the few
// special values.
unsigned short code = keyIdentifierArg.unicode()[0];
if(code > 0x20 && code != 0x7F)
keyVal = code;
}
if(!keyVal) // One of special keys, likely.
virtKeyVal = keyIdentifiersToVirtKeys()->toRight(keyIdentifierArg.string().latin1());
// Process modifier list.
QStringList mods = QStringList::split(' ', modifiersList.string().stripWhiteSpace().simplifyWhiteSpace());
unsigned modifiers = 0;
for(QStringList::Iterator i = mods.begin(); i != mods.end(); ++i)
if(unsigned mask = keyModifiersToCode()->toRight((*i).latin1()))
modifiers |= mask;
initKeyBaseEvent(typeArg, canBubbleArg, cancelableArg, viewArg, keyVal, virtKeyVal, modifiers);
}
示例8: getTextAsBool
bool EppUtil::getTextAsBool( const DOMNode &root )
{
DOMString str = getText(root);
unsigned int length = str.length();
if ( length == 1 && (str.charAt(0) == (XMLCh)'1') )
{
return true;
}
else if ( length == 4 )
{
XMLCh c;
c = str.charAt(0);
if ( c != (XMLCh)'t' && c != (XMLCh)'T' )
return false;
c = str.charAt(1);
if ( c != (XMLCh)'r' && c != (XMLCh)'R' )
return false;
c = str.charAt(2);
if ( c != (XMLCh)'u' && c != (XMLCh)'U' )
return false;
c = str.charAt(3);
if ( c != (XMLCh)'e' && c != (XMLCh)'E' )
return false;
return true;
}
return false;
}
示例9: getPropertyCSSValue
CSSValue CSSStyleDeclaration::getPropertyCSSValue( const DOMString &propertyName ) const
{
if(!impl) return 0;
int id = getPropertyID(propertyName.string().ascii(), propertyName.length());
if (!id) return 0;
return static_cast<CSSStyleDeclarationImpl *>(impl)->getPropertyCSSValue(id);
}
示例10: parseString
bool CSSStyleSheetImpl::parseString(const DOMString &string, bool strict)
{
strictParsing = strict;
const QString preprocessed = preprocess(string.string());
#ifdef CSS_STYLESHEET_DEBUG
kdDebug( 6080 ) << "parsing sheet, len=" << string.length() << ", sheet is " << string.string() << endl;
#endif
const QChar *curP = preprocessed.unicode();
const QChar *endP = preprocessed.unicode() + preprocessed.length();
#ifdef CSS_STYLESHEET_DEBUG
kdDebug( 6080 ) << "preprocessed sheet, len=" << preprocessed.length() << ", sheet is " << preprocessed << endl;
#endif
while (curP && (curP < endP))
{
CSSRuleImpl *rule = parseRule(curP, endP);
if(rule)
{
m_lstChildren->append(rule);
rule->setParent(this);
// rule->init();
}
}
return true;
}
示例11: setProperty
void CSSStyleDeclarationImpl::setProperty ( const DOMString &propertyString)
{
QList<CSSProperty> *props = parseProperties(propertyString.unicode(),
propertyString.unicode()+propertyString.length());
if(!props || !props->count())
{
kdDebug( 6080 ) << "no properties returned!" << endl;
return;
}
props->setAutoDelete(false);
unsigned int i = 0;
if(!m_lstValues) {
m_lstValues = new QList<CSSProperty>;
m_lstValues->setAutoDelete( true );
}
while(i < props->count())
{
//kdDebug( 6080 ) << "setting property" << endl;
CSSProperty *prop = props->at(i);
removeProperty(prop->m_id);
m_lstValues->append(prop);
i++;
}
delete props;
if (m_node)
m_node->setChanged(true);
}
示例12: initTextEvent
void TextEvent::initTextEvent(const DOMString &typeArg,
bool canBubbleArg,
bool cancelableArg,
const AbstractView &viewArg,
long /*detailArg*/,
const DOMString &outputStringArg,
unsigned long keyValArg,
unsigned long virtKeyValArg,
bool /*inputGeneratedArg*/,
bool numPadArg)
{
if (!impl)
throw DOMException(DOMException::INVALID_STATE_ERR);
if (impl->isTextInputEvent()) {
//Initialize based on the outputStringArg or virtKeyValArg.
QString text = outputStringArg.string();
if (outputStringArg.length() == 0 && virtKeyValArg) {
text += QChar((unsigned short)virtKeyValArg);
}
TextEventImpl* tImpl = static_cast<TextEventImpl*>(impl);
tImpl->initTextEvent(typeArg, canBubbleArg, cancelableArg, viewArg, text);
} else {
KeyboardEventImpl* kbImpl = static_cast<KeyboardEventImpl*>(impl);
kbImpl->initKeyboardEvent(typeArg, canBubbleArg, cancelableArg, viewArg,
keyValArg, virtKeyValArg, 0, numPadArg ?
KeyboardEventImpl::DOM_KEY_LOCATION_NUMPAD : KeyboardEventImpl::DOM_KEY_LOCATION_STANDARD);
}
}
示例13: compareString
int DOMString::compareString(const DOMString &other) const
{
// Note: this strcmp does not match the semantics
// of the standard C strcmp. All it needs to do is
// define some less than - equals - greater than ordering
// of strings. How doesn't matter.
//
unsigned int thisLen = length();
unsigned int otherLen = other.length();
if (thisLen < otherLen)
return -1;
if (thisLen > otherLen)
return 1;
if (thisLen == 0)
return 0;
XMLCh *thisP = this->fHandle->fDSData->fData;
XMLCh *otherP = other.fHandle->fDSData->fData;
unsigned int i;
for (i=0; i<thisLen; i++)
{
if (thisP[i] < otherP[i])
return -1;
else if (thisP[i] > otherP[i])
return 1;
}
return 0;
}
示例14: removeProperty
DOMString CSSStyleDeclaration::removeProperty(const DOMString &property)
{
int id = getPropertyID(property.string().ascii(), property.length());
if(!impl || !id)
return DOMString();
return static_cast< CSSStyleDeclarationImpl * >(impl)->removeProperty(id);
}
示例15: toString
DOMString ElementImpl::toString() const
{
QString result = openTagStartToString().string(); // Accumulate in QString, since DOMString can't append well.
if(hasChildNodes())
{
result += ">";
for(NodeImpl *child = firstChild(); child != NULL; child = child->nextSibling())
{
DOMString kid = child->toString();
result += QConstString(kid.unicode(), kid.length()).string();
}
result += "</";
result += tagName().string();
result += ">";
}
else if(result.length() == 1)
{
// ensure we dont get results like < /> can happen when serialize document
result = "";
}
else
{
result += " />";
}
return result;
}