Doxygen
qcstring.cpp 文件参考
#include "qcstring.h"
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
+ qcstring.cpp 的引用(Include)关系图:

浏览源代码.

函数

static bool ok_in_base (char c, int base)
 
void * qmemmove (void *dst, const void *src, size_t len)
 
char * qstrdup (const char *str)
 
char * qstrncpy (char *dst, const char *src, size_t len)
 
int qstricmp (const char *str1, const char *str2)
 
int qstrnicmp (const char *str1, const char *str2, size_t len)
 
QCString substitute (const QCString &s, const QCString &src, const QCString &dst)
 substitute all occurrences of src in s by dst 更多...
 
QCString substitute (const QCString &s, const QCString &src, const QCString &dst, int skip_seq)
 substitute all occurrences of src in s by dst, but skip each consecutive sequence of src where the number consecutive src matches skip_seq; if skip_seq is negative, skip any number of consecutive src 更多...
 

函数说明

◆ ok_in_base()

static bool ok_in_base ( char  c,
int  base 
)
static

在文件 qcstring.cpp214 行定义.

215 {
216  if ( base <= 10 )
217  return c>='0' && c<='9' && (c-'0') < base;
218  else
219  return (c>='0' && c<='9') ||
220  (c >= 'a' && c < char('a'+base-10)) ||
221  (c >= 'A' && c < char('A'+base-10));
222 }

被这些函数引用 QCString::toLong(), QCString::toUInt64() , 以及 QCString::toULong().

◆ qmemmove()

void* qmemmove ( void *  dst,
const void *  src,
size_t  len 
)

在文件 qcstring.cpp397 行定义.

398 {
399  char *d;
400  char *s;
401  if ( dst > src ) {
402  d = (char *)dst + len - 1;
403  s = (char *)src + len - 1;
404  while ( len-- )
405  *d-- = *s--;
406  } else if ( dst < src ) {
407  d = (char *)dst;
408  s = (char *)src;
409  while ( len-- )
410  *d++ = *s++;
411  }
412  return dst;
413 }

被这些函数引用 BufStr::at().

◆ qstrdup()

char* qstrdup ( const char *  str)

在文件 qcstring.cpp415 行定义.

416 {
417  if ( !str )
418  return 0;
419  char *dst = new char[qstrlen(str)+1];
420  return strcpy( dst, str );
421 }

引用了 qstrlen().

◆ qstricmp()

int qstricmp ( const char *  str1,
const char *  str2 
)

在文件 qcstring.cpp433 行定义.

434 {
435  const uchar *s1 = (const uchar *)str1;
436  const uchar *s2 = (const uchar *)str2;
437  int res;
438  uchar c;
439  if ( !s1 || !s2 )
440  return s1 == s2 ? 0 : (int)(s2 - s1);
441  for ( ; !(res = (c=(char)tolower(*s1)) - tolower(*s2)); s1++, s2++ )
442  if ( !c ) // strings are equal
443  break;
444  return res;
445 }

被这些函数引用 buildDirectories(), compareDirDefs(), compareFileDefs(), compareString(), VhdlDocGen::findAllArchitectures(), DocGroup::findExistingGroup(), FlowChart::findLabel(), VhdlDocGen::findVhdlClass(), genericCompareMembers(), mainPageHasOwnTitle(), DirDefImpl::matchPath(), parseInput(), qstricmp(), readConfiguration(), searchInputFiles(), NamespaceDefImpl::sortMemberLists(), GroupDefImpl::sortMemberLists(), FileDefImpl::sortMemberLists(), stripFromPath(), transcodeCharacterBuffer(), transcodeCharacterStringToUTF8(), writeColumn(), FlowChart::writeFlowLinks(), ClassDefImpl::writeIncludeFilesForSlice(), writeIndex() , 以及 VhdlDocGen::writeProcedureProto().

◆ qstrncpy()

char* qstrncpy ( char *  dst,
const char *  src,
size_t  len 
)

在文件 qcstring.cpp423 行定义.

424 {
425  if ( !src )
426  return 0;
427  strncpy( dst, src, len );
428  if ( len > 0 )
429  dst[len-1] = '\0';
430  return dst;
431 }

被这些函数引用 do_warn().

◆ qstrnicmp()

int qstrnicmp ( const char *  str1,
const char *  str2,
size_t  len 
)

在文件 qcstring.cpp447 行定义.

448 {
449  const uchar *s1 = (const uchar *)str1;
450  const uchar *s2 = (const uchar *)str2;
451  int res;
452  uchar c;
453  if ( !s1 || !s2 )
454  return (int)(s2 - s1);
455  for ( ; len--; s1++, s2++ ) {
456  if ( (res = (c=(char)tolower(*s1)) - tolower(*s2)) )
457  return res;
458  if ( !c ) // strings are equal
459  break;
460  }
461  return 0;
462 }

被这些函数引用 QCString::contains(), QCString::find(), QCString::findRev() , 以及 qstrnicmp().

◆ substitute() [1/2]

QCString substitute ( const QCString s,
const QCString src,
const QCString dst 
)

substitute all occurrences of src in s by dst

在文件 qcstring.cpp465 行定义.

