本文整理汇总了C++中PP_AttrProp::_clearEmptyProperties方法的典型用法代码示例。如果您正苦于以下问题:C++ PP_AttrProp::_clearEmptyProperties方法的具体用法?C++ PP_AttrProp::_clearEmptyProperties怎么用?C++ PP_AttrProp::_clearEmptyProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PP_AttrProp
的用法示例。
在下文中一共展示了PP_AttrProp::_clearEmptyProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*! Create a new AttrProp based upon the given one, adding or replacing the items given.
\return NULL on failure, the newly-created PP_AttrProp clone otherwise.
*/
PP_AttrProp * PP_AttrProp::cloneWithReplacements(const gchar ** attributes,
const gchar ** properties,
bool bClearProps) const
{
bool bIgnoreProps = false; // see below
// first, create a new AttrProp using just the values given.
PP_AttrProp * papNew = new PP_AttrProp();
if (!papNew)
goto Failed;
if (!papNew->setAttributes(attributes) || !papNew->setProperties(properties))
goto Failed;
// next, add any items that we have that are not present
// (have not been overridden) in the new one.
UT_uint32 k;
const gchar * n;
const gchar * v;
const gchar * vNew;
k = 0;
while (getNthAttribute(k++,n,v))
{
// TODO decide if/whether to allow PT_PROPS_ATTRIBUTE_NAME here.
// TODO The issue is: we use it to store the CSS properties and
// TODO when we see it, we expand the value into one or more
// TODO properties. if we allow it to be given here, should
// TODO we blowaway all of the existing properties and create
// TODO them from this? or should we expand it and override
// TODO individual properties?
// TODO for now, we just barf on it.
UT_return_val_if_fail (strcmp(n,PT_PROPS_ATTRIBUTE_NAME)!=0, false); // cannot handle PROPS here
if (!papNew->getAttribute(n,vNew))
if (!papNew->setAttribute(n,v))
goto Failed;
}
// we want to be able to remove all properties by setting the
// props attribute to ""; in order for that to work, we need to
// skip the following loop if props is set to ""
const gchar * szValue;
if(papNew->getAttribute("props", szValue) && !*szValue)
bIgnoreProps = true;
if (!bClearProps && !bIgnoreProps)
{
k = 0;
while (getNthProperty(k++,n,v))
{
if (!papNew->getProperty(n,vNew))
if (!papNew->setProperty(n,v))
goto Failed;
}
}
// the following will remove all properties set to ""; this allows us
// to remove properties by setting them to ""
papNew->_clearEmptyProperties();
papNew->_clearEmptyAttributes();
return papNew;
Failed:
DELETEP(papNew);
return NULL;
}