Doxygen
Loading...
Searching...
No Matches
Portable Namespace Reference

Functions

int system (const QCString &command, const QCString &args, bool commandHasConsole=true)
 
uint32_t pid ()
 
QCString getenv (const QCString &variable)
 
void setenv (const QCString &variable, const QCString &value)
 
void unsetenv (const QCString &variable)
 
FILE * fopen (const QCString &fileName, const QCString &mode)
 
int fclose (FILE *f)
 
void unlink (const QCString &fileName)
 
QCString pathSeparator ()
 
QCString pathListSeparator ()
 
const char * ghostScriptCommand ()
 
const char * commandExtension ()
 
bool fileSystemIsCaseSensitive ()
 
FILE * popen (const QCString &name, const QCString &type)
 
int pclose (FILE *stream)
 
double getSysElapsedTime ()
 
bool isAbsolutePath (const QCString &fileName)
 
void correctPath (const StringVector &list)
 Correct a possible wrong PATH variable.
 
void setShortDir ()
 
const char * strnstr (const char *haystack, const char *needle, size_t haystack_len)
 
const char * devNull ()
 
bool checkForExecutable (const QCString &fileName)
 
size_t recodeUtf8StringToW (const QCString &inputStr, uint16_t **buf)
 
std::ofstream openOutputStream (const QCString &name, bool append=false)
 
std::ifstream openInputStream (const QCString &name, bool binary=false, bool openAtEnd=false)
 

Function Documentation

◆ checkForExecutable()

bool Portable::checkForExecutable ( const QCString & fileName)

Definition at line 440 of file portable.cpp.

441{
442#if defined(_WIN32) && !defined(__CYGWIN__)
443 const char *extensions[] = {".bat",".com",".exe"};
444 for (int i = 0; i < sizeof(extensions) / sizeof(*extensions); i++)
445 {
446 if (ExistsOnPath(fileName + extensions[i])) return true;
447 }
448 return false;
449#else
450 return ExistsOnPath(fileName);
451#endif
452}
static bool ExistsOnPath(const QCString &fileName)
Definition portable.cpp:409

References ExistsOnPath().

Referenced by generateFormula().

◆ commandExtension()

const char * Portable::commandExtension ( )

Definition at line 478 of file portable.cpp.

479{
480#if defined(_WIN32) && !defined(__CYGWIN__)
481 return ".exe";
482#else
483 return "";
484#endif
485}

Referenced by Config::checkAndCorrect(), computeVerifiedDotPath(), and writeDiaGraphFromFile().

◆ correctPath()

void Portable::correctPath ( const StringVector & extraPaths)

Correct a possible wrong PATH variable.

This routine was inspired by the cause for bug 766059 was that in the Windows path there were forward slashes.

Definition at line 533 of file portable.cpp.

534{
535 QCString p = Portable::getenv("PATH");
536 bool first=true;
537 QCString result;
538#if defined(_WIN32) && !defined(__CYGWIN__)
539 for (const auto &path : extraPaths)
540 {
541 if (!first) result+=';';
542 first=false;
543 result += substitute(QCString(path),"/","\\");
544 }
545 if (!result.isEmpty() && !p.isEmpty()) result+=';';
546 result += substitute(p,"/","\\");
547#else
548 for (const auto &path : extraPaths)
549 {
550 if (!first) result+=':';
551 first=false;
552 result += QCString(path);
553 }
554 if (!result.isEmpty() && !p.isEmpty()) result+=':';
555 result += p;
556#endif
557 if (result!=p) Portable::setenv("PATH",result.data());
558 //printf("settingPath(%s) #extraPaths=%zu\n",Portable::getenv("PATH").data(),extraPaths.size());
559}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
void setenv(const QCString &variable, const QCString &value)
Definition portable.cpp:303
QCString getenv(const QCString &variable)
Definition portable.cpp:338
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:477

