//********************************************************************* // // Format. virtual // // bool nuiFormater::Format (double dValue, nglString& rResult) const { // identity (default formater) rResult.CFormat ("%.0f", dValue); // i.e., 45.80 return true; }
nuiAttribute<nuiAnchorType>(const nglString& rName, nuiLayout* pLayout) : nuiAttribute<int32>(rName, nuiUnitNone, nuiMakeDelegate(this, &nuiAttribute<nuiAnchorType>::_Get), nuiMakeDelegate(this, &nuiAttribute<nuiAnchorType>::_Set), NUI_INVALID_RANGE), mAnchor(rName.Extract(13)) { nuiAttributeBase::SetAsInstanceAttribute(true); if (rName.CompareLeft("HAnchorsType_", true) == 0) { mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetHorizontalAnchorType); mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetHorizontalAnchorType); } else if (rName.CompareLeft("VAnchorsType_", true) == 0) { mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetVerticalAnchorType); mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetVerticalAnchorType); } }
void nuiSocket::GetStatusReport(nglString& rResult) { nglCriticalSectionGuard g(gmCS); rResult.Wipe(); rResult.Add("Total sockets created in session: ").Add(gmSocketCount).AddNewLine(); rResult.Add("Total current sockets...........: ").Add((int64)gmAllSockets.size()).AddNewLine(); rResult.AddNewLine(); for (std::set<nuiSocket*>::const_iterator it = gmAllSockets.begin(); it != gmAllSockets.end(); ++it) { nuiSocket* pSocket = *it; rResult.Add("\t").Add(pSocket->GetDesc()).AddNewLine(); } }
LayoutAnchorValue(const nglString& rName, nuiLayout* pLayout) : nuiAttribute<float>(rName, nuiUnitNone, nuiMakeDelegate(this, &LayoutAnchorValue::_Get), nuiMakeDelegate(this, &LayoutAnchorValue::_Set), NUI_INVALID_RANGE), mAnchor(rName.Extract(9)) { nuiAttributeBase::SetAsInstanceAttribute(true); if (rName.CompareLeft("HAnchors_", true) == 0) { mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetHorizontalAnchorPosition); mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetHorizontalAnchorPosition); } else if (rName.CompareLeft("VAnchors_", true) == 0) { mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetVerticalAnchorPosition); mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetVerticalAnchorPosition); } }
nuiFileTree::nuiFileTree(const nglPath& rPath, const nglPath& rRootPath, const nglString& rFilter, bool showHiddenFiles) : nuiFileSelectorBase(), mEventSink(this) { std::list<nglString> filters; if (!rFilter.IsNull()) filters.push_back(rFilter); Init(rPath, rRootPath, filters, showHiddenFiles); }
void nuiStateDecoration::SetState(nuiStateDescription State, const nglString& rDecorationName) { if (rDecorationName.IsNull()) return; nuiDecoration* pDecoration = nuiDecoration::Get(rDecorationName, true); if (!pDecoration) return; SetState(State, pDecoration); }
bool ProjectGenerator::MsgError(const nglString& error) { nglString msg; msg.Format(_T("error %ls"), error.GetChars()); NGL_OUT(msg); nuiMessageBox* pMessageBox = new nuiMessageBox(GetMainWindow(), _T("Project Creator"), msg, eMB_OK); pMessageBox->QueryUser(); return false; }
nuiHyperLink::nuiHyperLink(const nglString& rURL, const nglString& rLabel) : nuiLabel(rLabel.IsNull() ? rURL : rLabel), mURL(rURL) { if (SetObjectClass(_T("nuiHyperLink"))) InitAttributes(); SetTextColor(nuiColor(_T("nuiHyperLink"))); }
// Stolen from nglPath! static int32 GetRootPart(const nglString& rStr) { if (rStr[0] == _T('/')) { if (rStr[1] != _T('/')) return 1; // //host[/path] (network address) // or /volume[/path] (standard unix like path) int32 end = rStr.Find(_T('/'), 2); return ((end > 0) ? end : rStr.GetLength()); } // Find the protocol name: int col = rStr.Find(_T("://"), 0, true); return MIN(col + 3, rStr.GetLength()); }
bool nuiZipWriter::AddFile(nglIStream* pStream, const nglString& rPathInZip, const nglString& rComment, bool OwnStream) { NGL_ASSERT(IsValid()); zip_fileinfo info; nglTime tm; nglTimeInfo t; tm.GetLocalTime(t); info.tmz_date.tm_sec = t.Seconds; info.tmz_date.tm_min = t.Minutes; info.tmz_date.tm_hour = t.Hours; info.tmz_date.tm_mday = t.Day; info.tmz_date.tm_mon = t.Month; info.tmz_date.tm_year = t.Year; info.dosDate = 0; info.internal_fa = 0; info.external_fa = 0; bool res = zipOpenNewFileInZip(mpZip, rPathInZip.IsNull() ? NULL : rPathInZip.GetStdString().c_str(), &info, NULL, 0, NULL, 0, rComment.IsNull() ? NULL : rComment.GetStdString().c_str(), 0, 0) == Z_OK; if (!res) return res; const uint32 bufsize = 4096; uint8 buf[bufsize]; uint64 todo = pStream->Available(); uint32 _read = -1; while (todo && _read) { uint32 toread = MIN(todo, bufsize); _read = pStream->Read(buf, toread, 1); res = zipWriteInFileInZip(mpZip, buf, _read) == Z_OK; todo -= _read; if (_read != toread) return false; } res = zipCloseFileInZip(mpZip) == Z_OK; if (OwnStream) delete pStream; return res; }
nuiAudioDevice_DirectSound::nuiAudioDevice_DirectSound(GUID IGuid, GUID OGuid, const nglString& rInName, const nglString& rOutName, const nglString& rInModule, const nglString& rOutModule) : nuiAudioDevice() { mInName = rInName; mOutName = rOutName; if (rOutName.IsEmpty()) mName = rInName; else mName = rOutName; mManufacturer = rOutModule; mIsPresent = false; mHasInput = false; mHasOutput = false; mIDeviceID = IGuid; mODeviceID = OGuid; mpDirectSound = NULL; mpDirectSoundCapture = NULL; mAPIName = API_NAME; mpRingBuffer = NULL; mpInputBuffer = NULL; mpOutputBuffer = NULL; mpProcessingTh = NULL; mpOutputTh = NULL; mNotifInputEvent[0] = NULL; mNotifInputEvent[1] = NULL; mNotifOutputEvent[0] = NULL; mNotifOutputEvent[1] = NULL; HRESULT hr; // Get Input device caps: hr = DirectSoundCaptureCreate(&mIDeviceID, &mpDirectSoundCapture, NULL); if (hr != S_OK || !mpDirectSoundCapture) { NGL_LOG(_T("nuiAudioDevice_DirectSound"), NGL_LOG_INFO, _T("constructor ERROR : could not create DirectSoundCapture object!\n")); } // Get Output device caps: hr = DirectSoundCreate(&mODeviceID, &mpDirectSound, NULL); if (hr != S_OK || !mpDirectSound) { NGL_LOG(_T("nuiAudioDevice_DirectSound"), NGL_LOG_ERROR, _T("constructor ERROR : could not create DirectSound object!\n")); // if there is no output, consider the device as not valid return; } Init(); }
nuiStateDecoration::nuiStateDecoration(const nglString& rName, const nglString& rUp, const nglString& rDown, const nglString& rHoverOn, const nglString& rDisabled, const nglString& rDisabledSelected) : nuiDecoration(rName), mClientRect(0,0,0,0), mUseSourceClientRect(false) { if (SetObjectClass(_T("nuiStateDecoration"))) InitAttributes(); if (!rUp.IsNull()) SetState(nuiStateEnabled | nuiStateReleased, GetDecoration(rUp)); if (!rDown.IsNull()) SetState(nuiStateEnabled | nuiStatePressed, GetDecoration(rDown)); if (!rHoverOn.IsNull()) SetState(nuiStateEnabled | nuiStateHoverOn, GetDecoration(rHoverOn)); if (!rDisabled.IsNull()) SetState(nuiStateDisabled | nuiStateReleased, GetDecoration(rDisabled)); if (!rDisabledSelected.IsNull()) { SetState(nuiStateDisabled | nuiStateSelected, GetDecoration(rDisabledSelected)); SetState(nuiStateDisabled | nuiStatePressed, GetDecoration(rDisabledSelected)); } }
void nglConsole::OnOutput(const nglString& rText) { // 'char' mode : string buffer is considered to use the locale's encoding Append(rText.GetChars()); // Write to the standard win32 console: #ifdef USE_STANDARD_WIN32_CONSOLE unsigned long res = 0; WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),rText.GetChars(),rText.GetLength(),&res,NULL); #endif // I don't care if this is slow, its really mandatory in win32. vector<nglString> vec; uint ret=rText.Tokenize(vec, _T('\n')); for (uint i=0; i<ret; i++) { OutputDebugString(vec[i].GetChars()); // fixme! to be removed ? OutputDebugString(_T("\n")); } }
bool nglPath_IsRO(nglString& rOptions) { std::vector<nglString> tokens; std::vector<nglString>::iterator i; rOptions.Tokenize(tokens, _T(',')); for (i = tokens.begin(); i != tokens.end(); i++) if ((*i) == _T("ro")) return true; return false; }
void Generator::DumpIncluder(const nglPath& rootSource, const nglPath& pngSource,const nglPath& codeSource, const nglPath& HincluderPath, const nglPath& CPPincluderPath, nglString& HincluderStr, nglString& CPPincluderStr) { std::list<nglPath> children; std::list<nglPath>::iterator it; pngSource.GetChildren(&children); for (it = children.begin(); it != children.end(); ++it) { nglPath child = *it; if (!child.IsLeaf()) { // recurs. DumpIncluder(rootSource, child, codeSource, HincluderPath, CPPincluderPath, HincluderStr, CPPincluderStr); continue; } if (child.GetExtension().Compare(_T("png"), false)) continue; nglString node = child.GetPathName(); node.DeleteLeft(rootSource.GetPathName().GetLength()+1); node.DeleteRight(nglPath(node).GetExtension().GetLength() +1); nglPath HdestPath = codeSource + nglPath(node); nglPath CPPdestPath = codeSource + nglPath(node); HdestPath = nglPath(HdestPath.GetPathName() + _T(".h")); CPPdestPath = nglPath(CPPdestPath.GetPathName() + _T(".cpp")); HdestPath.MakeRelativeTo(HincluderPath.GetParent()); CPPdestPath.MakeRelativeTo(CPPincluderPath.GetParent()); nglString tmp; tmp.Format(_T("#include \"%ls\"\n"), HdestPath.GetChars()); HincluderStr.Append(tmp); tmp.Format(_T("#include \"%ls\"\n"), CPPdestPath.GetChars()); CPPincluderStr.Append(tmp); } }
void nuiHTML::GetAbsoluteURL(const nglString& rBaseURL, nglString& url) { int32 colon = url.Find(':'); if (colon > 0) { // complete url link } else if (url[0] == '/') { // Site absolute int32 col = rBaseURL.Find(_T("://")); if (col > 0) { int32 end = rBaseURL.Find('/', col + 3); if (end) url = rBaseURL.Extract(0, end) + url; } } else { // Site relative int32 end = rBaseURL.FindLast(_T('/')); if (end >= 0) { url = rBaseURL.Extract(0, end + 1) + url; } else { url = rBaseURL + _T("/") + url; } } Canonize(url); }
void nuiBindingManager::Dump(nglString& rString) const { //std::map<nglString, nuiFunction*> mFunctions; // Dump functions: { FunctionMap::const_iterator it = mFunctions.begin(); FunctionMap::const_iterator end = mFunctions.end(); while (it != end) { std::vector<nglString> argstypes; nglString name(it->first); nuiTypeContainer* pTypeContainer = it->second; pTypeContainer->DumpArgs(argstypes); nglString args; BuildTypeListString(1, argstypes, args); rString.Add(argstypes[0]).Add(" ").Add(name).Add(_T("(")).Add(args).Add(_T(");")).AddNewLine(); ++it; } } // Classes: TypeMap::const_iterator it = mTypes.begin(); TypeMap::const_iterator end = mTypes.end(); while (it != end) { nuiClass* pClass = it->second; nglString name = pClass->GetName(); nglString classdump; pClass->Dump(classdump); rString.AddNewLine().AddNewLine().Add(classdump); ++it; } }
void nuiLayout::SetConstraint(nuiWidget* pWidget, const nglString& rDescription) { nuiLayoutConstraint constraintH, constraintV; int pos = rDescription.Find('/'); if (pos < 0) { nglString desc(rDescription); desc.Trim(); constraintH.Set(desc); } else if (pos == 0) { nglString desc2 = rDescription.Extract(pos+1, rDescription.GetLength() - (pos + 1)); desc2.Trim(); constraintV.Set(desc2); } else { nglString desc1 = rDescription.Extract(0, pos); nglString desc2 = rDescription.Extract(pos+1, rDescription.GetLength() - (pos + 1)); desc1.Trim(); desc2.Trim(); constraintH.Set(desc1); constraintV.Set(desc2); } SetConstraint(pWidget, constraintH, constraintV); }
int nglConsole::GetHistory (list<const nglString*>& rMatches, nglString& rFilter, bool IsCaseSensitive) { #if NGL_DISABLE_CONSOLE return 0; #else int count = 0; list<nglString*>::reverse_iterator h_entry; list<nglString*>::reverse_iterator h_begin = mHistory.rbegin(); rMatches.clear(); int size = rFilter.GetLength(); for (h_entry = mHistory.rend(); h_entry != h_begin; h_entry--) if (!rFilter.Compare(**h_entry, 0, size, IsCaseSensitive)) { rMatches.push_front(*h_entry); count++; } return count; #endif }
bool nglKernel::SetClipboard(const nglString& rString) { if (OpenClipboard(mHWnd)) { EmptyClipboard(); HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, rString.GetLength()+1); if (hglbCopy == NULL) { CloseClipboard(); return false; } char* lptstrCopy = (char*)GlobalLock(hglbCopy); memcpy(lptstrCopy, rString.GetChars(), rString.GetLength()+1); GlobalUnlock(hglbCopy); SetClipboardData(CF_TEXT, hglbCopy); CloseClipboard(); return true; } return false; }
static bool Canonize(nglString& rStr) { nglString canon; int32 len = rStr.GetLength(); int32 root_part = GetRootPart(rStr); int32 last_slash = root_part; int32 slash = 0; canon = rStr.GetLeft(root_part); while (slash < len) { slash = rStr.Find(_T('/'), last_slash); if (slash == - 1) slash = len; if (((slash - last_slash) == 1) && (rStr.GetChar(last_slash) == _T('.'))) { // Ignore '.' } else if (((slash - last_slash) == 2) && (!rStr.Compare(_T(".."), last_slash, 2))) { // Interpret '..' int32 prev_slash = canon.FindLast(_T('/')); if (prev_slash < root_part) prev_slash = root_part; if (!canon.IsEmpty() && canon.Compare(_T(".."), canon.GetLength() - 2, 2)) canon.Delete(prev_slash); else { if (canon.GetLength() > root_part) canon += _T('/'); canon += _T(".."); } } else { // Simply append path node nglString node = rStr.Extract(last_slash, (slash - last_slash)); if (canon.GetLength() > root_part) canon += _T('/'); canon += node; } last_slash = slash + 1; } rStr = canon; return true; }
void nuiBorderDecoration::SetBorderType(nglString type) { if (!type.Compare(_T("All"), false)) mBorderType = eBorderAll; else if (!type.Compare(_T("Left"), false)) mBorderType = eBorderLeft; else if (!type.Compare(_T("Right"), false)) mBorderType = eBorderRight; else if (!type.Compare(_T("Top"), false)) mBorderType = eBorderTop; else if (!type.Compare(_T("Bottom"), false)) mBorderType = eBorderBottom; else if (!type.Compare(_T("Horizontal"), false)) mBorderType = eBorderHorizontal; else if (!type.Compare(_T("Vertical"), false)) mBorderType = eBorderVertical; else if (!type.Compare(_T("None"), false)) mBorderType = eBorderNone; else mBorderType = eBorderNone; Changed(); }
static nglString GetMimeType(const nglString& extension) { CFStringRef mimeType = NULL; CFStringRef ext = extension.ToCFString(); CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, ext, NULL); CFRelease(ext); if (!UTI) return nglString::Null; mimeType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType); if (!mimeType) // check for edge case { return nglString::Null; } CFRelease(UTI); nglString mime(mimeType); CFRelease(mimeType); return mime; }
void nglConsole::AddToHistory (const nglString& rLine) { #if NGL_DISABLE_CONSOLE return; #else nglString* newline; uint new_linecnt, new_charcnt; if (!mUseHistory) return; // Filter empty lines nglString trimmed = rLine; trimmed.Trim(); if (trimmed.GetLength() == 0) return; new_linecnt = mLineCnt + 1; new_charcnt = mCharCnt + rLine.GetLength(); // Adjust history size according user-set limits while ((!mHistory.empty()) && (((mLineMax > 0) && (new_linecnt > mLineMax)) || ((mCharMax > 0) && (new_charcnt > mCharMax)))) { list<nglString*>::iterator tail = mHistory.end(); tail--; // mHistory.end() return an iterator just past the last element if (*tail) { new_charcnt -= (*tail)->GetLength(); new_linecnt--; delete (*tail); mHistory.erase (tail); } } newline = new nglString (rLine); mHistory.push_front (newline); mLineCnt = new_linecnt; mCharCnt = new_charcnt; #endif }
void nuiFontRequest::_SetPanose(const nglString& rPanose) { std::vector<nglString> tokens; rPanose.Tokenize(tokens); if (tokens.size() != 10) { NGL_LOG("font", NGL_LOG_ERROR, "Panose information MUST be 10 numbers from 0 to 255"); return; } uint8 PanoseBytes[10]; for (uint32 i = 0; i < 10; i++) { if (!tokens[i].IsInt()) { NGL_LOG("font", NGL_LOG_ERROR, "Each of the 10 Panose values must be a number from 0 to 255"); return; } PanoseBytes[i] = tokens[i].GetCInt(); } nuiPanose panose(PanoseBytes); MustBeSimilar(panose, 1.0f); }
void nuiMessageBox::Init(const nglString& rTitle, nuiWidget* pContents, nuiMessageBoxType type, bool showIcon) { SetObjectClass(_T("nuiMessageBox")); mType = type; mKeyDown = false; mClickedButton = ButtonCancel; nuiVBox* pVBox = new nuiVBox(); pVBox->SetExpand(nuiExpandShrinkAndGrow); pVBox->SetObjectName(_T("nuiMessageBox::Client")); AddChild(pVBox); nuiLabel* pTitle = new nuiLabel(rTitle); pTitle->SetObjectName(_T("nuiMessageBox::Title")); pTitle->SetObjectClass(_T("nuiMessageBox::Title")); pVBox->AddCell(pTitle); nuiHBox* pHBox = new nuiHBox(2); pHBox->SetExpand(nuiExpandShrinkAndGrow); pHBox->SetObjectName(_T("nuiMessageBox::Contents")); pVBox->AddCell(pHBox); pVBox->SetCellExpand(pVBox->GetNbCells()-1, nuiExpandShrinkAndGrow); if (showIcon) { nuiSimpleContainer* pIcon = new nuiSimpleContainer(); nglString objectName; objectName.Format(_T("nuiMessageBox::Icon"), rTitle.GetChars()); pIcon->SetObjectName(objectName); pHBox->SetCell(0, pIcon, nuiCenter); } pHBox->SetCell(1, pContents); pHBox->SetCellExpand(1, nuiExpandShrinkAndGrow); mpBtnBox = new nuiHBox(); mpBtnBox->SetObjectName(_T("nuiMessageBox::ButtonBox")); pVBox->AddCell(mpBtnBox); mpBtnBox->AddCell(NULL); mpBtnBox->SetCellExpand(mpBtnBox->GetNbCells()-1, nuiExpandShrinkAndGrow); switch (mType) { case eMB_OK: mpBtnBox->AddCell(CreateOK()); mpBtnBox->SetPosition(nuiCenter); break; case eMB_Cancel: mpBtnBox->AddCell(CreateCancel()); mpBtnBox->SetPosition(nuiCenter); break; case eMB_OKCancel: mpBtnBox->AddCell(CreateOK()); mpBtnBox->AddCell(CreateCancel()); break; case eMB_RetryOKCancel: mpBtnBox->AddCell(CreateRetry()); mpBtnBox->AddCell(CreateOK()); mpBtnBox->AddCell(CreateCancel()); break; case eMB_YesNo: mpBtnBox->AddCell(CreateYes()); mpBtnBox->AddCell(CreateNo()); break; case eMB_Custom: break; } SetPosition(nuiCenter); GetTopLevel()->SetFocus(this); // default decoration nuiDefaultDecoration::MessageBox(this); }
void nuiAudioDeviceManager::RegisterAPI(const nglString& rAPIName, nuiAudioDeviceAPI* pAPI) { NGL_LOG(_T("nuiAudioDeviceManager"), NGL_LOG_DEBUG, _T("RegisterAPI('%s') [0x%x]\n"), rAPIName.GetChars(), pAPI); nuiAudioAPIMap::const_iterator end = mAPIs.end(); nuiAudioAPIMap::const_iterator it = mAPIs.find(rAPIName); if (it != end) { nuiAudioDeviceAPI* pOldAPI = it->second; NGL_LOG(_T("nuiAudioDeviceManager"), NGL_LOG_DEBUG, _T("\tkilling previous entry for this API [0x%p]\n"), pOldAPI); delete pOldAPI; } mAPIs[rAPIName] = pAPI; Update(); }
void nuiSWF::SetFrame(const nglString& rName) { NGL_ASSERT(mpMovie && mpMovieInterface); std::string tmp(rName.GetStdString()); mpMovieInterface->goto_labeled_frame(tmp.c_str()); }
void nuiRange::ToString(nglString& str) { //double Value, double Min, double Max, double Increment, double PageIncrement, double PageSize, double Origin str.CFormat(_T("[%g %g %g %g %g %g %g]"), mValue, mMinimum, mMaximum, mIncrement, mPageIncrement, mPageSize, mOrigin); }
bool nuiSplitText(const nglString& rSourceString, nuiTextRangeList& rRanges, nuiSplitTextFlag flags) { uint32 size = rSourceString.GetLength(); rRanges.clear(); if (!size) return true; const bool scriptchange = flags & nuiST_ScriptChange; const bool rangechange = flags & nuiST_RangeChange; const bool wordboundary = flags & nuiST_WordBoundary; const bool directionchange = flags & nuiST_DirectionChange; const bool mergecommonscript = flags & nuiST_MergeCommonScript; uint32 lastpos = 0; uint32 curpos = 0; const nglChar& ch = rSourceString[curpos]; int32 direction = nuiGetUnicodeDirection(ch); int32 newdirection = direction; nglChar scriptlow = 0; nglChar scripthi = 0; nuiUnicodeScript script = nuiGetUnicodeScript(ch, scriptlow, scripthi); nuiUnicodeScript newscript = script; nglChar rangelow = 0; nglChar rangehi = 0; nuiUnicodeRange range = nuiGetUnicodeRange(ch, rangelow, rangehi); nuiUnicodeRange newrange = range; bool blank = nuiIsUnicodeBlank(ch); bool newblank = blank; curpos++; while (curpos != size) { bool brk = false; const nglChar& ch = rSourceString[curpos]; if (wordboundary) { newblank = nuiIsUnicodeBlank(ch); if (newblank != blank) brk = true; } if (scriptchange) { if (ch < scriptlow || ch > scripthi) // still in the last range? { if (!wordboundary) newblank = nuiIsUnicodeBlank(ch); if (!newblank) { newscript = nuiGetUnicodeScript(ch, scriptlow, scripthi); if ((newscript != script) && !(mergecommonscript && newscript == eScriptCommon)) { brk = true; } } } } if (rangechange) { if (ch < rangelow || ch > rangehi) // still in the last range? { if (!wordboundary) newblank = nuiIsUnicodeBlank(ch); if (!newblank) { newrange = nuiGetUnicodeRange(ch, rangelow, rangehi); if (newrange != range) brk = true; } } } if (directionchange) { newdirection = nuiGetUnicodeDirection(ch); if (newdirection != direction) brk = true; } if (brk) { nuiTextRange r; r.mLength = curpos - lastpos; // count of unicode code points r.mDirection = direction; // even: Left to right, odd: right to left r.mScript = script; // What script if this range of text r.mRange = range; // What script if this range of text r.mBlank = blank; // Does this range contains strictly blank (space, tab, return, etc.) code points. rRanges.push_back(r); lastpos = curpos; direction = newdirection; script = newscript; range = newrange; blank = newblank; } curpos++; } // Last range: nuiTextRange r; r.mLength = curpos - lastpos; // count of unicode code points r.mDirection = direction; // even: Left to right, odd: right to left r.mScript = script; // What script if this range of text r.mRange = range; // What script if this range of text r.mBlank = blank; // Does this range contains strictly blank (space, tab, return, etc.) code points. rRanges.push_back(r); return true; }