466 {
467  if (s.isEmpty() || src.isEmpty()) return s;
468  const char *p, *q;
469  int srcLen = src.length();
470  int dstLen = dst.length();
471  int resLen;
472  if (srcLen!=dstLen)
473  {
474  int count;
475  for (count=0, p=s.data(); (q=strstr(p,src.data()))!=0; p=q+srcLen) count++;
476  resLen = s.length()+count*(dstLen-srcLen);
477  }
478  else // result has same size as s
479  {
480  resLen = s.length();
481  }
482  QCString result(resLen+1);
483  char *r;
484  for (r=result.rawData(), p=s.data(); (q=strstr(p,src.data()))!=0; p=q+srcLen)
485  {
486  int l = (int)(q-p);
487  memcpy(r,p,l);
488  r+=l;
489 
490  if (dstLen>0) memcpy(r,dst.data(),dstLen);
491  r+=dstLen;
492  }
493  if (r)
494  {
495  qstrcpy(r,p);
496  }
497  //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data());
498  return result;
499 }

引用了 QCString::data(), QCString::isEmpty(), QCString::length(), qstrcpy() , 以及 QCString::rawData().

被这些函数引用 abbreviate(), addEnumValuesToEnums(), FlowChart::addFlowChart(), addMemberFunction(), addPageToContext(), Markdown::addStrEscapeUtf8Nbsp(), addVariableToClass(), FilterNoWrap::apply(), buildListOfUsingDecls(), buildNamespaceList(), DocParser::checkUnOrMultipleDocumentedParams(), convertFileId2Var(), ResourceMgr::copyResourceAs(), Portable::correct_path(), MemberDefImpl::displayDefinition(), RTFGenerator::endIndexSection(), field2URL(), findDirDocumentation(), DocParser::findDocsForMemberOrCompound(), findGlobalMember(), findGroupScope(), findMember(), findUsingDeclarations(), findUsingDirectives(), fixSpaces(), format_warn(), CitationManager::generatePage(), RefList::generatePage(), VhdlDocGen::getClassName(), getDefs(), DocPara::handleStartCode(), InheritedMemberInfoContext::Private::id(), linkifyText(), linkToText(), makeDisplayName(), matchExcludedSymbols(), Markdown::process(), Markdown::processLink(), processTagLessClasses(), replaceAliasArguments(), resolveRef(), DotFilePatcher::run(), selectBlock(), SearchIndex::setCurrentDoc(), substitute(), substituteHtmlKeywords(), substituteKeywords(), substituteLatexKeywords(), Portable::system(), ConfigImpl::takeStartComment(), ConfigImpl::takeUserComment(), unescapeCRef(), writeAlphabeticalClassList(), writeColumn(), MemberDefImpl::writeDeclaration(), MemberList::writeDeclarations(), writeDefaultLayoutFile(), MemberDefImpl::writeDocumentation(), HtmlGenerator::writeNavigationPath(), HtmlGenerator::writeSearchData(), HtmlGenerator::writeSearchPage(), HtmlGenerator::writeStyleInfo(), HtmlGenerator::writeStyleSheetFile() , 以及 VhdlDocGen::writeVHDLTypeDocumentation().

◆ substitute() [2/2]

QCString substitute ( const QCString s,
const QCString src,
const QCString dst,
int  skip_seq 
)

substitute all occurrences of src in s by dst, but skip each consecutive sequence of src where the number consecutive src matches skip_seq; if skip_seq is negative, skip any number of consecutive src

在文件 qcstring.cpp506 行定义.

507 {
508  if (s.isEmpty() || src.isEmpty()) return s;
509  const char *p, *q;
510  int srcLen = src.length();
511  int dstLen = dst.length();
512  int resLen;
513  if (srcLen!=dstLen)
514  {
515  int count;
516  for (count=0, p=s.data(); (q=strstr(p,src.data()))!=0; p=q+srcLen) count++;
517  resLen = s.length()+count*(dstLen-srcLen);
518  }
519  else // result has same size as s
520  {
521  resLen = s.length();
522  }
523  QCString result(resLen+1);
524  char *r;
525  for (r=result.rawData(), p=s.data(); (q=strstr(p,src.data()))!=0; p=q+srcLen)
526  {
527  // search a consecutive sequence of src
528  int seq = 0, skip = 0;
529  if (skip_seq)
530  {
531  for (const char *n=q+srcLen; qstrncmp(n,src.data(),srcLen)==0; seq=1+skip, n+=srcLen)
532  ++skip; // number of consecutive src after the current one
533 
534  // verify the allowed number of consecutive src to skip
535  if (skip_seq > 0 && skip_seq != seq)
536  seq = skip = 0;
537  }
538 
539  // skip a consecutive sequence of src when necessary
540  int l = (int)((q + seq * srcLen)-p);
541  memcpy(r,p,l);
542  r+=l;
543 
544  if (skip)
545  {
546  // skip only the consecutive src found after the current one
547  q += skip * srcLen;
548  // the next loop will skip the current src, aka (p=q+srcLen)
549  continue;
550  }
551 
552  if (dstLen>0) memcpy(r,dst.data(),dstLen);
553  r+=dstLen;
554  }
555  qstrcpy(r,p);
556  result.resize((int)strlen(result.data())+1);
557  //printf("substitute(%s,%s,%s)->%s\n",s,src,dst,result.data());
558  return result;
559 }

引用了 QCString::data(), QCString::isEmpty(), QCString::length(), qstrcpy(), qstrncmp(), QCString::rawData() , 以及 QCString::resize().

QCString::length
uint length() const
Returns the length of the string, not counting the 0-terminator.
Definition: qcstring.h:147
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
qstrcpy
char * qstrcpy(char *dst, const char *src)
Definition: qcstring.h:71
qstrncmp
int qstrncmp(const char *str1, const char *str2, size_t len)
Definition: qcstring.h:91
uchar
unsigned char uchar
Definition: qcstring.h:38
QCString::data
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:153
qstrlen
uint qstrlen(const char *str)
Definition: qcstring.h:65
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108