bool SKKCandList::append_candidate (const WideString &cand, const WideString &annot, const WideString &cand_orig, const AttributeList &attrs) { if (cand.length() == 0) return false; if (m_candvec.size() < candvec_size) { m_candvec.push_back(CandEnt(cand, annot, cand_orig)); return true; } else { m_annot_buf->m_index.push_back(m_annot_buf->m_buffer.size()); if (!annot.empty()) m_annot_buf->m_buffer.insert(m_annot_buf->m_buffer.end(), annot.begin(), annot.end()); m_cand_orig_buf->m_index.push_back(m_cand_orig_buf->m_buffer.size()); if (!cand_orig.empty()) m_cand_orig_buf->m_buffer.insert(m_cand_orig_buf->m_buffer.end(), cand_orig.begin(), cand_orig.end()); return CommonLookupTable::append_candidate(cand, attrs); } }
//-------------------------------- bool StringUtils::equalsIgnoreCase ( const WideString& s1, const WideString& s2 ) { if ( s1.length() != s2.length() ) return false; WideString::const_iterator it1=s1.begin(); WideString::const_iterator it2=s2.begin(); // has the end of at least one of the strings been reached? while ( (it1!=s1.end()) && (it2!=s2.end()) ) { if(::toupper(*it1) != ::toupper(*it2)) //letters differ? return false; // proceed to the next character in each string ++it1; ++it2; } return true; }
void Font::AddCurrentLine(const WideString & text, const int32 pos, SeparatorPositions & separatorPosition, Vector<WideString> & resultVector) const { WideString currentLine = text.substr(separatorPosition.currentLineStart, pos - separatorPosition.currentLineStart); //Trim whitespace at begin/end line while(currentLine.size() > 1 && IsSpace(currentLine[0])) { currentLine.erase(currentLine.begin()); } while(currentLine.size() > 1 && IsSpace(currentLine[currentLine.size() - 1])) { currentLine.erase(currentLine.end() - 1); } resultVector.push_back(currentLine); separatorPosition.Reset(); }