TEST_F(BookmarkSerializerTest, CanSerialize) { auto bookmark = createMockBookmark( "http://pezzato.net", "one", Tags({"foo", "bar"}), "two"); std::stringstream stream; bs.serialize(&stream, bookmark); ASSERT_EQ("http://pezzato.net\none\nfoo,bar\ntwo\n", stream.str()); }
// ボールの配置 void MainScene::initBall() { auto ball = Ball::create(); ball->setPosition( Point(WINSIZE.width * 0.5, WINSIZE.height * 0.5) ); ball->setPOS( Point(WINSIZE.width * 0.5, WINSIZE.height * 0.5) ); ball->setTag( Tags(T_Ball) ); addChild(ball); }
int TagsInterface(char *fname) { static int one = 1, ndof = NDOF; static int n, nbis; static int q, N; /* Define minls=1, maxlhs, minrhs, maxrhs */ static int minlhs = 1, minrhs = 2, maxlhs = 1, maxrhs = 2; /* Check rhs and lhs */ CheckRhs(minrhs, maxrhs) ; CheckLhs(minlhs, maxlhs) ; GetRhsVar(1, "d", &n, &nbis, &q); if (n * nbis != NDOF) { sciprint("Wrong size!\r\n"); Error(999); return 0; } CreateVar(2, "d", &ndof, &one, &N); Tags(stk(N), stk(q)); LhsVar(1) = 2; return 0; }
//+------------------------------------------------------------------------ // // Member: Tags // // Synopsis: collection object model, this always returns a collection // and is named based on the tag, and searched based on tagname // //------------------------------------------------------------------------- HRESULT CCollectionCache::Tags(long lCollection, VARIANT var1, IDispatch** ppdisp) { VARIANT* pvarName = NULL; HRESULT hr = E_INVALIDARG; if(!ppdisp) { goto Cleanup; } *ppdisp = NULL; pvarName = (V_VT(&var1)==(VT_BYREF|VT_VARIANT)) ? V_VARIANTREF(&var1) : &var1; if((V_VT(pvarName)==VT_BSTR) || V_VT(pvarName)==(VT_BYREF|VT_BSTR)) { pvarName = (V_VT(pvarName)&VT_BYREF) ? V_VARIANTREF(pvarName) : pvarName; } else { hr = DISP_E_MEMBERNOTFOUND; goto Cleanup; } hr = Tags(lCollection, V_BSTR(pvarName), ppdisp); Cleanup: RRETURN(hr); }
BookmarkPtr createMockBookmark( String url, String title, Tags tags, String notes) { BookmarkData data; data.url = url.empty() ? "http://pezzato.net" : url; data.title = title.empty() ? "Alessandro Pezzato" : title; data.tags = tags.empty() ? Tags({"foo", "bar", "zee"}) : tags; data.notes = notes.empty() ? "That guy who created bmrk" : notes; return BookmarkPtr(new Bookmark{data}); }
InfoPtr newInfo( const std::string & tags, const Duration & cache_duration, const Params & params, const Time & t ){ InfoPtr ptr = Info::create(cache_duration) ->set(Tags(tags)) ->set(params, t); infos_.insert(ptr); ptr->onUpdate(boost::bind(&Egosphere::deleteExpiredInfo, this, _1)); new_info_notifier_(ptr); return ptr; }
// ブロックの配置 void MainScene::initBlocks() { // 縦に置く回数分回す for ( int i = 0; i < BLOCK_TATE; i++ ) { // 横に置く回数分回す for ( int j = 0; j < BLOCK_YOKO; j++ ) { // 画像を配置する auto block = BlockSprite::create(); block->setPosition( Point(FIRST_BLOCK_POS_X + (BLOCK_SIZE_X + BLOCK_SIZE_X * 0.1) * j, FIRST_BLOCK_POS_Y - (BLOCK_SIZE_Y + BLOCK_SIZE_Y * 0.1) * i) ); block->setPOS( Point(FIRST_BLOCK_POS_X + (BLOCK_SIZE_X + BLOCK_SIZE_X * 0.1) * j, FIRST_BLOCK_POS_Y - (BLOCK_SIZE_Y + BLOCK_SIZE_Y * 0.1) * i) ); block->setTag( Tags(T_FirstBlock + (i * BLOCK_YOKO) + j) ); addChild( block ); } } }
Tags tags() const { return Tags( kiwi::string("#") + types::str<ValueType>()); }
static Tags ANY() {return Tags("any");}
static const char* stringify(Tag tag) { const char* result = "unknown tag"; [](Tags&&...) {}(chooseString(Tags(), tag, &result)...); return result; }
Tags tags() const { return Tags("array") ; }