本文整理汇总了C++中AttributeValue类的典型用法代码示例。如果您正苦于以下问题:C++ AttributeValue类的具体用法?C++ AttributeValue怎么用?C++ AttributeValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AttributeValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: blend
void OwnedAttributeValue::blend(const AttributeValue& source, const AttributeValue& dest) {
if (_attribute) {
_attribute->destroy(_value);
}
_attribute = source.getAttribute();
_value = _attribute->blend(source.getValue(), dest.getValue());
}
示例2: mix
void OwnedAttributeValue::mix(const AttributeValue& first, const AttributeValue& second, float alpha) {
if (_attribute) {
_attribute->destroy(_value);
}
_attribute = first.getAttribute();
_value = _attribute->mix(first.getValue(), second.getValue(), alpha);
}
示例3: _AddAttribute
inline PackageWriter::Attribute*
PackageWriter::_AddAttribute(const char* attributeName, Type value)
{
AttributeValue attributeValue;
attributeValue.SetTo(value);
return _AddAttribute(attributeName, attributeValue);
}
示例4: symbol_add
Transformer* CreateGraphicFunc::get_transformer(AttributeList* al) {
static int transform_symid = symbol_add("transform");
AttributeValue* transformv = nil;
Transformer* rel = nil;
AttributeValueList* avl = nil;
if (al &&
(transformv=al->find(transform_symid)) &&
transformv->is_array() &&
(avl=transformv->array_val()) &&
avl->Number()==6) {
float a00, a01, a10, a11, a20, a21;
Iterator it;
avl->First(it); a00=avl->GetAttrVal(it)->float_val();
avl->Next(it); a01=avl->GetAttrVal(it)->float_val();
avl->Next(it); a10=avl->GetAttrVal(it)->float_val();
avl->Next(it); a11=avl->GetAttrVal(it)->float_val();
avl->Next(it); a20=avl->GetAttrVal(it)->float_val();
avl->Next(it); a21=avl->GetAttrVal(it)->float_val();
rel = new Transformer(a00, a01, a10, a11, a20, a21);
} else {
rel = ((OverlayViewer*)_ed->GetViewer())->GetRel();
if (rel != nil) {
rel = new Transformer(rel);
rel->Invert();
}
}
return rel;
}
示例5: loop
void loop() {
int prevSwitchState = switchState;
/* Read the state of the tilt switch. */
switchState = digitalRead(SWITCH_PIN);
/* If state has changed back to low a button press (or a full tilt if using
* a tilt switch) has passed */
if (prevSwitchState == HIGH && switchState == LOW) {
/* Create an Item. */
AttributeValue deviceValue;
deviceValue.setS(HASH_KEY_VALUE);
AttributeValue timeValue;
/* Getting current time for Time attribute. */
timeValue.setN(dateTimeProvider.getDateTime());
MinimalKeyValuePair < MinimalString, AttributeValue
> att1(HASH_KEY_NAME, deviceValue);
MinimalKeyValuePair < MinimalString, AttributeValue
> att2(RANGE_KEY_NAME, timeValue);
MinimalKeyValuePair < MinimalString, AttributeValue
> att3(ATTRIBUTE_KEY_NAME, ATTRIBUTE_KEY_VALUE);
MinimalKeyValuePair<MinimalString, AttributeValue> itemArray[] = { att1,
att2, att3};
/* Set values for putItemInput. */
putItemInput.setItem(MinimalMap < AttributeValue > (itemArray, 2));
putItemInput.setTableName(TABLE_NAME);
/* perform putItem and check for errors. */
PutItemOutput putItemOutput = ddbClient.putItem(putItemInput,
actionError);
switch (actionError) {
case NONE_ACTIONERROR:
Serial.println("PutItem succeeded!");
break;
case INVALID_REQUEST_ACTIONERROR:
Serial.print("ERROR: ");
Serial.println(putItemOutput.getErrorMessage().getCStr());
break;
case MISSING_REQUIRED_ARGS_ACTIONERROR:
Serial.println(
"ERROR: Required arguments were not set for PutItemInput");
break;
case RESPONSE_PARSING_ACTIONERROR:
Serial.println("ERROR: Problem parsing http response of PutItem");
break;
case CONNECTION_ACTIONERROR:
Serial.println("ERROR: Connection problem");
break;
}
/* wait to not double-record */
delay(2000);
}
delay(150);
}
示例6: read_attribute_value
AttributeValue hydrator::read_attribute_value() {
AttributeValue result;
result.value(read_xml_string_attribute(dia_val));
reader_.skip();
BOOST_LOG_SEV(lg, debug) << "Reading generic attribute value: "
<< result.value();
return result;
}
示例7: getAttributes
void AttributeValueList::getAttributes(AttributeList* _attributes)
{
AttributeValue* value;
for (std::list<AttributeValue*>::iterator it = this->begin(); it != this->end(); it++)
{
value = *it;
_attributes->push_back(value->getAttribute());
}
}
示例8: loop
/* This function loops forever --------------------------------------------*/
void loop()
{
//This will run in a loop
rssi = WiFi.RSSI();
/* Create an Item. */
AttributeValue deviceValue;
deviceValue.setS(HASH_KEY_VALUE);
AttributeValue timeValue;
/* Getting current time for Time attribute. */
timeValue.setS(dateTimeProvider.getDateTime());
MinimalKeyValuePair < MinimalString, AttributeValue
> att1(HASH_KEY_NAME, deviceValue);
MinimalKeyValuePair < MinimalString, AttributeValue
> att2(RANGE_KEY_NAME, timeValue);
MinimalKeyValuePair<MinimalString, AttributeValue> itemArray[] = { att1,
att2};
/* Set values for putItemInput. */
putItemInput.setItem(MinimalMap < AttributeValue > (itemArray, 2));
putItemInput.setTableName(TABLE_NAME);
/* perform putItem and check for errors. */
PutItemOutput putItemOutput = ddbClient.putItem(putItemInput,
actionError);
switch (actionError) {
case NONE_ACTIONERROR:
Serial.println("PutItem succeeded!");
Serial.println(myIDStr);
Serial.println(rssi);
break;
case INVALID_REQUEST_ACTIONERROR:
Serial.print("ERROR: ");
Serial.println(putItemOutput.getErrorMessage().getCStr());
break;
case MISSING_REQUIRED_ARGS_ACTIONERROR:
Serial.println(
"ERROR: Required arguments were not set for PutItemInput");
break;
case RESPONSE_PARSING_ACTIONERROR:
Serial.println("ERROR: Problem parsing http response of PutItem");
break;
case CONNECTION_ACTIONERROR:
Serial.println("ERROR: Connection problem");
break;
}
/* wait to not double-record */
delay(5000);
}
示例9: switch
status_t
PackageReaderImpl::ReadAttributeValue(uint8 type, uint8 encoding,
AttributeValue& _value)
{
switch (type) {
case B_HPKG_ATTRIBUTE_TYPE_RAW:
{
uint64 size;
status_t error = ReadUnsignedLEB128(size);
if (error != B_OK)
return error;
if (encoding == B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP) {
uint64 offset;
error = ReadUnsignedLEB128(offset);
if (error != B_OK)
return error;
if (offset > fHeapSize || size > fHeapSize - offset) {
ErrorOutput()->PrintError("Error: Invalid %s section: "
"invalid data reference\n", CurrentSection()->name);
return B_BAD_DATA;
}
_value.SetToData(size, offset);
} else if (encoding == B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE) {
if (size > B_HPKG_MAX_INLINE_DATA_SIZE) {
ErrorOutput()->PrintError("Error: Invalid %s section: "
"inline data too long\n", CurrentSection()->name);
return B_BAD_DATA;
}
const void* buffer;
error = _GetTOCBuffer(size, buffer);
if (error != B_OK)
return error;
_value.SetToData(size, buffer);
} else {
ErrorOutput()->PrintError("Error: Invalid %s section: invalid "
"raw encoding (%u)\n", CurrentSection()->name, encoding);
return B_BAD_DATA;
}
return B_OK;
}
default:
return inherited::ReadAttributeValue(type, encoding, _value);
}
}
示例10: Unref
void OverlayComp::SetAttributeList(AttributeList* al) {
if (_attrlist)
Unref(_attrlist);
_attrlist = al;
Resource::ref(_attrlist);
#if 0 // experimentation with attribute changing
if (al) {
static int hidden_symid = symbol_find("hidden");
AttributeValue* av = al->find(hidden_symid);
if (av)
_gr->Hide(av->is_true());
}
#endif
Observable::notify();
}
示例11: objv
void TransformerFunc::execute() {
ComValue objv(stack_arg(0));
ComValue transv(stack_arg(0));
reset_stack();
if (objv.object_compview()) {
ComponentView* compview = (ComponentView*)objv.obj_val();
if (compview && compview->GetSubject()) {
OverlayComp* comp = (OverlayComp*)compview->GetSubject();
Graphic* gr = comp->GetGraphic();
if (gr) {
Transformer* trans = gr->GetTransformer();
if (transv.is_unknown() || !transv.is_array() || transv.array_val()->Number()!=6) {
AttributeValueList* avl = new AttributeValueList();
float a00, a01, a10, a11, a20, a21;
trans->matrix(a00, a01, a10, a11, a20, a21);
avl->Append(new AttributeValue(a00));
avl->Append(new AttributeValue(a01));
avl->Append(new AttributeValue(a10));
avl->Append(new AttributeValue(a11));
avl->Append(new AttributeValue(a20));
avl->Append(new AttributeValue(a21));
ComValue retval(avl);
push_stack(retval);
} else {
float a00, a01, a10, a11, a20, a21;
AttributeValueList* avl = transv.array_val();
Iterator it;
AttributeValue* av;
avl->First(it);
av = avl->GetAttrVal(it);
a00 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a01 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a10 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a11 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a20 = av->float_val();
avl->Next(it);
av = avl->GetAttrVal(it);
a21 = av->float_val();
Transformer t(a00, a01, a10, a11, a20, a21);
*gr->GetTransformer()=t;
ComValue compval(new OverlayViewRef(comp), comp->class_symid());
push_stack(compval);
}
}
}
}
}
示例12: beginInsertRows
void AttributeListModel::setAttribute(int id, qreal base, qreal mod)
{
AttributeValue *value = mAttributeValues.value(id);
bool needInsert = (value == 0);
if (needInsert) {
beginInsertRows(QModelIndex(), mAttributeValues.size(),
mAttributeValues.size());
value = mAttributeValues[id] = new AttributeValue(id, this);
mCachedAttributeList.append(value);
}
value->setBase(base);
value->setModified(mod);
if (needInsert) {
endInsertRows();
emit attributeAdded(id, value);
}
}
示例13: David_McClarnon
/********************************************************************************************
> static CCAttrMap * CCAttrMap::MakeAttrMapFromRenderRegion(RenderRegion * pRegion)
Author: David_McClarnon (Xara Group Ltd) <[email protected]>
Created: 24/2/2000
Inputs: The render region to get the attribute map from
Outputs: An attribute map (copied) from the render region
Returns: -
Purpose: Makes an attribute out of the render region's current attribute state
Notes: You MUST call DeleteAttributes afterwards to release memory - delete is
not sufficient
SeeAlso: -
********************************************************************************************/
CCAttrMap * CCAttrMap::MakeAttrMapFromRenderRegion(RenderRegion * pRegion)
{
CCAttrMap * pMap = new CCAttrMap;
ENSURE(pMap,"No mem for attrmap");
if(!pMap)
return NULL;
// let's get every attribute in the render region
AttributeValue * pAttrVal = NULL;
NodeAttribute * pNewAttr = NULL;
for (UINT32 i = 0; i < ATTR_FIRST_FREE_ID; i++)
{
pAttrVal = pRegion->GetCurrentAttribute(i);
// make a new node out of this attribute value
pNewAttr = pAttrVal->MakeNode();
// Karim 12/04/2000
// AttributeValues _do_not_have_to_have_ a corresponding NodeAttribute,
// so can we please *check* that MakeNode didn't just return NULL!
if (pNewAttr != NULL)
{
if(!pNewAttr->IsLinkedToNodeGeometry())
pMap->SetAt(pNewAttr->GetAttributeType(),pNewAttr);
else
{
delete pNewAttr;
pNewAttr = AttributeManager::GetDefaultAttribute((AttrIndex) i);
if(pNewAttr)
{
ENSURE(pNewAttr->IsLinkedToNodeGeometry(),"Incorrect NodeAttribute returned by GetDefaultAttribute");
pMap->SetAt(pNewAttr->GetAttributeType(), pNewAttr);
}
else
return NULL;
}
}
}
pMap->attrMapCreator = NULL;
return pMap;
}
示例14: Variable
void Context::addAttributes( std::map<text::attributes::AttributeKey,text::attributes::AttributeValue> & attributes, const Alternative::BindingMap & bindings ) const {
for ( Alternative::BindingMap::const_iterator it = bindings.begin(), e = bindings.end(); it != e; ++ it ) {
Expression::ValueListPtr v = it->second->evaluate( 0, Variable(), *this );
AttributeKey key = it->first;
AttributeValue value = v->empty() ? AttributeValue::UNDEFINED : v->back();
if ( key == AttributeKey::UNDEFINED ) {
for ( uint attr = 0; attr < AttributeKey::count(); ++ attr ) {
AttributeKey k = AttributeKey( attr );
AttributeValue v = value.getContainer().getAttribute( k );
if ( v != AttributeValue::UNDEFINED )
attributes.insert( std::make_pair( k, v ) );
}
} else {
attributes.insert( std::make_pair( key, value ) );
}
}
}
示例15: SaveCurrentFill
BOOL FreeHandEPSFilter::SaveCurrentFill()
{
// get rid of any stored fill
if(OldFill != 0)
delete OldFill;
// create a copy of the current fill attribute
CCRuntimeClass* ObjectType = CurrentAttrs[ATTR_FILLGEOMETRY].pAttr->GetRuntimeClass();
AttributeValue* AttrClone = (AttributeValue*)ObjectType->CreateObject();
if(AttrClone == 0)
return FALSE;
AttrClone->SimpleCopy(CurrentAttrs[ATTR_FILLGEOMETRY].pAttr);
// set the old fill pointer to the nice clone we've made
OldFill = AttrClone;
return TRUE;
}