References QCString::data(), getenv(), QCString::isEmpty(), setenv(), and substitute().

Referenced by parseInput().

◆ devNull()

const char * Portable::devNull ( )

Definition at line 631 of file portable.cpp.

632{
633#if defined(_WIN32) && !defined(__CYGWIN__)
634 return "NUL";
635#else
636 return "/dev/null";
637#endif
638}

Referenced by createDVIFile(), createSVGFromPDFviaInkscape(), and determineInkscapeVersion().

◆ fclose()

int Portable::fclose ( FILE * f)

Definition at line 386 of file portable.cpp.

387{
388 return ::fclose(f);
389}

Referenced by OutputGenerator::endPlainFile(), finishWarnExit(), and initWarningFormat().

◆ fileSystemIsCaseSensitive()

bool Portable::fileSystemIsCaseSensitive ( )

Definition at line 487 of file portable.cpp.

488{
489#if defined(_WIN32) || defined(macintosh) || defined(__MACOSX__) || defined(__APPLE__) || defined(__CYGWIN__)
490 return FALSE;
491#else
492 return TRUE;
493#endif
494}
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34

References FALSE, and TRUE.

Referenced by findFileDef(), genericPatternMatch(), getCaseSenseNames(), and getFilterFromList().

◆ fopen()

FILE * Portable::fopen ( const QCString & fileName,
const QCString & mode )

Definition at line 366 of file portable.cpp.

367{
368#if defined(_WIN32) && !defined(__CYGWIN__)
369 uint16_t *fn = nullptr;
370 size_t fn_len = recodeUtf8StringToW(fileName,&fn);
371 uint16_t *m = nullptr;
372 size_t m_len = recodeUtf8StringToW(mode,&m);
373 FILE *result = nullptr;
374 if (fn_len!=(size_t)-1 && m_len!=(size_t)-1)
375 {
376 result = _wfopen((wchar_t*)fn,(wchar_t*)m);
377 }
378 delete[] fn;
379 delete[] m;
380 return result;
381#else
382 return ::fopen(fileName.data(),mode.data());
383#endif
384}
size_t recodeUtf8StringToW(const QCString &inputStr, uint16_t **buf)
Definition portable.cpp:640

References QCString::data(), and recodeUtf8StringToW().

Referenced by checkPngResult(), FilterCache::getFileContentsPipe(), initWarningFormat(), DotRunner::run(), OutputGenerator::startPlainFile(), and tryPath().

◆ getenv()

QCString Portable::getenv ( const QCString & variable)

Definition at line 338 of file portable.cpp.

339{
340#if defined(_WIN32) && !defined(__CYGWIN__)
341 #define ENV_BUFSIZE 32768
342 LPTSTR pszVal = (LPTSTR) malloc(ENV_BUFSIZE*sizeof(TCHAR));
343 if (GetEnvironmentVariable(variable.data(),pszVal,ENV_BUFSIZE) == 0) return "";
344 QCString out;
345 out = pszVal;
346 free(pszVal);
347 return out;
348 #undef ENV_BUFSIZE
349#else
350 if(!environmentLoaded) // if the environment variables are not loaded already...
351 { // ...call loadEnvironment to store them in class
353 }
354
355 if (proc_env.find(variable.str()) != proc_env.end())
356 {
357 return QCString(proc_env[variable.str()]);
358 }
359 else
360 {
361 return QCString();
362 }
363#endif
364}
const std::string & str() const
Definition qcstring.h:526
static bool environmentLoaded
Definition portable.cpp:38
static std::map< std::string, std::string > proc_env
Definition portable.cpp:39
void loadEnvironment()
Definition portable.cpp:277

References QCString::data(), environmentLoaded, loadEnvironment(), proc_env, and QCString::str().

Referenced by correctPath(), ExistsOnPath(), getCurrentDateTime(), initDoxygen(), parseInput(), setDotFontPath(), and substEnvVarsInString().

◆ getSysElapsedTime()

