void AV::unshift( const AV& list ){ AV array = list; int len = array.length(); Perl_av_unshift( my_perl,(old_AV_ptr)m_c_av_ptr, len ); for( int i = 0; i < len; i++ ) store( i, array[i] ); }
void test() { const uint32_t data[] = { 0, 3, 5, 6, 9, 13 }; AV av; for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(data); i++) { av.append(data[i]); } const struct { uint32_t pos; uint32_t v; } tbl[] = { { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 1 }, { 4, 1 }, { 5, 2 }, { 6, 3 }, { 7, 3 }, { 8, 3 }, { 9, 4 }, {10, 4 }, {11, 4 }, {12, 4 }, {13, 5 }, {14, 5 }, }; for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) { CYBOZU_TEST_EQUAL(av.get(tbl[i].pos), tbl[i].v); } }
virtual void startElement(const string_type& namespaceURI, const string_type& localName, const string_type& qName, const SAX::Attributes<string_type, string_adaptor>& atts) { if(callTemplate_ == 0) { static const AV rules = AV::rule(SC::name, true); std::map<string_type, string_type> attrs = rules.gather(qName, atts); string_type name = context_.processInternalQName(attrs[SC::name]).clarkName(); callTemplate_ = new CallTemplate<string_type, string_adaptor>(name); return; } // if(callTemplate_ == 0) if((namespaceURI == StylesheetConstant<string_type, string_adaptor>::NamespaceURI) && (localName == SC::with_param)) { context_.push(0, new WithParamHandler<string_type, string_adaptor>(context_, *callTemplate_), namespaceURI, localName, qName, atts); return; } // if(localName == "with-param") throw SAX::SAXException("xsl:call-template can only contain xsl:sort and xsl:with-param elements."); } // startElement
string_type validate_href(const string_type& qName, const SAX::Attributes<string_type, string_adaptor>& atts) { static const AV rules = AV::rule(SC::href, true); string_type href = rules.gather(qName, atts)[SC::href]; no_content_ = true; // std::cout << "Base : " << context_->currentBase() << ", href : " << href << "\n"; return context_->makeAbsolute(href); } // validate_href
virtual Copy<string_type, string_adaptor>* createContainer(const string_type& /* namespaceURI */, const string_type& /* localName */, const string_type& qName, const SAX::Attributes<string_type, string_adaptor>& atts) { static const AV rules = AV::rule(SC::use_attribute_sets, false); string_type sets = rules.gather(qName, atts)[SC::use_attribute_sets]; return new Copy<string_type, string_adaptor>(sets); } // createContainer
ostream& operator<<( ostream& os, const AV& av ){ AV temp = av; int len = temp.length(); if( len == 0 ) return os << "()"; string s = "("; for( int i = 0; i < len - 1; i++ ) s += (string)temp[i] + ","; s += (string)temp[len-1] + ")"; return os << s; }
void ExtractModel::act(AV& av, collection_nvp<E,S> nvp ) { E* entry; construct(av, &entry, static_cast<unsigned int>(0)); av.diveTable(nvp.name); putNamedColumn(av.getScope().table(), HIBERLITE_PARENTID_COLUMN, HIBERLITE_ID_STORAGE_CLASS); putNamedColumn(av.getScope().table(), HIBERLITE_ENTRY_INDEX_COLUMN, HIBERLITE_ID_STORAGE_CLASS); sql_nvp<E> el("item",*entry); av & el; av.pop(); destroy(*this, entry, static_cast<unsigned int>(0)); }
virtual void startElement(const string_type& /* namespaceURI */, const string_type& /* localName */, const string_type& qName, const SAX::Attributes<string_type, string_adaptor>& atts) { if(copyOf_ == 0) { static const AV rules = AV::rule(SC::select, true); string_type select = rules.gather(qName, atts)[SC::select]; copyOf_ = new CopyOf<string_type, string_adaptor>(context_.xpath_expression(select)); return; } // if(copyOf_ == 0) throw SAX::SAXException(string_adaptor::asStdString(qName) + " can not contain elements"); } // startElement
virtual void startElement(const string_type& /* namespaceURI */, const string_type& /* localName */, const string_type& qName, const SAX::Attributes<string_type, string_adaptor>& atts) { if(valueOf_ == 0) { static const AV rules = AV::rule(SC::select, true) .rule(SC::disable_output_escaping, false, SC::no, AllowedValues<string_type>(SC::yes, SC::no)); std::map<string_type, string_type> attrs = rules.gather(qName, atts); valueOf_ = new ValueOf<string_type, string_adaptor>(context_.xpath_expression(attrs[SC::select]), attrs[SC::disable_output_escaping] == SC::yes); return; } // if(valueOf_ == 0) throw SAX::SAXException(string_adaptor::asStdString(qName) + " can not contain elements"); } // startElement
void UpdateBean::act(AV& av, collection_nvp<E,S> nvp ){ sqlid_t index=0; S& stream=nvp.stream; av.diveTable(nvp.name); std::string tab=av.getScope().table(); while(!stream.done()){ E& el=stream.getNext(); sqlid_t entry_id=Database::allocId(av.getConnection(), tab); startRow(tab,entry_id, curRow()->id,index); sql_nvp<E> el_nvp("item",el); av & el_nvp; commitRow(av.getConnection(), entry_id); index++; } av.pop(); }
// Constructor for central Rope ManipulatorRope::ManipulatorRope(const ThreeVector &abushing, const ThreeVector &aaxis,float abushingRadius, const AV &av) : //av(aav), bushing(abushing), bushingRadius(abushingRadius), bushingExit(cross(kVector, aaxis)), anchorExit(oVector), anchorROC(tempROC), anchorHoleOffset(tempHoleOffset), pulleyAxis(aaxis),neckRingRadius(av.getNeckRingRadius()), neckRingROC(av.getNeckRingROC()), neckRingCenter(av.getNeckRingPosition()), neckRingAxis(av.getNeckDirection()) { // bushingRadius = abushingRadius; ropeType = centralRope; // pulleyAxis = aaxis; // bushingExit = cross(kVector, aaxis); getLength(ThreeVector(0,0,0)); }
// Constructor for side Ropes // ManipulatorRope::ManipulatorRope(const ThreeVector &abushing, const ThreeVector &aanchor, const float &aROC, const float &aHoleOff, const ThreeVector &aaxis, float apulleyOffset, float apulleyRadius, float abushingRadius, const AV &av) :// av(aav), bushing(abushing), bushingRadius(abushingRadius), bushingExit(cross(kVector, aaxis)), anchorExit(aanchor), anchorROC(aROC), anchorHoleOffset(aHoleOff), pulleyAxis(aaxis),pulleyOffset(apulleyOffset), neckRingRadius(av.getNeckRingRadius()), neckRingROC(av.getNeckRingROC()), neckRingCenter(av.getNeckRingPosition()), neckRingAxis(av.getNeckDirection()) { ropeType=(anchorExit[X]+anchorExit[Y] < 0)?leftRope:rightRope; pulleyRadius=apulleyRadius; // bushingRadius=abushingRadius; // anchorROC=aROC; // anchorHoleOffset=aHoleOff; // pulleyAxis=aaxis; getLength(ThreeVector(0,0,0)); }
void UpdateBean::notifyDoneWalk(AV& av) { commitRow(av.getConnection(), av.getRootId()); }
void UpdateBean::notifyInitWalk(AV& av) { startRow(av.getScope().table(), av.getRootId(), Database::NULL_ID,0); }