// Go to next directory entry and return its name FXbool FXDir::next(FXString& name){ if(isOpen()){ #ifdef WIN32 if(((SPACE*)space)->first || FindNextFile(((SPACE*)space)->handle,&((SPACE*)space)->result)){ ((SPACE*)space)->first=false; name.assign(((SPACE*)space)->result.cFileName); return true; } #else #if defined(FOX_THREAD_SAFE) && !defined(__FreeBSD__) && !defined(__OpenBSD__) if(!readdir_r(((SPACE*)space)->handle,&((SPACE*)space)->result,&((SPACE*)space)->dp) && ((SPACE*)space)->dp){ name.assign(((SPACE*)space)->dp->d_name); return true; } #else if((((SPACE*)space)->dp=readdir(((SPACE*)space)->handle))!=NULL){ name.assign(((SPACE*)space)->dp->d_name); return true; } #endif #endif } name.clear(); return false; }
void flushSegment() { if (segment.length() > 0) { if (justWhiteSpace) { // optimise styleCurrent = stylePrev; } else { pageData += segStyle; } pageData += "("; pageData += segment; pageData += ")Tj\n"; } segment.clear(); *segStyle = '\0'; justWhiteSpace = true; }
void startPage() { pageStarted = true; firstLine = true; pageCount++; double fontAscender = fontToPoints(PDFfontAscenders[fontSet]); yPos = pageHeight - pageMargin.top - fontAscender; // start a new page sprintf(buffer, "BT 1 0 0 1 %d %d Tm\n", pageMargin.left, (int)yPos); // force setting of initial font, colour setStyle(segStyle, -1); strcat(buffer, segStyle); pageData = buffer; xPos = pageMargin.left; segment.clear(); flushSegment(); }