double Portable::getSysElapsedTime ( )

Definition at line 98 of file portable.cpp.

99{
101}
double elapsedTime() const
Definition portable.cpp:73
static SysTimeKeeper & instance()
Definition portable.cpp:85

References SysTimeKeeper::elapsedTime(), and SysTimeKeeper::instance().

Referenced by generateOutput().

◆ ghostScriptCommand()

const char * Portable::ghostScriptCommand ( )

Definition at line 454 of file portable.cpp.

455{
456#if defined(_WIN32) && !defined(__CYGWIN__)
457 static const char *gsexe = nullptr;
458 if (!gsexe)
459 {
460 const char *gsExec[] = {"gswin32c.exe","gswin64c.exe"};
461 for (int i = 0; i < sizeof(gsExec) / sizeof(*gsExec); i++)
462 {
463 if (ExistsOnPath(gsExec[i]))
464 {
465 gsexe = gsExec[i];
466 return gsexe;
467 }
468 }
469 gsexe = gsExec[0];
470 return gsexe;
471 }
472 return gsexe;
473#else
474 return "gs";
475#endif
476}

References ExistsOnPath().

Referenced by createCroppedEPS(), createCroppedPDF(), createEPSbboxFile(), createPNG(), and writeMakeBat().

◆ isAbsolutePath()

bool Portable::isAbsolutePath ( const QCString & fileName)

Definition at line 514 of file portable.cpp.

515{
516 const char *fn = fileName.data();
517# ifdef _WIN32
518 if (fileName.length()>1 && isalpha(fileName[0]) && fileName[1]==':') fn+=2;
519# endif
520 char const fst = fn[0];
521 if (fst == '/') return true;
522# ifdef _WIN32
523 if (fst == '\\') return true;
524# endif
525 return false;
526}
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153

References QCString::data(), and QCString::length().

Referenced by findFile(), findFile(), generateOutput(), Markdown::Private::processLink(), and readTextFileByName().

◆ openInputStream()

std::ifstream Portable::openInputStream ( const QCString & name,
bool binary = false,
bool openAtEnd = false )

Definition at line 676 of file portable.cpp.

677{
678 std::ios_base::openmode mode = std::ifstream::in | std::ifstream::binary;
679 if (binary) mode |= std::ios::binary;
680 if (openAtEnd) mode |= std::ios::ate;
681#if defined(__clang__) && defined(__MINGW32__)
682 return std::ifstream(fs::path(fileName.str()).wstring(), mode);
683#else
684 return std::ifstream(fs::path(fileName.str()), mode);
685#endif
686}

References QCString::str().

Referenced by configFileToString(), convertMapFile(), DotFilePatcher::convertMapFile(), determineInkscapeVersion(), finishWarnExit(), CitationManager::generatePage(), FormulaManager::initFromRepository(), CitationManager::insertCrossReferencesForBibFile(), Htags::loadFilemap(), preProcessFile(), DotRunner::readBoundingBox(), FilterCache::readFragmentFromFile(), readInputFile(), readSVGSize(), resetPDFSize(), DotFilePatcher::run(), sameMd5Signature(), testRTFOutput(), and updateEPSBoundingBox().

◆ openOutputStream()

std::ofstream Portable::openOutputStream ( const QCString & name,
bool append = false )

Definition at line 665 of file portable.cpp.

666{
667 std::ios_base::openmode mode = std::ofstream::out | std::ofstream::binary;
668 if (append) mode |= std::ofstream::app;
669#if defined(__clang__) && defined(__MINGW32__)
670 return std::ofstream(fs::path(fileName.str()).wstring(), mode);
671#else
672 return std::ofstream(fs::path(fileName.str()), mode);
673#endif
674}

References QCString::str().

