THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_id,"id"); createAttribute(attrib_name,"name"); /** children**/ buildChildren(Types()); /** other **/ Bool_array* bool_array =0; Float_array* float_array =0; IDREF_array* idref_array =0; Int_array* int_array =0; Name_array* name_array =0; SIDREF_array* sidref_array =0; Token_array* token_array =0; if(queryElement(bool_array)){type = BOOL_ARRAY;} if(queryElement(float_array)){type = FLOAT_ARRAY;} if(queryElement(idref_array)){type = IDREF_ARRAY;} if(queryElement(int_array)){type = INT_ARRAY;} if(queryElement(name_array)){type = NAME_ARRAY;} if(queryElement(sidref_array)){type = SIDREF_ARRAY;} if(queryElement(token_array)){type = TOKEN_ARRAY;} }
IAttribute* HeaderBlock::createAttribute(const AxisChar *localname, const AxisChar *prefix, const AxisChar *value) { #ifdef ENABLE_AXISTRACE if (axiscpp::AxisTrace::isTraceOn()) axiscpp::AxisTrace::traceEntry("HeaderBlock", "createAttribute", this, 3, TRACETYPE_STRING, 0, ((void*)&localname), TRACETYPE_STRING, 0, ((void*)&prefix), TRACETYPE_STRING, 0, ((void*)&value)); /* AUTOINSERTED TRACE */ #endif { #ifdef ENABLE_AXISTRACE IAttribute* traceRet = (createAttribute(localname, prefix, NULL, value)); if (axiscpp::AxisTrace::isTraceOn()) axiscpp::AxisTrace::traceExit("HeaderBlock", "createAttribute", this, 0, TRACETYPE_POINTER, sizeof(IAttribute), ((void*)&traceRet)); /* AUTOINSERTED TRACE */ return traceRet; #else return createAttribute(localname, prefix, NULL, value); #endif } }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_semantic,"semantic"); createAttribute(attrib_source,"source"); /* children */ }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_enable,"enable"); createAttribute(attrib_sid,"sid"); createAttribute(attrib_name,"name"); /* children */ buildChildren(Types()); }
THIS::THIS(XmlElement* h):Element(h) { /* attributes */ createAttribute(attrib_id,"id"); createAttribute(attrib_name,"name"); /** children**/ buildChildren(Types()); }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_name ,"name"); createAttribute(attrib_count,"count"); createAttribute(attrib_material,"material"); /* children */ buildChildren(Types()); }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_ref,"ref"); createAttribute(attrib_pass,"pass"); /* children */ buildChildren(Types()); /* data */ }
THIS::THIS(XmlElement* h):Element(h) { /* attributes */ createAttribute(attrib_id,"id"); createAttribute(attrib_platform,"platform"); /* children */ buildChildren(Types()); /* data */ }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_texture,"texture"); createAttribute(attrib_texcoord,"texcoord"); /* children */ buildChildren(Types()); /* data */ }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_source,"source"); createAttribute(attrib_operand,"operand",Enum::SRC_ALPHA); createAttribute(attrib_sampler,"sampler"); /* children */ buildChildren(Types()); /* data */ }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_index,"index"); createAttribute(attrib_slice,"slice"); createAttribute(attrib_mip,"mip"); createAttribute(attrib_face,"face"); /* children */ buildChildren(Types()); /* data */ }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_sid,"sid"); createAttribute(attrib_name,"name"); createAttribute(attrib_constraint,"constraint"); /* children */ buildChildren(Types()); /* data */ }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_count,"count"); createAttribute(attrib_id,"id"); createAttribute(attrib_name,"name"); /* children */ XmlElement* element = handle; if(element){ Utils::fromString(values,element->getText()); } }
TEST_F(AttrTest, LengthOfContents) { RawPtr<Attr> attr = createAttribute(); EXPECT_EQ(0u, attr->lengthOfContents()); attr->setValue(value()); EXPECT_EQ(0u, attr->lengthOfContents()); }
TEST_F(AttrTest, InitialValueState) { RawPtr<Attr> attr = createAttribute(); EXPECT_EQ(emptyAtom, attr->value()); EXPECT_EQ(emptyString(), attr->toNode()->nodeValue()); EXPECT_EQ(String(), attr->textContent()); }
void Element::setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode& ec) { if (!Document::isValidName(name)) { ec = INVALID_CHARACTER_ERR; return; } const AtomicString& localName = (shouldIgnoreAttributeCase(this) && !name.string().impl()->isLower()) ? AtomicString(name.string().lower()) : name; // allocate attributemap if necessary Attribute* old = attributes(false)->getAttributeItem(localName, false); document()->incDOMTreeVersion(); if (localName == idAttr.localName()) updateId(old ? old->value() : nullAtom, value); if (old && value.isNull()) namedAttrMap->removeAttribute(old->name()); else if (!old && !value.isNull()) namedAttrMap->addAttribute(createAttribute(QualifiedName(nullAtom, localName, nullAtom), value)); else if (old && !value.isNull()) { old->setValue(value); attributeChanged(old); } }
MetaAttribute &MetaRecord::createAttribute(const std::string &inAttributeName, CSSM_DB_ATTRIBUTE_FORMAT inAttributeFormat) { uint32 anAttributeId = mAttributeVector.size() - 1; return createAttribute(&inAttributeName, NULL, anAttributeId, inAttributeFormat); }
TEST_F(AttrTest, SetNodeValue) { RawPtr<Attr> attr = createAttribute(); attr->toNode()->setNodeValue(value()); EXPECT_EQ(value(), attr->value()); EXPECT_EQ(value(), attr->toNode()->nodeValue()); // Node::textContent() always returns String() for Attr. EXPECT_EQ(String(), attr->textContent()); }
TEST_F(AttrTest, SetTextContent) { RawPtr<Attr> attr = createAttribute(); // Node::setTextContent() does nothing for Attr. attr->setTextContent(value()); EXPECT_EQ(emptyAtom, attr->value()); EXPECT_EQ(emptyString(), attr->toNode()->nodeValue()); EXPECT_EQ(String(), attr->textContent()); }
/** * Slot for the context menu by right clicking in the tree widget. * @param p point of the right click inside the tree widget */ void RefactoringAssistant::showContextMenu(const QPoint& p) { QTreeWidgetItem* item = itemAt(p); if (!item) { return; } m_menu->clear(); UMLObject *obj = findUMLObject(item); if (obj) { // Menu for UMLObjects UMLObject::ObjectType t = obj->baseType(); if (t == UMLObject::ot_Class) { m_menu->addAction(createAction(i18n("Add Base Class"), SLOT(addBaseClassifier()), Icon_Utils::it_Generalisation)); m_menu->addAction(createAction(i18n("Add Derived Class"), SLOT(addDerivedClassifier()), Icon_Utils::it_Uniassociation)); // m_menu->addAction(createAction(i18n("Add Interface Implementation"), SLOT(addInterfaceImplementation()), Icon_Utils::it_Implementation)); m_menu->addAction(createAction(i18n("Add Operation"), SLOT(createOperation()), Icon_Utils::it_Public_Method)); m_menu->addAction(createAction(i18n("Add Attribute"), SLOT(createAttribute()), Icon_Utils::it_Public_Attribute)); } else if (t == UMLObject::ot_Interface) { m_menu->addAction(createAction(i18n("Add Base Interface"), SLOT(addSuperClassifier()), Icon_Utils::it_Generalisation)); m_menu->addAction(createAction(i18n("Add Derived Interface"), SLOT(addDerivedClassifier()), Icon_Utils::it_Uniassociation)); m_menu->addAction(createAction(i18n("Add Operation"), SLOT(createOperation()), Icon_Utils::it_Public_Method)); } // else { // DEBUG(DBG_SRC) << "No context menu for objects of type " << typeid(*obj).name(); // return; // } m_menu->addSeparator(); m_menu->addAction(createAction(i18n("Properties"), SLOT(editProperties()), Icon_Utils::it_Properties)); m_menu->addAction(createAction(i18n("Delete"), SLOT(deleteItem()), Icon_Utils::it_Delete)); } else { //menu for other ViewItems if (item->text(1) == QLatin1String("operations")) { m_menu->addAction(createAction(i18n("Add Operation"), SLOT(createOperation()), Icon_Utils::it_Public_Method)); } else if (item->text(1) == QLatin1String("attributes")) { m_menu->addAction(createAction(i18n("Add Attribute"), SLOT(createAttribute()), Icon_Utils::it_Public_Attribute)); } else { uWarning() << "Called for unsupported item."; return; } } m_menu->exec(mapToGlobal(p) + QPoint(0, 20)); }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_count,"count"); /** children**/ buildChildren(Types()); }
IHqlExpression * createLocationAttr(ISourcePath * sourcePath, int lineno, int column, int position) { HqlExprArray args; args.append(*getSizetConstant(lineno)); args.append(*getSizetConstant(column)); args.append(*getSizetConstant(position)); if (sourcePath) args.append(*createUnknown(no_attr, makeNullType(), filenameAtom, LINK(sourcePath))); return createAttribute(_location_Atom, args); }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_link,"link"); /* children */ buildChildren(Types()); /* data */ }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_count,"count"); createAttribute(attrib_id,"id"); createAttribute(attrib_name,"name"); /* data */ XmlElement* element = handle; if(element){ std::vector<std::string> strings; Utils::fromString(strings,element->getText()); std::vector<std::string>::iterator iter; for(iter = strings.begin(); iter != strings.end(); iter++){ values.push_back((*iter) == "true" ? true : false); } } }
IHqlExpression * buildDiskFileViewerEcl(const char * logicalName, IHqlExpression * record) { //Add filepos to the incomming record structure... IHqlExpression * filePosAttr = createAttribute(virtualAtom, createAttribute(filepositionAtom)); OwnedHqlExpr filepos = createField(fileposName, makeIntType(8, false), NULL, filePosAttr); IHqlExpression * sizeofAttr = createAttribute(virtualAtom, createAttribute(sizeofAtom)); OwnedHqlExpr reclen = createField(recordlenName, makeIntType(2, false), NULL, sizeofAttr); HqlExprArray fields; unwindChildren(fields, record); fields.append(*filepos.getLink()); fields.append(*reclen.getLink()); OwnedHqlExpr newRecord = createRecord(fields); newRecord.setown(createSymbol(createIdentifierAtom("_SourceRecord_"), newRecord.getLink(), ob_private)); OwnedHqlExpr dataset = createNewDataset(createConstant(logicalName), newRecord.getLink(), createValue(no_thor), NULL, NULL, NULL); OwnedHqlExpr filtered = addFilter(dataset, filepos); OwnedHqlExpr projected = addSimplifyProject(filtered); OwnedHqlExpr output = addOutput(projected); return output.getClear(); }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_sid,"sid"); /** children**/ /* data */ XmlElement* element = handle; if(element){ Utils::fromString(value,element->getText()); } }
THIS::THIS(XmlElement* h):Element(h){ /* attributes */ createAttribute(attrib_sid,"sid"); /* children */ buildChildren(Types()); /* data */ XmlElement* element = handle; if(element){ Utils::fromString(data,element->getText()); } }
void Element::setAttribute(const QualifiedName& name, const AtomicString& value, ExceptionCode&) { document()->incDOMTreeVersion(); // allocate attributemap if necessary Attribute* old = attributes(false)->getAttributeItem(name); if (name == idAttr) updateId(old ? old->value() : nullAtom, value); if (old && value.isNull()) namedAttrMap->removeAttribute(name); else if (!old && !value.isNull()) namedAttrMap->addAttribute(createAttribute(name, value)); else if (old) { old->setValue(value); attributeChanged(old); } }
/** * @deprecated do not use! */ int createAttribute(const char* aAttrName, KeyType aTupleKey, int aAttrSize, int aArraySize, AttrType aAttrType, StorageMode aStorageMode, NullAttributeType aNullAttr, int aStType, // obsolete int aDistributionKey = 0, int aDistributionGroup = 0, int aDistributionGroupNoOfBits = 16){ return createAttribute(aAttrName, aTupleKey, aAttrSize, aArraySize, aAttrType, aStorageMode, aNullAttr == NullAttribute, aStType, aDistributionKey, aDistributionGroup, aDistributionGroupNoOfBits); }
IHqlExpression * PositionTransformer::createTransformed(IHqlExpression * _expr) { OwnedHqlExpr transformed = NewHqlTransformer::createTransformed(_expr); switch (transformed->getOperator()) { case no_table: { IHqlExpression * mode = transformed->queryChild(2); HqlExprArray fields; HqlExprArray args; if (mode->getOperator() == no_thor) { unwindChildren(fields, transformed->queryChild(1)); IHqlExpression * filePosAttr = createComma(createAttribute(virtualAtom, createAttribute(filepositionAtom)), insertedAttr.getLink()); IHqlExpression * sizeofAttr = createComma(createAttribute(virtualAtom, createAttribute(sizeofAtom)), insertedAttr.getLink()); fields.append(*createField(fileposName, makeIntType(8, false), NULL, filePosAttr)); fields.append(*createField(recordlenName, makeIntType(2, false), NULL, sizeofAttr)); unwindChildren(args, transformed); args.replace(*createRecord(fields), 1); return transformed->clone(args); } } break; case no_iterate: case no_hqlproject: { HqlExprArray args; HqlExprArray assigns; IHqlExpression * transform = transformed->queryChild(1); unwindChildren(args, transformed); unwindChildren(assigns, transform); IHqlExpression * inRecord = transformed->queryChild(0)->queryRecord(); IHqlExpression * outRecord = transform->queryRecord(); HqlExprArray fields; unwindChildren(fields, outRecord); ForEachChild(idx, inRecord) { IHqlExpression * child = inRecord->queryChild(idx); if (child->hasProperty(insertedAtom)) { IHqlExpression * newTarget = createField(child->queryName(), child->getType(), LINK(child), insertedAttr.getLink()); fields.append(*newTarget); assigns.append(*createValue(no_assign, makeVoidType(), newTarget, createSelectExpr(createValue(no_left), LINK(newTarget)))); } } IHqlExpression * newRecord = createRecord(fields); args.replace(*createValue(no_transform, newRecord->getType(), assigns), 1); return transformed->clone(args); } break; case no_join: //only ok if join first case no_rollup: case no_newaggregate: case no_aggregate: fail(); break; case no_usertable: case no_selectfields: { IHqlExpression * grouping = transformed->queryChild(2); if (grouping && (grouping->getOperator() != no_attr)) fail(); IHqlExpression * record = transformed->queryRecord(); HqlExprArray fields; unwindChildren(fields, transformed->queryChild(1)); ForEachChild(idx, record) { IHqlExpression * child = record->queryChild(idx); if (child->hasProperty(insertedAtom)) fields.append(*createField(child->queryName(), child->getType(), LINK(child), insertedAttr.getLink())); } HqlExprArray args; unwindChildren(args, transformed); args.replace(*createRecord(fields), 1); return transformed->clone(args); }