int large_combiner_test(S_large s) { // CHECK-LABEL: define i32 @large_combiner_test // CHECK: [[T2:%.*]] = alloca %struct.Combiner // CHECK: [[T1:%.*]] = alloca %struct.Combiner // CHECK: [[T3:%.*]] = call %struct.Combiner* @_ZN8CombinerC1E7S_large(%struct.Combiner* nonnull [[T1]], [9 x i32] %s.coerce) // CHECK: call void @_ZN8Combiner1fEv(%struct.Combiner* nonnull sret [[T2]], %struct.Combiner* nonnull [[T1]]) // CHECK: [[T4:%.*]] = getelementptr inbounds %struct.Combiner, %struct.Combiner* [[T2]], i32 0, i32 0, i32 0, i32 0 // CHECK: [[T5:%.*]] = load i32, i32* [[T4]] // CHECK: ret i32 [[T5]] return Combiner(s).f().a.a[0]; }
explicit signal(const Combiner& combiner = Combiner(), const GroupCompare& group_compare = GroupCompare()) : base_type(combiner, group_compare) { }
signal(const Combiner &combiner_arg = Combiner(), const GroupCompare &group_compare = GroupCompare()): base_type(combiner_arg, group_compare) {}
// The inversion of an op-assign functor o= inverts the value x // to it's inverse element -x // (0 o= x) == -x; // Example -= : (0 -= x) == -x static argument_type inversion(const argument_type& value) { argument_type inverse = Combiner::identity_element(); Combiner()(inverse, value); return inverse; }
void CUIChatText::SetContent(int speakerID, int channel, const char* speaker, const char* text, int style, int fontSizelua, ccColor4B color) { //备注:LUA传过来的字体大小是6,太小了!改成12. fontSizelua = (fontSizelua == 6 ? 12 : fontSizelua); if (!speaker) return; this->RemoveAllChildren(true); textNodeList.clear(); this->speakerName = speaker; text_style = style; ChatTextType type = ChatNone; ccColor4B clr = color; std::string channel_str = GetChannelStr(CHAT_CHANNEL_TYPE(channel)); if (!channel_str.empty()) { textNodeList.push_back( ChatNode(false, CreateLabel( GetTxtPri("[").c_str(), fontSizelua, clr, 0), ChatNone, 0, "")); textNodeList.push_back( ChatNode(false, CreateLabel(channel_str.c_str(), fontSizelua, clr, 0), ChatNone, 0, "")); textNodeList.push_back( ChatNode(false, CreateLabel( GetTxtPri("]").c_str(), fontSizelua, clr, 0), ChatNone, 0, "")); } if (CHAT_CHANNEL_TYPE(channel) != CHAT_CHANNEL_SYS) { textNodeList.push_back( ChatNode(false, CreateLabel(speaker, fontSizelua, clr, 0), ChatSpeaker, speakerID, "")); textNodeList.push_back( ChatNode(false, CreateLabel(GetTxtPri(":").c_str(), fontSizelua, clr, 0), ChatSpeaker, speakerID, "")); } if (!text) { return; } bool brk = false; while (*text != '\0') { bool retAnalysis = false; // is rule end? retAnalysis = AnalysisRuleEnd(text, type); if (retAnalysis) { if (type == ChatItem) { textNodeList.push_back( ChatNode(brk, CreateLabel(GetTxtPri("]").c_str(), fontSizelua, clr, m_idItem), ChatItem, m_idItem, "")); } if (type == ChatRole) { textNodeList.push_back( ChatNode(brk, CreateLabel(GetTxtPri("]").c_str(), fontSizelua, clr, m_idRole), ChatRole, m_idRole, this->m_roleName)); } type = ChatNone; clr = ccc4(255, 255, 255, 255); continue; } // is rule head? retAnalysis = AnalysisRuleHead(text, type, clr); if (type == ChatFace) { char imgIdx[3] = { 0x00 }; memcpy(imgIdx, text, 2); NDUIImage* image = CreateFaceImage(imgIdx); if (image) { textNodeList.push_back(ChatNode(brk, image, ChatFace, 0, "")); brk = false; text += 2; continue; } } // is rule item or role? if (retAnalysis) { if (type == ChatItem) { textNodeList.push_back( ChatNode(brk, CreateLabel(GetTxtPri("[").c_str(), fontSizelua, clr, m_idItem), ChatItem, m_idItem, "")); } if (type == ChatRole) { textNodeList.push_back( ChatNode(brk, CreateLabel(GetTxtPri("[").c_str(), fontSizelua, clr, m_idRole), ChatRole, m_idRole, this->m_roleName)); } continue; } // char word[4] = // { 0x00 }; // if ((unsigned char) *text < 0x80) // { // memcpy(word, text, 1); // text++; // } // else // { // memcpy(word, text, 3); // text += 3; // } char* word = UTF8::getNextChar( text ); if (type == ChatItem) { textNodeList.push_back( ChatNode(brk, CreateLabel(word, fontSizelua, clr, m_idItem), ChatItem, m_idItem, "")); } else if (type == ChatRole) { textNodeList.push_back( ChatNode(brk, CreateLabel(word, fontSizelua, clr, m_idRole), ChatRole, m_idRole, this->m_roleName)); } else { textNodeList.push_back( ChatNode(brk, CreateLabel(word, fontSizelua, clr, 0), ChatNone, 0, "")); } brk = false; } Combiner (textNodeList); }