Referenced by Qhp::addContentsItem(), ResourceMgr::copyResourceAs(), FormulaManager::createFormulasTexFile(), FormulaManager::createLatexFile(), PerlModGenerator::createOutputFile(), HtmlHelp::Private::createProjectFile(), dumpSymbolMap(), EclipseHelp::finalize(), generateDEF(), generateJSNavTree(), generateJSTreeFiles(), CitationManager::generatePage(), generateXML(), generateXMLForClass(), generateXMLForConcept(), generateXMLForDir(), generateXMLForFile(), generateXMLForGroup(), generateXMLForModule(), generateXMLForNamespace(), generateXMLForPage(), HtmlGenerator::init(), Crawlmap::initialize(), DocSets::initialize(), EclipseHelp::initialize(), HtmlHelp::initialize(), Qhp::initialize(), Sitemap::initialize(), openOutputFile(), DocbookDocVisitor::operator()(), HtmlDocVisitor::operator()(), LatexDocVisitor::operator()(), RTFDocVisitor::operator()(), DotGraph::prepareDotFile(), RTFGenerator::preProcessFileInplace(), resetPDFSize(), DotFilePatcher::run(), runPlantumlContent(), ManGenerator::startDoxyAnchor(), updateEPSBoundingBox(), SearchIndex::write(), SearchIndexExternal::write(), ResourceMgr::writeCategory(), writeCombineScript(), HtmlGenerator::writeExternalSearchPage(), ClassDiagram::writeFigure(), FlowChart::writeFlowChart(), writeJavascriptSearchData(), writeJavaScriptSearchIndex(), writeJavasScriptSearchDataPage(), writeLatexMakefile(), writeMakeBat(), writeMenuData(), HtmlGenerator::writeSearchData(), HtmlGenerator::writeSearchPage(), and writeTagFile().

◆ pathListSeparator()

QCString Portable::pathListSeparator ( )

Definition at line 400 of file portable.cpp.

401{
402#if defined(_WIN32) && !defined(__CYGWIN__)
403 return ";";
404#else
405 return ":";
406#endif
407}

Referenced by ExistsOnPath(), parseInput(), runPlantumlContent(), and setDotFontPath().

◆ pathSeparator()

QCString Portable::pathSeparator ( )

Definition at line 391 of file portable.cpp.

392{
393#if defined(_WIN32) && !defined(__CYGWIN__)
394 return "\\";
395#else
396 return "/";
397#endif
398}

Referenced by Config::checkAndCorrect(), ExistsOnPath(), findFilePath(), readTextFileByName(), writeDiaGraphFromFile(), and writeMscGraphFromFile().

◆ pclose()

int Portable::pclose ( FILE * stream)

Definition at line 505 of file portable.cpp.

506{
507 #if defined(_MSC_VER) || defined(__BORLANDC__)
508 return ::_pclose(stream);
509 #else
510 return ::pclose(stream);
511 #endif
512}

Referenced by FileDefImpl::acquireFileVersion(), FilterCache::getFileContentsPipe(), readInputFile(), runQHelpGenerator(), and stackTrace().

◆ pid()

uint32_t Portable::pid ( )

Definition at line 265 of file portable.cpp.

266{
267 uint32_t pid;
268#if !defined(_WIN32) || defined(__CYGWIN__)
269 pid = static_cast<uint32_t>(getpid());
270#else
271 pid = static_cast<uint32_t>(GetCurrentProcessId());
272#endif
273 return pid;
274}
uint32_t pid()
Definition portable.cpp:265

References pid().

Referenced by initWarningFormat(), parseInput(), pid(), and system().

◆ popen()

FILE * Portable::popen ( const QCString & name,
const QCString & type )

Definition at line 496 of file portable.cpp.

497{
498 #if defined(_MSC_VER) || defined(__BORLANDC__)
499 return ::_popen(name.data(),type.data());
500 #else
501 return ::popen(name.data(),type.data());
502 #endif
503}

References QCString::data().

Referenced by FileDefImpl::acquireFileVersion(), FilterCache::getFileContentsPipe(), readInputFile(), runQHelpGenerator(), and stackTrace().

