本文整理汇总了C++中QCString::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ QCString::remove方法的具体用法?C++ QCString::remove怎么用?C++ QCString::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCString
的用法示例。
在下文中一共展示了QCString::remove方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write_cpp_returntype
void UmlOperation::write_cpp_returntype(FileOut & out, QCString decl) {
// doesn't manage function pointer
// manage keywords
int index;
if ((index = decl.find("${static}")) != -1)
decl.remove(index, 9);
if ((index = decl.find("${friend}")) != -1)
decl.remove(index, 9);
if ((index = decl.find("${virtual}")) != -1)
decl.remove(index, 10);
if ((index = decl.find("${inline}")) != -1)
decl.remove(index, 9);
if ((index = decl.find("${(}")) == -1)
decl = "${type} ${name}";
else
decl.truncate(index);
UmlTypeSpec t = returnType();
if ((t.type != 0) ||
!(t.explicit_type = CppSettings::type(t.explicit_type)).isEmpty())
write_type(out, t, decl, "${name}", "${type}");
}
示例2: remove_comments
void UmlClassItem::remove_comments(QCString & s)
{
int index1 = 0;
while ((index1 = s.find('/', index1)) != -1) {
int index2;
switch (((const char *) s)[index1 + 1]) {
case '/':
if ((index2 = s.find('\n', index1 + 2)) != -1)
s.remove(index1, index2 - index1 + 1);
else
s.truncate(index1);
break;
case '*':
if ((index2 = s.find("*/", index1 + 2)) != -1)
s.replace(index1, index2 - index1 + 1, " ");
else
s.truncate(index1);
break;
default:
index1 += 1;
}
}
}
示例3: stripws
static
void stripws(QCString& s)
{
int f;
while ( (f=s.find(' ')) >= 0 )
s.remove(f,1);
}
示例4: remove_throw
static QCString remove_throw(QCString d)
{
int index;
index = d.find("${throw}");
if (index != -1)
d.remove(index, 8);
return d;
}
示例5: write_java_returntype
void UmlOperation::write_java_returntype(FileOut & out, QCString decl) {
// manage keywords
int index;
if ((index = decl.find("${visibility}")) != -1)
decl.remove(index, 13);
if ((index = decl.find("${final}")) != -1)
decl.remove(index, 8);
if ((index = decl.find("${static}")) != -1)
decl.remove(index, 9);
if ((index = decl.find("${abstract}")) != -1)
decl.remove(index, 11);
if ((index = decl.find("${synchronized}")) != -1)
decl.remove(index, 15);
if ((index = decl.find("${@}")) != -1)
decl.remove(index, 4);
if ((index = decl.find("${(}")) == -1)
decl = "${type} ${name}";
else
decl.truncate(index);
UmlTypeSpec t = returnType();
if ((t.type != 0) ||
!(t.explicit_type = JavaSettings::type(t.explicit_type)).isEmpty())
write_type(out, t, decl, "${name}", "${type}");
}
示例6: simplify_comment
// remove first and last line in comment if non significant
QCString Lex::simplify_comment(QCString & comment)
{
if (comment.isEmpty())
return comment;
const char * s = comment;
const char * p = s;
for (;;) {
switch (*p) {
case 0:
return comment;
case ' ':
case '\t':
p += 1;
break;
case '\n':
comment.remove(0, p - s + 1);
if (comment.isEmpty())
return comment;
s = comment;
// no break
default:
p = s + comment.length() - 1;
while (p != s) {
switch(*p) {
case ' ':
case '\t':
p -= 1;
break;
case '\n':
comment.resize(p - s + 1);
// no break
default:
return comment;
}
}
if (*p == '\n')
comment = "";
return comment;
}
}
}
示例7: QCString
// creates the name for the local text/plain
static const char *localTextPlain()
{
static QCString TextPlainLocal;
if( TextPlainLocal.isNull() )
{
TextPlainLocal = QCString(KGlobal::locale()->encoding()).lower();
// remove the whitespaces
int s;
while( (s=TextPlainLocal.find(' ')) >= 0 )
TextPlainLocal.remove( s, 1 );
TextPlainLocal.prepend( TextPlainLocalStub );
}
return TextPlainLocal;
}
示例8: remove_preprocessor
void UmlClassItem::remove_preprocessor(QCString & s)
{
int index = 0;
while ((index = s.find('#', index)) != -1) {
// remove all up to the end of line
int index2 = index + 1;
int index3;
while ((index3 = s.find('\n', index2)) != -1) {
// manage multi lines #define
if (((const char *) s)[index3 - 1] != '\\')
break;
else
index2 = index3 + 1;
}
// the \n is still here to hava a separator
if (index3 == -1)
s.truncate(index);
else
s.remove(index, index3 - index);
}
}
示例9: parse
static void parse( MetaTranslator *tor, const char *initialContext,
const char *defaultContext )
{
QMap<QCString, QCString> qualifiedContexts;
QStringList namespaces;
QCString context;
QCString text;
QCString com;
QCString functionContext = initialContext;
QCString prefix;
bool utf8 = FALSE;
bool missing_Q_OBJECT = FALSE;
yyTok = getToken();
while ( yyTok != Tok_Eof ) {
switch ( yyTok ) {
case Tok_class:
/*
Partial support for inlined functions.
*/
yyTok = getToken();
if ( yyBraceDepth == (int) namespaces.count() &&
yyParenDepth == 0 ) {
do {
/*
This code should execute only once, but we play
safe with impure definitions such as
'class Q_EXPORT QMessageBox', in which case
'QMessageBox' is the class name, not 'Q_EXPORT'.
*/
functionContext = yyIdent;
yyTok = getToken();
} while ( yyTok == Tok_Ident );
while ( yyTok == Tok_Gulbrandsen ) {
yyTok = getToken();
functionContext += "::";
functionContext += yyIdent;
yyTok = getToken();
}
if ( yyTok == Tok_Colon ) {
missing_Q_OBJECT = TRUE;
} else {
functionContext = defaultContext;
}
}
break;
case Tok_namespace:
yyTok = getToken();
if ( yyTok == Tok_Ident ) {
QCString ns = yyIdent;
yyTok = getToken();
if ( yyTok == Tok_LeftBrace &&
yyBraceDepth == (int) namespaces.count() + 1 )
namespaces.append( QString(ns) );
}
break;
case Tok_tr:
case Tok_trUtf8:
utf8 = ( yyTok == Tok_trUtf8 );
yyTok = getToken();
if ( match(Tok_LeftParen) && matchString(&text) ) {
com = "";
if ( match(Tok_RightParen) || (match(Tok_Comma) &&
matchString(&com) && match(Tok_RightParen)) ) {
if ( prefix.isNull() ) {
context = functionContext;
if ( !namespaces.isEmpty() )
context.prepend( (namespaces.join(QString("::")) +
QString("::")).latin1() );
} else {
context = prefix;
}
prefix = (const char *) 0;
if ( qualifiedContexts.contains(context) )
context = qualifiedContexts[context];
tor->insert( MetaTranslatorMessage(context, text, com,
QString::null, utf8) );
if ( lacks_Q_OBJECT.contains(context) ) {
qWarning( "%s:%d: Class '%s' lacks Q_OBJECT macro",
(const char *) yyFileName, yyLineNo,
(const char *) context );
lacks_Q_OBJECT.remove( context );
} else {
needs_Q_OBJECT.insert( context, 0 );
}
}
}
break;
case Tok_translate:
utf8 = FALSE;
yyTok = getToken();
if ( match(Tok_LeftParen) &&
matchString(&context) &&
match(Tok_Comma) &&
matchString(&text) ) {
com = "";
//.........这里部分代码省略.........
示例10: handleCommentBlock
void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
{
int position=0;
static bool isIn;
QCString doc;
doc.append(doc1);
// fprintf(stderr,"\n %s",doc.data());
if (doc.isEmpty()) return;
if (checkMultiComment(doc,yyLineNr))
{
strComment.resize(0);
return;
}
isIn=checkInlineCode(doc);
bool isEndCode=doc.contains("\\endcode");
// empty comment --!
if (isEndCode)
{
int end=inputString.find(doc.data(),iCodeLen);
makeInlineDoc(end);
strComment.resize(0);
isIn=false;
}
if (isIn)
{
isIn=false;
return;
}
VhdlDocGen::prepareComment(doc);
bool needsEntry=FALSE;
Protection protection=Public;
int lineNr;
if (iDocLine==-1)
lineNr=yyLineNr;
if (oldEntry==current)
{
//printf("\n find pending message < %s > at line: %d \n ",doc.data(),iDocLine);
str_doc.doc=doc;
str_doc.iDocLine=iDocLine;
str_doc.brief=brief;
str_doc.pending=TRUE;
return;
}
oldEntry=current;
if (brief)
{
current->briefLine = yyLineNr;
}
else
{
current->docLine = yyLineNr;
}
// printf("parseCommentBlock file<%s>\n [%s]\n at line [%d] \n ",yyFileName.data(),doc.data(),iDocLine);
int j=doc.find("[plant]");
if (j>=0)
{
doc=doc.remove(j,7);
current->stat=true;
}
while (parseCommentBlock(
g_thisParser,
current,
doc, // text
yyFileName, // file
iDocLine, // line of block start
brief,
0,
FALSE,
protection,
position,
needsEntry
)
)
{
//printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position);
if (needsEntry) newEntry();
}
if (needsEntry)
{
if (varr)
{
varr=FALSE;
current->name=varName;
current->section=Entry::VARIABLEDOC_SEC;
varName="";
}
newEntry();
}
iDocLine=-1;
strComment.resize(0);
}
示例11: translate
QString MIMECodec::translate(const QCString &name)
{
QString output;
if (!name.isEmpty()) {
int begin = -1, end = -1, pos = -1;
QCString translated_name(name);
QCString charset, encoding;
QCString token;
bool sem(true);
while (sem) {
begin = translated_name.find("=?", 0);
if (begin != -1)
end = translated_name.find("?=", begin + 2);
else
end = -1;
if (end != -1) {
output += QString::fromAscii(translated_name.left(begin));
token = translated_name.mid(begin + 2, end - begin - 2);
pos = token.find('?');
charset = token.left(pos);
token.remove(0, pos + 1);
pos = token.find('?');
encoding = token.left(pos);
token.remove(0, pos + 1);
encoding = encoding.upper();
if (encoding == "Q") {
encoding = "quoted-printable";
} else if (encoding == "B") {
encoding = "base64";
} else {
encoding = "none";
}
token = decode(token, encoding);
QTextCodec *codec = QTextCodec::codecForName(charset);
if (codec) {
output += codec->toUnicode(token);
} else {
if (charset.lower() == "utf-8") {
output += QString::fromUtf8(token);
} else if (charset.lower() == "us-ascii") {
output += QString::fromAscii(token);
}
// just use something
else {
qDebug("Warning: could not find textcodec for %s.", (const char *)charset);
output += QString::fromLatin1(token);
}
}
translated_name = translated_name.mid(end + 2);
} else {
output += QString::fromAscii(translated_name);
sem = false;
}
}
}
return output;
}