void HSSRequest::setDSrc(HSSParserNode::p value) { switch (value->getType()) { case HSSParserNodeTypeKeywordConstant: case HSSParserNodeTypeFunctionCall: case HSSParserNodeTypeStringConstant: { this->dSrc = value; if (this->observedSrc) { this->observedSrc->removeObserver(this->observedSrcProperty, HSSObservablePropertySrc, this); } switch (value->getType()) { case HSSParserNodeTypeKeywordConstant: /** * @todo what here? */ break; case HSSParserNodeTypeStringConstant: { HSSStringConstant::p theString = qSharedPointerCast<HSSStringConstant > (value); this->src = QUrl(theString->getValue()); break; } case HSSParserNodeTypeFunctionCall: { HSSFunction::p fnct = qSharedPointerCast<HSSFunction > (value)->clone(); fnct->setScope(this->scope); fnct->setThisObj(this->getThisObj()); QVariant remoteValue = fnct->evaluate(); if (remoteValue.canConvert<AXRString>()) { this->src = QUrl(remoteValue.value<AXRString>()); } break; } default: break; } this->notifyObservers(HSSObservablePropertySrc, &this->src); break; } default: throw AXRWarning("HSSRequest", "Invalid value for src of " + this->name); } }
void HSSLog::fire() { switch (this->dValue->getType()) { case HSSParserNodeTypeFunctionCall: { HSSFunction::p fnct = boost::static_pointer_cast<HSSFunction>(this->dValue); if(fnct->isA(HSSFunctionTypeRef)){ HSSRefFunction::p refFnct = boost::static_pointer_cast<HSSRefFunction>(fnct); refFnct->setScope(this->scope); void * data = refFnct->evaluate(); switch (refFnct->getPropertyName()) { case HSSObservablePropertyWidth: case HSSObservablePropertyHeight: case HSSObservablePropertyAnchorX: case HSSObservablePropertyAnchorY: case HSSObservablePropertyAlignX: case HSSObservablePropertyAlignY: case HSSObservablePropertyContentAlignX: case HSSObservablePropertyContentAlignY: case HSSObservablePropertyStartX: case HSSObservablePropertyStartY: case HSSObservablePropertyEndX: case HSSObservablePropertyEndY: case HSSObservablePropertyPosition: case HSSObservablePropertyRed: case HSSObservablePropertyGreen: case HSSObservablePropertyBlue: case HSSObservablePropertyAlpha: case HSSObservablePropertySize: case HSSObservablePropertyCorners: { std_log(*(long double*)data); break; } case HSSObservablePropertyMargin: case HSSObservablePropertyPadding: case HSSObservablePropertyShape: case HSSObservablePropertyStartColor: case HSSObservablePropertyEndColor: case HSSObservablePropertyColorStops: case HSSObservablePropertyBalance: case HSSObservablePropertyFace: case HSSObservablePropertyColor: case HSSObservablePropertyAction: { std_log((*(HSSObject::p *)data)->toString()); break; } case HSSObservablePropertyBackground: case HSSObservablePropertyBorder: case HSSObservablePropertyFont: { std::vector<HSSObject::p> v_data = *(std::vector<HSSObject::p>*)data; std::vector<HSSObject::p>::iterator it; if (v_data.size() == 0) { std_log("empty"); } else { for (it=v_data.begin(); it!=v_data.end(); it++) { std_log((*it)->toString()); } } break; } case HSSObservablePropertyOn: { boost::unordered_map<HSSEventType, std::vector<HSSObject::p> > m_data = *(boost::unordered_map<HSSEventType, std::vector<HSSObject::p> >*)data; boost::unordered_map<HSSEventType, std::vector<HSSObject::p> >::iterator it; if (m_data.size() == 0) { std_log("empty"); } else { for (it=m_data.begin(); it!=m_data.end(); it++) { std::vector<HSSObject::p> v_data = (*it).second; std::vector<HSSObject::p>::iterator it2; for (it2=v_data.begin(); it2!=v_data.end(); it2++) { std_log((*it2)->toString()); } } } break; } case HSSObservablePropertyDirectionPrimary: case HSSObservablePropertyDirectionSecondary: case HSSObservablePropertyTransform: case HSSObservablePropertyTextAlign: case HSSObservablePropertyWeight: case HSSObservablePropertySrc: case HSSObservablePropertyMode: case HSSObservablePropertyContentTarget: { std_log(*(std::string*)data); break; } case HSSObservablePropertyFlagChanged: case HSSObservablePropertyText: case HSSObservablePropertyTarget: default: { std_log("logging this property is not supported"); break; } } } break; } case HSSParserNodeTypeStringConstant: { HSSStringConstant::p str = boost::static_pointer_cast<HSSStringConstant>(this->dValue); std_log(str->getValue()); break; } default: { std_log(this->dValue->toString()); break; } } }