JBoolean GetEnclosure ( const JArray<JRect>& rectList, const JIndex rectIndex, JIndex* enclIndex ) { const JRect theRect = rectList.GetElement(rectIndex); JBoolean found = kJFalse; *enclIndex = 0; JSize minArea = 0; const JSize count = rectList.GetElementCount(); for (JIndex i=1; i<=count; i++) { if (i != rectIndex) { const JRect r = rectList.GetElement(i); const JSize a = r.area(); if (r.Contains(theRect) && (a < minArea || minArea == 0)) { minArea = a; found = kJTrue; *enclIndex = i; } } } return found; }
JVariableList::MatchResult JVariableList::FindUniqueVarName ( const JCharacter* prefix, JIndex* index, JString* maxPrefix ) const { assert( !JStringEmpty(prefix) ); const JSize count = GetElementCount(); JArray<JIndex> matchList; for (JIndex i=1; i<=count; i++) { const JString& name = GetVariableName(i); if (name == prefix) { *index = i; *maxPrefix = name; return kSingleMatch; } else if (JStringBeginsWith(name, name.GetLength(), prefix)) { matchList.AppendElement(i); } } const JSize matchCount = matchList.GetElementCount(); if (matchCount == 0) { *index = 0; maxPrefix->Clear(); return kNoMatch; } else if (matchCount == 1) { *index = matchList.GetElement(1); *maxPrefix = GetVariableName(*index); return kSingleMatch; } else { *maxPrefix = GetVariableName( matchList.GetElement(1) ); for (JIndex i=2; i<=matchCount; i++) { const JString& varName = GetVariableName( matchList.GetElement(i) ); const JSize matchLength = JCalcMatchLength(*maxPrefix, varName); const JSize prefixLength = maxPrefix->GetLength(); if (matchLength < prefixLength) { maxPrefix->RemoveSubstring(matchLength+1, prefixLength); } } *index = 0; return kMultipleMatch; } }
void GLUndoElementsChange::Undo() { // we need to create this before we change the data, because // it needs to read the old data first. We can't yet call NewUndo, // though, because that will delete us. GLUndoElementsChange* undo = new GLUndoElementsChange(GetTable(), GetStartCell(), GetEndCell(), GetType()); assert(undo != NULL); GRaggedFloatTableData* data = GetData(); JPoint start = GetStartCell(); JPoint end = GetEndCell(); GLUndoElementsBase::UndoType type = GetType(); if (type == GLUndoElementsBase::kRows) { } else if (type == GLUndoElementsBase::kCols) { JSize cols = itsValues->GetElementCount(); for (JSize i = 1; i <= cols; i++) { JArray<JFloat>* col = itsValues->NthElement(i); JSize rows = col->GetElementCount(); for (JSize j = 1; j <= rows; j++) { JFloat value = col->GetElement(j); data->SetElement(j, i + start.x - 1, value); } } } else if (type == GLUndoElementsBase::kElements) { for (JSize i = start.x; i <= (JSize)end.x; i++) { JArray<JFloat>* col = itsValues->NthElement(i - start.x + 1); JSize rows = col->GetElementCount(); for (JSize j = start.y; j <= start.y + rows -1; j++) { JFloat value = col->GetElement(j - start.y + 1); data->SetElement(j, i, value); } } } NewUndo(undo); }
void JInterPoly::AddPoints ( const JArray<JFloat>& x, const JArray<JFloat>& y ) { const JSize ptCount = x.GetElementCount(); assert( ptCount == y.GetElementCount() ); for (JIndex i=1; i<=ptCount; i++) { AddPoint(x.GetElement(i), y.GetElement(i)); } }
void GRaggedFloatTableData::DuplicateRow ( const JIndex index ) { const JSize colCount = itsCols->GetElementCount(); for (JIndex i=1; i<=colCount; i++) { JArray<JFloat>* colData = itsCols->NthElement(i); const JSize rowCount = colData->GetElementCount(); if (index <= rowCount) { const JFloat element = colData->GetElement(index); colData->InsertElementAtIndex(index, element); } } RowsAdded(1); if (itsBroadcast) { Broadcast(JTableData::RowDuplicated(index, index)); } }
const JString& GMessageHeader::GetBaseSubject() { if (itsHasBaseSubject) { return itsBaseSubject; } itsHasBaseSubject = kJTrue; itsBaseSubject = GetSubject(); kFixSubjectRegex.SetCaseSensitive(kJFalse); JArray<JIndexRange> subList; while (kFixSubjectRegex.Match(itsBaseSubject, &subList)) { itsBaseSubject = itsBaseSubject.GetSubstring(subList.GetElement(subList.GetElementCount())); itsBaseSubject.TrimWhitespace(); subList.RemoveAll(); } const JSize length = itsBaseSubject.GetLength(); JIndex findex = 1; while (findex <= length && !isalnum(itsBaseSubject.GetCharacter(findex))) { findex++; } if (findex > 1 && findex <= length) { itsBaseSubject = itsBaseSubject.GetSubstring(findex, length); } return itsBaseSubject; }
JXPSPrintSetupDialog* CBPSPrinter::CreatePrintSetupDialog ( const Destination destination, const JCharacter* printCmd, const JCharacter* fileName, const JBoolean collate, const JBoolean bw ) { assert( itsCBPrintSetupDialog == NULL ); if (itsFontSize == kUnsetFontSize) { JString fontName; CBGetPrefsManager()->GetDefaultFont(&fontName, &itsFontSize); JArray<JIndexRange> matchList; if (nxmRegex.Match(fontName, &matchList)) { const JString hStr = fontName.GetSubstring(matchList.GetElement(2)); const JBoolean ok = hStr.ConvertToUInt(&itsFontSize); assert( ok ); itsFontSize--; } } itsCBPrintSetupDialog = CBPSPrintSetupDialog::Create(destination, printCmd, fileName, collate, bw, itsFontSize, (CBGetPTTextPrinter())->WillPrintHeader()); return itsCBPrintSetupDialog; }
JBoolean CBCommandTable::WillAcceptDrop ( const JArray<Atom>& typeList, Atom* action, const JPoint& pt, const Time time, const JXWidget* source ) { if (source == this) { return kJTrue; } else if (source == NULL) { return kJFalse; } const JSize typeCount = typeList.GetElementCount(); for (JIndex i=1; i<=typeCount; i++) { if (typeList.GetElement(i) == itsCommandXAtom) { return kJTrue; } } return kJFalse; }
JBoolean JXPathInput::WillAcceptDrop ( const JArray<Atom>& typeList, Atom* action, const JPoint& pt, const Time time, const JXWidget* source ) { itsExpectURLDropFlag = kJFalse; const Atom urlXAtom = (GetSelectionManager())->GetURLXAtom(); JString dirName; const JSize typeCount = typeList.GetElementCount(); for (JIndex i=1; i<=typeCount; i++) { if (typeList.GetElement(i) == urlXAtom && GetDroppedDirectory(time, kJFalse, &dirName)) { *action = (GetDNDManager())->GetDNDActionPrivateXAtom(); itsExpectURLDropFlag = kJTrue; return kJTrue; } } return JXInputField::WillAcceptDrop(typeList, action, pt, time, source); }
JBoolean JParseURL ( const JCharacter* url, JString* protocol, JString* host, JIndex* port, JString* path ) { *path = url; JArray<JIndexRange> matchList; if (urlPattern.Match(url, &matchList)) { protocol->Set(url, matchList.GetElement(2)); host->Set(url, matchList.GetElement(3)); JIndexRange r = matchList.GetElement(4); if (!r.IsEmpty()) { const JString s(url, r); if (!s.ConvertToUInt(port)) { *port = 0; } } else { *port = 0; } r = matchList.GetElement(5); if (!r.IsEmpty()) { path->Set(url, r); } else { *path = "/"; } return kJTrue; } return kJFalse; }
JBoolean JXExprEditor::EIPGetExternalClipboard ( JString* text ) { text->Clear(); JBoolean gotData = kJFalse; JXSelectionManager* selManager = GetSelectionManager(); JArray<Atom> typeList; if (selManager->GetAvailableTypes(kJXClipboardName, CurrentTime, &typeList)) { JBoolean canGetText = kJFalse; Atom textType = None; const JSize typeCount = typeList.GetElementCount(); for (JIndex i=1; i<=typeCount; i++) { Atom type = typeList.GetElement(i); if (type == XA_STRING || (!canGetText && type == selManager->GetUtf8StringXAtom())) { canGetText = kJTrue; textType = type; break; } } Atom returnType; unsigned char* data = NULL; JSize dataLength; JXSelectionManager::DeleteMethod delMethod; if (canGetText && selManager->GetData(kJXClipboardName, CurrentTime, textType, &returnType, &data, &dataLength, &delMethod)) { if (returnType == XA_STRING) { *text = JString(reinterpret_cast<JCharacter*>(data), dataLength); gotData = kJTrue; } selManager->DeleteData(&data, delMethod); } else { (JGetUserNotification())->ReportError( "Unable to paste the current contents of the X Clipboard."); } } else { (JGetUserNotification())->ReportError("The X Clipboard is empty."); } return gotData; }
void JXTabGroup::ScrollUpToTab ( const JIndex index ) { assert( itsTitles->IndexValid(index) ); assert( index > itsFirstDrawIndex ); const JFontManager* fontMgr = GetFontManager(); const JFontID fontID = fontMgr->GetFontID(itsFontName, itsFontSize, itsFontStyle); const JCoordinate scrollArrowWidth = 2*(kArrowWidth + kBorderWidth); const JRect ap = GetAperture(); const JCoordinate min = (itsEdge == kTop || itsEdge == kBottom ? ap.left : ap.top); const JCoordinate max = (itsEdge == kTop || itsEdge == kBottom ? ap.right : ap.bottom); JCoordinate left = min + kSelMargin; JCoordinate right = left; JArray<JCoordinate> widthList; const JSize count = itsTitles->GetElementCount(); JBoolean offScreen = kJFalse; for (JIndex i=itsFirstDrawIndex; i<=index; i++) { const TabInfo info = itsTabInfoList->GetElement(index); right += 2*kBorderWidth + info.preMargin + info.postMargin + fontMgr->GetStringWidth(fontID, itsFontSize, itsFontStyle, *(itsTitles->NthElement(i))); if (info.closable) { right += kCloseMarginWidth + itsCloseImage->GetWidth(); } widthList.AppendElement(right - left); if (!offScreen && right >= max - scrollArrowWidth && !(itsFirstDrawIndex == 1 && i == count && right <= max)) { offScreen = kJTrue; } left = right; } if (offScreen) { JIndex i = 1; while (right > max - scrollArrowWidth && itsFirstDrawIndex < index) { right -= widthList.GetElement(i); itsFirstDrawIndex++; i++; } } }
JFontStyle CBHTMLStyler::GetTagStyle ( const JIndexRange& tokenRange, const JIndex typeIndex ) { const JString& text = GetText(); JFontStyle style; JArray<JIndexRange> matchList; if (tagNamePattern.MatchWithin(text, tokenRange, &matchList)) { itsLatestTagName = text.GetSubstring(matchList.GetElement(2)); itsLatestTagName.ToLower(); JString openTag; if (itsLatestTagName.GetFirstCharacter() == '/' && itsLatestTagName.GetLength() > 1) { openTag = itsLatestTagName.GetSubstring(2, itsLatestTagName.GetLength()); } JBoolean found = GetWordStyle(itsLatestTagName, &style); if (!found && !openTag.IsEmpty()) { found = GetWordStyle(openTag, &style); } if (!found) { found = GetXMLStyle(itsLatestTagName, &style); } if (!found && !openTag.IsEmpty()) { found = GetXMLStyle(openTag, &style); } if (!found) { style = GetTypeStyle(typeIndex); } } else if (text.GetCharacter(tokenRange.first) == '<') { itsLatestTagName.Clear(); style = GetTypeStyle(typeIndex); } else { style = GetStyle(typeIndex, itsLatestTagName); } return style; }
void TestWidget::PrintSelectionTargets ( const Time time ) { JXDisplay* display = GetDisplay(); JXSelectionManager* selMgr = GetSelectionManager(); JXDNDManager* dndMgr = GetDNDManager(); JArray<Atom> typeList; if (selMgr->GetAvailableTypes(kJXClipboardName, time, &typeList)) { std::cout << std::endl; std::cout << "Data types available from the clipboard:" << std::endl; std::cout << std::endl; const JSize typeCount = typeList.GetElementCount(); for (JIndex i=1; i<=typeCount; i++) { const Atom type = typeList.GetElement(i); std::cout << XGetAtomName(*display, type) << std::endl; } for (JIndex i=1; i<=typeCount; i++) { const Atom type = typeList.GetElement(i); if (type == XA_STRING || type == selMgr->GetUtf8StringXAtom() || type == selMgr->GetMimePlainTextXAtom()) { std::cout << std::endl; PrintSelectionText(kJXClipboardName, time, type); } } } else { std::cout << std::endl; std::cout << "Unable to access the clipboard." << std::endl; std::cout << std::endl; } }
void JExtractFileAndLine ( const JCharacter* str, JString* fileName, JIndex* startLineIndex, JIndex* endLineIndex ) { static JRegex lineIndexRegex(":([0-9]+)(-([0-9]+))?$"); *fileName = str; JArray<JIndexRange> matchList; if (lineIndexRegex.Match(*fileName, &matchList)) { JString s = fileName->GetSubstring(matchList.GetElement(2)); JBoolean ok = s.ConvertToUInt(startLineIndex); assert( ok ); const JIndexRange endRange = matchList.GetElement(4); if (endLineIndex != NULL && !endRange.IsEmpty()) { s = fileName->GetSubstring(endRange); ok = s.ConvertToUInt(endLineIndex); assert( ok ); } else if (endLineIndex != NULL) { *endLineIndex = *startLineIndex; } fileName->RemoveSubstring(matchList.GetElement(1)); } else { *startLineIndex = 0; if (endLineIndex != NULL) { *endLineIndex = 0; } } }
static void jCleanUserInfoMap() { const JSize count = theUserInfoMap.GetElementCount(); for (JIndex i=1; i<=count; i++) { jUIDInfo info = theUserInfoMap.GetElement(i); info.Free(); } }
JBoolean TestWidget::WillAcceptDrop ( const JArray<Atom>& typeList, Atom* action, const Time time, const JXWidget* source ) { JXDNDManager* dndMgr = GetDNDManager(); if (typeList.GetFirstElement() == (GetSelectionManager())->GetURLXAtom()) { cout << endl; cout << "Accepting the drop of type text/uri-list" << endl; cout << endl; *action = dndMgr->GetDNDActionPrivateXAtom(); return kJTrue; } else if (*action == dndMgr->GetDNDActionCopyXAtom()) { cout << endl; cout << "Accepting the drop" << endl; cout << endl; PrintSelectionText(dndMgr->GetDNDSelectionName(), time, (GetSelectionManager())->GetMimePlainTextXAtom()); return kJTrue; } else { JXDisplay* display = GetDisplay(); cout << endl; cout << "Not accepting the drop because the action isn't copy" << endl; cout << "Action: " << XGetAtomName(*display, *action) << endl; cout << endl; cout << "Data types available from DND source:" << endl; cout << endl; const JSize typeCount = typeList.GetElementCount(); for (JIndex i=1; i<=typeCount; i++) { const Atom type = typeList.GetElement(i); cout << XGetAtomName(*display, type) << endl; } cout << endl; PrintSelectionText(dndMgr->GetDNDSelectionName(), time, (GetSelectionManager())->GetMimePlainTextXAtom()); return kJFalse; } }
JBoolean SVNTabBase::ExecuteDiff ( const JCharacter* origCmd, const JCharacter* rev, const JBoolean isPrev ) { JPtrArray<JString> fileList(JPtrArrayT::kDeleteAll); JArray<JIndex> revList; GetSelectedFilesForDiff(&fileList, &revList); if (fileList.IsEmpty()) { return kJFalse; } (JXGetApplication())->DisplayBusyCursor(); JSubstitute subst; subst.DefineVariable("rev_option", rev); const JBoolean customPrev = JI2B( isPrev && !revList.IsEmpty() ); const JSize count = fileList.GetElementCount(); JString cmd, fullName, r; for (JIndex i=1; i<=count; i++) { cmd = origCmd; fullName = JPrepArgForExec(*(fileList.NthElement(i))); if (customPrev) { const JIndex j = revList.GetElement(i); r = JString(j-1, JString::kBase10); r += ":"; r += JString(j, JString::kBase10); subst.DefineVariable("rev_option", r); } subst.DefineVariable("file_name", fullName); subst.Substitute(&cmd); if (itsDirector->HasPath()) { JSimpleProcess::Create(itsDirector->GetPath(), cmd, kJTrue); } else { JSimpleProcess::Create(cmd, kJTrue); } } return kJTrue; }
JX2DCurveNameList::JX2DCurveNameList ( const JArray<J2DCurveInfo>& curveInfo, const JIndex startIndex, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXEditTable(1, kDefColWidth, scrollbarSet, enclosure, hSizing,vSizing, x,y, w,h), itsInput(NULL) { itsMinColWidth = 1; const JFontManager* fontMgr = GetFontManager(); const JSize rowHeight = 2*kVMarginWidth + fontMgr->GetDefaultFont().GetLineHeight(); SetDefaultRowHeight(rowHeight); const JSize count = curveInfo.GetElementCount(); itsNameList = jnew JPtrArray<JString>(JPtrArrayT::kForgetAll, count); assert(itsNameList != NULL); AppendRows(count); for (JIndex i=1; i<=count; i++) { const J2DCurveInfo info = curveInfo.GetElement(i); itsNameList->Append(info.name); const JCoordinate width = 2*kHMarginWidth + fontMgr->GetDefaultFont().GetStringWidth(*(info.name)); if (width > itsMinColWidth) { itsMinColWidth = width; } } AppendCols(1); AdjustColWidth(); JXColormap* colormap = GetColormap(); SetRowBorderInfo(0, colormap->GetBlackColor()); SetColBorderInfo(0, colormap->GetBlackColor()); BeginEditing(JPoint(1, startIndex)); }
void JColormap::SetDynamicColors ( const JArray<JDynamicColorInfo>& colorList ) { const JSize count = colorList.GetElementCount(); for (JIndex i=1; i<=count; i++) { const JDynamicColorInfo info = colorList.GetElement(i); SetDynamicColor(info.index, info.color); } }
JFloat JPlotLinearFit::ChiSqr ( JFloat Bt ) { const JPlotDataBase* data = GetDataToFit(); J2DDataPoint point; const JSize count = data->GetElementCount(); JArray<JFloat> err; JArray<JFloat> W; JFloat temp1; JFloat temp2; JSize i; temp1 = 0; temp2 = 0; for ( i = 1; i <= count; i++) { if (GetDataElement(i, &point)) { JFloat sy = point.yerr; if (sy == 0) { sy = 1; } JFloat e = point.xerr * point.xerr * Bt * Bt + sy * sy; err.AppendElement(e); JFloat w = 1/e; W.AppendElement(w); temp1 += w * (point.y - Bt*point.x); temp2 += w; } } itsAParameterT = temp1/temp2; JFloat c = 0; JSize counter = 1; for ( i = 1; i <= count; i++) { if (GetDataElement(i, &point)) { JFloat val = point.y - itsAParameterT - Bt*point.x; c += (val*val)/(err.GetElement(counter)); counter++; } } return c;//sqrt(fabs(c)); }
JBoolean CBHTMLScanner::IsScript ( JString* language ) const { scriptTagPattern1.SetCaseSensitive(kJFalse); scriptTagPattern2.SetCaseSensitive(kJFalse); scriptTagPattern3.SetCaseSensitive(kJFalse); language->Clear(); const JString& text = GetScannedText(); const JCharacter* s = text.GetCString() + itsCurrentRange.first - 1; JIndexRange r = itsCurrentRange - (itsCurrentRange.first - 1); JArray<JIndexRange> matchList; if (scriptTagPattern1.MatchWithin(s, r, &matchList)) { *language = text.GetSubstring(matchList.GetElement(2) + (itsCurrentRange.first - 1)); return kJTrue; } else if (scriptTagPattern2.MatchWithin(s, r, &matchList)) { *language = text.GetSubstring(matchList.GetElement(2) + (itsCurrentRange.first - 1)); return kJTrue; } else if (scriptTagPattern3.MatchWithin(s, r)) { *language = "JavaScript"; return kJTrue; } else { return kJFalse; } }
static JBoolean jGetUserInfo ( const uid_t uid, jUIDInfo* info ) { if (theUserInfoMap.IsEmpty()) { theUserInfoMap.SetCompareFunction(jCompareUIDs); theUserInfoMap.SetSortOrder(JOrderedSetT::kSortAscending); atexit(jCleanUserInfoMap); } const jUIDInfo target = { uid, NULL, NULL }; JIndex i; if (theUserInfoMap.SearchSorted(target, JOrderedSetT::kAnyMatch, &i)) { *info = theUserInfoMap.GetElement(i); } else { passwd* pwbuf = getpwuid(uid); if (pwbuf != NULL) { info->userName = new JString(pwbuf->pw_name); assert( info->userName != NULL ); info->realName = new JString(pwbuf->pw_gecos); assert( info->realName != NULL ); info->homeDirectory = new JString(pwbuf->pw_dir); assert( info->homeDirectory != NULL ); info->shell = new JString(pwbuf->pw_shell); assert( info->shell != NULL ); info->id = uid; const JBoolean inserted = theUserInfoMap.InsertSorted(*info, kJFalse); assert( inserted ); } else { info->userName = info->realName = info->homeDirectory = info->shell = NULL; } } return JI2B( info->userName != NULL ); }
void JXExprEditor::UpdateEditMenu() { const JArray<JBoolean> enableFlags = GetCmdStatus(NULL); const JSize count = itsEditMenu->GetItemCount(); for (JIndex i=1; i<=count; i++) { CmdIndex cmd; if (EditMenuIndexToCmd(i, &cmd) && enableFlags.GetElement(cmd)) { itsEditMenu->EnableItem(i); } } }
void JXImage::RegisterColors ( const JArray<JColorIndex>& colorList, const JBoolean tellColormap ) { if (itsDepth > 1) { const JSize count = colorList.GetElementCount(); for (JIndex i=1; i<=count; i++) { RegisterColor(colorList.GetElement(i), tellColormap); } } }
void JXExprEditor::UpdateMathMenu() { const JCharacter* evalStr; const JArray<JBoolean> enableFlags = GetCmdStatus(&evalStr); for (JIndex i=1; i<=kMathMenuItemCount; i++) { if (enableFlags.GetElement(kMathMenuItemToCmd[i-1])) { itsMathMenu->EnableItem(i); } } itsMathMenu->SetItemText(kEvaluateItemIndex, evalStr); }
void CBStylerBase::WritePrefs ( ostream& output ) const { JIndex i; output << kCurrentSetupVersion; output << ' ' << IsActive(); // type styles const JSize typeCount = itsTypeStyles->GetElementCount(); output << ' ' << typeCount; for (i=1; i<=typeCount; i++) { WriteStyle(output, itsTypeStyles->GetElement(i)); } output << ' ' << itsTypeNameVersion; // word styles JArray<WordStyle> wordList; GetWordList(*itsWordStyles, &wordList, kJFalse); const JSize wordCount = wordList.GetElementCount(); output << ' ' << wordCount; JString s; for (i=1; i<=wordCount; i++) { const WordStyle style = wordList.GetElement(i); s = style.key; output << ' ' << s; WriteStyle(output, style.value); } // dialog geometry output << ' ' << itsDialogGeom; }
void TestWidget::HandleDNDDrop ( const JPoint& pt, const JArray<Atom>& typeList, const Atom action, const Time time, const JXWidget* source ) { JXDisplay* display = GetDisplay(); JXSelectionManager* selMgr = GetSelectionManager(); std::cout << std::endl; std::cout << "Data types available from DND source:" << std::endl; std::cout << std::endl; // (JGetUserNotification())->DisplayMessage("testing"); Atom textType = None; JBoolean url = kJFalse; const JSize typeCount = typeList.GetElementCount(); for (JIndex i=1; i<=typeCount; i++) { const Atom type = typeList.GetElement(i); std::cout << XGetAtomName(*display, type) << std::endl; if (type == selMgr->GetMimePlainTextXAtom()) { textType = type; } else if (type == selMgr->GetURLXAtom()) { url = kJTrue; } } std::cout << std::endl; if (textType != None) { PrintSelectionText(GetDNDManager()->GetDNDSelectionName(), time, textType); } if (url) { PrintFileNames(GetDNDManager()->GetDNDSelectionName(), time); } }
void GMessageHeader::DecodeMIMEHeader ( JString* header ) { JArray<JIndexRange> subList; JSize count = encodedMIMEQRegex.MatchAll(*header, &subList); JBoolean qType = kJTrue; if (count == 0) { count = encodedMIMEBRegex.MatchAll(*header, &subList); qType = kJFalse; } if (count > 0) { JString temp; JIndex mIndex = 1; const JSize count = subList.GetElementCount(); for (JIndex i = 1; i <= count; i++) { JIndexRange range = subList.GetElement(i); // if ((range.first != mIndex) && // RangeContainsNWS(*header, mIndex, range.first)) // { // temp += header->GetSubstring(mIndex, range.first - 1); // } if (range.first != mIndex) { JString trimmed = header->GetSubstring(mIndex, range.first - 1); trimmed.TrimWhitespace(); if (!trimmed.IsEmpty()) { temp += header->GetSubstring(mIndex, range.first - 1); } } temp += DecodeMIMEWord(qType, header, range); mIndex = range.last + 1; } if (mIndex < header->GetLength()) { temp += header->GetSubstring(mIndex, header->GetLength()); } *header = temp; } }
void GRaggedFloatTableData::SetRow ( const JIndex index, const JArray<JFloat>& rowData ) { const JSize colCount = GetDataColCount(); assert( rowData.GetElementCount() == colCount ); for (JIndex i=1; i<=colCount; i++) { JArray<JFloat>* dataCol = itsCols->NthElement(i); dataCol->SetElement(index, rowData.GetElement(i)); } Broadcast(JTableData::RectChanged(JRect(index, 1, index+1, colCount+1))); }