◆ recodeUtf8StringToW()

size_t Portable::recodeUtf8StringToW ( const QCString & inputStr,
uint16_t ** buf )

Definition at line 640 of file portable.cpp.

641{
642 if (inputStr.isEmpty() || outBuf==nullptr) return 0; // empty input or invalid output
643 void *handle = portable_iconv_open("UTF-16LE","UTF-8");
644 if (handle==reinterpret_cast<void *>(-1)) return 0; // invalid encoding
645 size_t len = inputStr.length();
646 uint16_t *buf = new uint16_t[len+1];
647 *outBuf = buf;
648 size_t inRemains = len;
649 size_t outRemains = len*sizeof(uint16_t)+2; // chars + \0
650 const char *p = inputStr.data();
651 portable_iconv(handle,&p,&inRemains,reinterpret_cast<char **>(&buf),&outRemains);
652 *buf=0;
653 portable_iconv_close(handle);
654 return len;
655}
int portable_iconv_close(void *cd)
size_t portable_iconv(void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
void * portable_iconv_open(const char *tocode, const char *fromcode)

References QCString::data(), QCString::isEmpty(), QCString::length(), portable_iconv(), portable_iconv_close(), and portable_iconv_open().

Referenced by fopen(), and system().

◆ setenv()

void Portable::setenv ( const QCString & variable,
const QCString & value )

Definition at line 303 of file portable.cpp.

304{
305#if defined(_WIN32) && !defined(__CYGWIN__)
306 SetEnvironmentVariable(name.data(),!value.isEmpty() ? value.data() : "");
307#else
308 if(!environmentLoaded) // if the environment variables are not loaded already...
309 { // ...call loadEnvironment to store them in class
311 }
312
313 proc_env[name.str()] = value.str(); // create or replace existing value
314 ::setenv(name.data(),value.data(),1);
315#endif
316}

References QCString::data(), environmentLoaded, QCString::isEmpty(), loadEnvironment(), proc_env, setenv(), and QCString::str().

Referenced by correctPath(), initDoxygen(), parseInput(), setDotFontPath(), setenv(), and unsetDotFontPath().

◆ setShortDir()

void Portable::setShortDir ( )

Definition at line 570 of file portable.cpp.

571{
572#if defined(_WIN32) && !defined(__CYGWIN__)
573 long length = 0;
574 TCHAR* buffer = nullptr;
575 // First obtain the size needed by passing nullptr and 0.
576 length = GetShortPathName(Dir::currentDirPath().c_str(), nullptr, 0);
577 // Dynamically allocate the correct size
578 // (terminating null char was included in length)
579 buffer = new TCHAR[length];
580 // Now simply call again using same (long) path.
581 length = GetShortPathName(Dir::currentDirPath().c_str(), buffer, length);
582 // Set the correct directory (short name)
583 Dir::setCurrent(buffer);
584 delete [] buffer;
585#endif
586}
static std::string currentDirPath()
Definition dir.cpp:340
static bool setCurrent(const std::string &path)
Definition dir.cpp:348

References Dir::currentDirPath(), and Dir::setCurrent().

Referenced by runHtmlHelpCompiler().

◆ strnstr()

const char * Portable::strnstr ( const char * haystack,
const char * needle,
size_t haystack_len )

Definition at line 617 of file portable.cpp.

618{
619 size_t needle_len = strnlen(needle, haystack_len);
620 if (needle_len < haystack_len || !needle[needle_len])
621 {
622 const char *x = portable_memmem(haystack, haystack_len, needle, needle_len);
623 if (x && !memchr(haystack, 0, x - haystack))
624 {
625 return x;
626 }
627 }
628 return nullptr;
629}
static const char * portable_memmem(const char *haystack, size_t haystack_len, const char *needle, size_t needle_len)
Definition portable.cpp:589

References portable_memmem().

Referenced by Markdown::Private::addStrEscapeUtf8Nbsp().

◆ system()

int Portable::system ( const QCString & command,
const QCString & args,
bool commandHasConsole = true )

taken from the system() manpage on my Linux box

Definition at line 106 of file portable.cpp.

107{
108 if (command.isEmpty()) return 1;
109 AutoTimeKeeper timeKeeper;
110
111#if defined(_WIN32) && !defined(__CYGWIN__)
112 QCString commandCorrectedPath = substitute(command,'/','\\');
113 QCString fullCmd=commandCorrectedPath;
114#else
115 QCString fullCmd=command;
116#endif
117 fullCmd=fullCmd.stripWhiteSpace();
118 if (fullCmd.at(0)!='"' && fullCmd.find(' ')!=-1)
119 {
120 // add quotes around command as it contains spaces and is not quoted already
121 fullCmd="\""+fullCmd+"\"";
122 }
123 fullCmd += " ";
124 fullCmd += args;
125#ifndef NODEBUG
126 Debug::print(Debug::ExtCmd,0,"Executing external command `%s`\n",qPrint(fullCmd));
127#endif
128
129#if !defined(_WIN32) || defined(__CYGWIN__)
130 (void)commandHasConsole;
131 /*! taken from the system() manpage on my Linux box */
132 int pid,status=0;
133
134#ifdef _OS_SOLARIS // for Solaris we use vfork since it is more memory efficient
135
136 // on Solaris fork() duplicates the memory usage
137 // so we use vfork instead
138
139 // spawn shell
140 if ((pid=vfork())<0)
141 {
142 status=-1;
143 }
144 else if (pid==0)
145 {
146 execl("/bin/sh","sh","-c",fullCmd.data(),(char*)0);
147 _exit(127);
148 }
149 else
150 {
151 while (waitpid(pid,&status,0 )<0)
152 {
153 if (errno!=EINTR)
154 {
155 status=-1;
156 break;
157 }
158 }
159 }
160 return status;
161
162#else // Other Unices just use fork
163
164 pid = fork();
165 if (pid==-1)
166 {
167 perror("fork error");
168 return -1;
169 }
170 if (pid==0)
171 {
172 const char * const argv[4] = { "sh", "-c", fullCmd.data(), 0 };
173 execve("/bin/sh",const_cast<char * const*>(argv),environ);
174 exit(127);
175 }
176 for (;;)
177 {
178 if (waitpid(pid,&status,0)==-1)
179 {
180 if (errno!=EINTR) return -1;
181 }
182 else
183 {
184 if (WIFEXITED(status))
185 {
186 return WEXITSTATUS(status);
187 }
188 else
189 {
190 return status;
191 }
192 }
193 }
194#endif // !_OS_SOLARIS
195
196#else // Win32 specific
197 if (commandHasConsole)
198 {
199 return ::system(fullCmd.data());
200 }
201 else
202 {
203 // Because ShellExecuteEx can delegate execution to Shell extensions
204 // (data sources, context menu handlers, verb implementations) that
205 // are activated using Component Object Model (COM), COM should be
206 // initialized before ShellExecuteEx is called. Some Shell extensions
207 // require the COM single-threaded apartment (STA) type.
208 // For that case COM is initialized as follows
209 CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
210
211 uint16_t *commandw = nullptr;
212 recodeUtf8StringToW( commandCorrectedPath, &commandw );
213 uint16_t *argsw = nullptr;
214 recodeUtf8StringToW( args, &argsw );
215
216 // gswin32 is a GUI api which will pop up a window and run
217 // asynchronously. To prevent both, we use ShellExecuteEx and
218 // WaitForSingleObject (thanks to Robert Golias for the code)
219
220 SHELLEXECUTEINFOW sInfo = {
221 sizeof(SHELLEXECUTEINFOW), /* structure size */
222 SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI, /* tell us the process
223 * handle so we can wait till it's done |
224 * do not display msg box if error
225 */
226 nullptr, /* window handle */
227 nullptr, /* action to perform: open */
228 (LPCWSTR)commandw, /* file to execute */
229 (LPCWSTR)argsw, /* argument list */
230 nullptr, /* use current working dir */
231 SW_HIDE, /* minimize on start-up */
232 nullptr, /* application instance handle */
233 nullptr, /* ignored: id list */
234 nullptr, /* ignored: class name */
235 nullptr, /* ignored: key class */
236 0, /* ignored: hot key */
237 nullptr, /* ignored: icon */
238 nullptr /* resulting application handle */
239 };
240
241 if (!ShellExecuteExW(&sInfo))
242 {
243 delete[] commandw;
244 delete[] argsw;
245 return -1;
246 }
247 else if (sInfo.hProcess) /* executable was launched, wait for it to finish */
248 {
249 WaitForSingleObject(sInfo.hProcess,INFINITE);
250 /* get process exit code */
251 DWORD exitCode;
252 bool retval = GetExitCodeProcess(sInfo.hProcess,&exitCode);
253 CloseHandle(sInfo.hProcess);
254 delete[] commandw;
255 delete[] argsw;
256 if (!retval) return -1;
257 return exitCode;
258 }
259 }
260#endif
261 return 1; // we should never get here
262
263}
@ ExtCmd
Definition debug.h:35
static void print(DebugMask mask, int prio, const char *fmt,...)
Definition debug.cpp:81
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:567
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245
char ** environ
const char * qPrint(const char *s)
Definition qcstring.h:661

References QCString::at(), QCString::data(), environ, Debug::ExtCmd, QCString::find(), QCString::isEmpty(), pid(), Debug::print(), qPrint(), recodeUtf8StringToW(), QCString::stripWhiteSpace(), and substitute().

Referenced by createCroppedEPS(), createCroppedPDF(), createDVIFile(), createEPSbboxFile(), createPNG(), createPostscriptFile(), FlowChart::createSVG(), createSVGFromPDF(), createSVGFromPDFviaInkscape(), determineInkscapeVersion(), do_mscgen_generate(), Htags::execute(), DocParser::findAndCopyImage(), CitationManager::generatePage(), DotRunner::run(), runHtmlHelpCompiler(), runPlantumlContent(), runQHelpGenerator(), writeDiaGraphFromFile(), ClassDiagram::writeFigure(), and writeMscGraphFromFile().

◆ unlink()

void Portable::unlink ( const QCString & fileName)

Definition at line 561 of file portable.cpp.

562{
563#if defined(_WIN32) && !defined(__CYGWIN__)
564 _unlink(fileName.data());
565#else
566 ::unlink(fileName.data());
567#endif
568}
void unlink(const QCString &fileName)
Definition portable.cpp:561

References QCString::data(), and unlink().

Referenced by finishWarnExit(), RTFGenerator::preProcessFileInplace(), DotRunner::run(), and unlink().

◆ unsetenv()

void Portable::unsetenv ( const QCString & variable)

Definition at line 318 of file portable.cpp.

319{
320#if defined(_WIN32) && !defined(__CYGWIN__)
321 SetEnvironmentVariable(variable.data(),nullptr);
322#else
323 /* Some systems don't have unsetenv(), so we do it ourselves */
324 if (variable.isEmpty() || variable.find('=')!=-1)
325 {
326 return; // not properly formatted
327 }
328
329 auto it = proc_env.find(variable.str());
330 if (it != proc_env.end())
331 {
332 proc_env.erase(it);
333 ::unsetenv(variable.data());
334 }
335#endif
336}
void unsetenv(const QCString &variable)
Definition portable.cpp:318

References QCString::data(), QCString::find(), QCString::isEmpty(), proc_env, QCString::str(), and unsetenv().

Referenced by setDotFontPath(), unsetDotFontPath(), and unsetenv().