本文整理汇总了C++中Q3CString::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3CString::remove方法的具体用法?C++ Q3CString::remove怎么用?C++ Q3CString::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3CString
的用法示例。
在下文中一共展示了Q3CString::remove方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove_comments
void UmlClassMember::remove_comments(Q3CString & s)
{
int index1 = 0;
if ((index1 = s.find("${comment}")) != -1)
s.remove((unsigned) index1, 10);
else if ((index1 = s.find("${description}")) != -1)
s.remove((unsigned) index1, 14);
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;
}
}
}
示例2: addCopy
void UmlClass::addCopy(bool cte)
{
TRACE_FUNCTION;
UmlOperation * op = UmlOperation::create(this, name());
if (op == 0)
UmlCom::trace("can't add copy contructor");
else {
// to see that it is a copy constructor
op->set_Stereotype("copy");
// add 'source' parameter
UmlParameter param;
param.name = "source";
param.dir = (cte) ? InputDirection : InputOutputDirection;
param.type.type = this;
op->addParameter(0, param);
// add the parameter profile, and
// remove the useless "${type} " mainly to remove the space
Q3CString p = (cte) ? "const ${t0} & ${p0}" : "${t0} & ${p0}";
Q3CString s;
int index;
s = op->cppDecl();
if (s.isEmpty())
s = CppSettings::operationDecl();
if ((index = s.find("${(}")) != -1)
s.insert(index + 4, (const char *)p); //[rageek] cast because Q3CString
if ((index = s.find("${type} ")) != -1)
s.remove(index, 8);
op->set_CppDecl(s);
s = op->cppDef();
if (s.isEmpty())
s = CppSettings::operationDef();
if ((index = s.find("${(}")) != -1)
s.insert(index + 4, (const char *)p); //[rageek] cast because Q3CString
if ((index = s.find("${type} ")) != -1)
s.remove(index, 8);
op->set_CppDef(s);
}
}
示例3: write_type
void UmlClassMember::write_type(FileOut & out, const UmlTypeSpec & t, Q3CString s, const char * k_name, const char * k_type)
{
s = s.simplifyWhiteSpace();
int index;
// remove k_name and all after it except []
if (k_name && *k_name && ((index = s.find(k_name, 0)) != -1)) {//[rageek] Removed CS=FALSE - rethink this, case sensitive
//remove name
s.remove(index, strlen(k_name));
for (;;) {
if (s[index] == ' ')
s.remove(index, 1);
if (s[index] != '[')
break;
index += 1;
int index2;
if ((index2 = s.find(index, ']')) == -1)
break;
index = index2 + 1;
}
s.resize(index);
}
else if ((index = s.find('=')) != -1) {
s.resize(index);
s = s.simplifyWhiteSpace();
}
if (k_type && *k_type && ((index = s.find(k_type)) == -1))
out.idref_datatype(s);
else if (s != k_type) {
// have modifiers
if (t.type != 0) {
s.replace(index, strlen(k_type), t.type->name());
out.idref(s, t.type);
}
else
out.idref_datatype(s.replace(index, strlen(k_type), t.explicit_type));
}
else if (t.type != 0)
out.idref(t.type);
else
out.idref_datatype(t.explicit_type);
}
示例4: compute_dependency
void UmlRelation::compute_dependency(Q3PtrList<CppRefType> & dependencies,
const Q3CString & cl_stereotype,
bool all_in_h) {
if (cl_stereotype == "enum")
return;
switch (relationKind()) {
case aDependency:
if (stereotype() == "friend")
break;
CppRefType::add(roleType(), dependencies, cppDecl() != "#include in source",
roleType()->isCppExternal());
break;
case aGeneralisation:
case aRealization:
CppRefType::add(roleType(), dependencies, TRUE);
break;
default:
Q3CString decl = cppDecl();
int index;
if ((index = decl.find("${static}")) != -1)
decl.remove((unsigned) index, 9);
if ((index = decl.find("${mutable}")) != -1)
decl.remove((unsigned) index, 10);
if ((index = decl.find("${volatile}")) != -1)
decl.remove((unsigned) index, 11);
if ((index = decl.find("${const}")) != -1)
decl.remove((unsigned) index, 8);
if ((index = decl.find("${multiplicity}")) != -1)
decl.remove((unsigned) index, 15);
if ((index = decl.find("${name}")) != -1)
decl.remove((unsigned) index, 7);
if ((index = decl.find("${inverse_name}")) != -1)
decl.remove((unsigned) index, 15);
if ((index = decl.find("${value}")) != -1)
decl.remove((unsigned) index, 8);
if ((index = decl.find("${h_value}")) != -1)
decl.remove((unsigned) index, 10);
if ((index = decl.find("${stereotype}")) != -1)
decl.replace((unsigned) index, 13,
CppSettings::relationAttributeStereotype(stereotype()));
if ((index = decl.find("${association}")) != -1) {
decl.replace((unsigned) index, 14,
association().toString());
}
replace_alias(decl);
UmlTypeSpec type;
type.type = roleType();
UmlClassMember::compute_dependency(dependencies, decl, type, all_in_h);
}
}
示例5: digest
Q3CString Dialog::digest(const QString s)
{
Q3CString c = (const char *) s;
int index;
index = 0;
while ((index = c.find("\\n", index)) != -1) {
c.replace(index, 2, "\n");
index += 1;
}
index = 0;
while ((index = c.find("\\t", index)) != -1) {
c.replace(index, 2, "\t");
index += 1;
}
index = 0;
while ((index = c.find("\r", index)) != -1) {
c.remove(index, 1);
}
return c;
}
示例6: addContructor
void UmlClass::addContructor(bool expl)
{
TRACE_FUNCTION;
QLOG_INFO() << "1.1.1";
UmlOperation * op = UmlOperation::create(this, name());
QLOG_INFO() << "1.1.2";
if (op == 0)
UmlCom::trace("can't add contructor");
else {
QLOG_INFO() << "1.1.3";
Q3CString s;
int index;
// remove the useless "${type} " mainly to remove the space
s = op->cppDecl();
QLOG_INFO() << s;
QLOG_INFO() << "1.1.4";
if (s.isEmpty())
s = CppSettings::operationDecl();
QLOG_INFO() << s;
QLOG_INFO() << "1.1.5";
if ((index = s.find("${type} ")) != -1)
s.remove(index, 8);
QLOG_INFO() << s;
QLOG_INFO() << "1.1.6";
if (expl && ((index = s.find("${name}")) != -1))
s.insert(index, "explicit ");
QLOG_INFO() << s;
QLOG_INFO() << "1.1.7";
op->set_CppDecl(s);
QLOG_INFO() << s;
QLOG_INFO() << "1.1.8";
s = op->cppDef();
QLOG_INFO() << s;
QLOG_INFO() << "1.1.81";
if (s.isEmpty())
s = CppSettings::operationDef();
QLOG_INFO() << "1.1.9";
if ((index = s.find("${type} ")) != -1)
s.remove(index, 8);
QLOG_INFO() << "1.1.10";
op->set_CppDef(s);
}
}
示例7: addDestructor
void UmlClass::addDestructor(bool virt)
{
TRACE_FUNCTION;
UmlOperation * op = UmlOperation::create(this, "~" + name());
if (op == 0)
UmlCom::trace("can't add destructor");
else {
if (virt)
op->set_isCppVirtual(TRUE);
Q3CString s;
int index;
// remove the useless "${type} " mainly to remove the space
s = op->cppDecl();
if (s.isEmpty())
s = CppSettings::operationDecl();
if ((index = s.find("${type} ")) != -1) {
s.remove(index, 8);
op->set_CppDecl(s);
}
s = op->cppDef();
if (s.isEmpty())
s = CppSettings::operationDef();
if ((index = s.find("${type} ")) != -1) {
s.remove(index, 8);
op->set_CppDef(s);
}
}
}
示例8: find_type
bool ClassContainer::find_type(Q3CString type, UmlTypeSpec & typespec,
NDict<Class> & defined) {
typespec.explicit_type = 0;
if ((typespec.type = UmlClass::used(type)) != 0)
return TRUE;
Class * cl = defined[type];
if (cl == 0) {
int index = 0;
while ((index = type.find('<', index)) != -1) {
// goes after <...>
int index2 = index + 1;
unsigned level = 1;
for (;;) {
int c = type[index2++];
if (c == '<')
level += 1;
else if (c == 0)
// wrong template spec
return FALSE;
else if ((c == '>') && (--level == 0)) {
break;
}
}
if ((type[index2] != (char)0) && (defined[type.left(index2)] != (char)0))
// explicit template
index = index2;
else if (defined[type.left(index)] != 0)
// non explicit template, remove <>
type.remove(index, index2 - index);
else
// unknown type
return FALSE;
typespec.type = 0;
if ((cl = defined[type]) != 0)
break;
}
}
return ((cl != 0) && ((typespec.type = cl->get_uml()) != 0));
}
示例9: simplify_comment
// remove first and last line in comment if non significant
Q3CString Lex::simplify_comment(Q3CString & 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;
}
}
}
示例10: compute_dependency
void UmlAttribute::compute_dependency(Q3PtrList<CppRefType> & dependency,
const Q3CString & cl_stereotype,
bool all_in_h) {
if ((cl_stereotype == "enum") || (cl_stereotype == "typedef"))
return;
Q3CString decl = cppDecl();
int index;
if ((index = decl.find("${static}")) != -1)
decl.remove((unsigned) index, 9);
if ((index = decl.find("${mutable}")) != -1)
decl.remove((unsigned) index, 10);
if ((index = decl.find("${volatile}")) != -1)
decl.remove((unsigned) index, 11);
if ((index = decl.find("${const}")) != -1)
decl.remove((unsigned) index, 8);
if ((index = decl.find("${multiplicity}")) != -1)
decl.remove((unsigned) index, 15);
if ((index = decl.find("${value}")) != -1)
decl.remove((unsigned) index, 8);
if ((index = decl.find("${h_value}")) != -1)
decl.remove((unsigned) index, 10);
if ((index = decl.find("${name}")) != -1)
decl.remove((unsigned) index, 7);
if ((index = decl.find("${stereotype}")) != -1)
decl.replace((unsigned) index, 13,
CppSettings::relationAttributeStereotype(stereotype()));
replace_alias(decl);
if (!UmlClassMember::compute_dependency(dependency, decl, type(), all_in_h)) {
write_trace_header();
UmlCom::trace(Q3CString(" <font color=\"red\"><b>type missing for attribute <i>")
+ name() + "</i></b></font><br>");
incr_error();
}
}
示例11: remove_preprocessor
void UmlClassMember::remove_preprocessor(Q3CString & 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 have a separator
if (index3 == -1)
s.truncate(index);
else
s.remove(index, index3 - index);
}
}
示例12: new_one
//.........这里部分代码省略.........
// use a definition where ${body] is not indented
def = " ${comment}${@}${visibility}${final}${static}${abstract}${synchronized}${type} ${name}${(}${)}${throws}${staticnl}{\n${body}}\n";
index = def.find("${type}");
}
if (!array.isEmpty())
def.insert(index + 7, (const char *)array);
if (nativep) {
def.insert(index, "native ");
index += 7;
// no body
int index2 = def.find("${throws}", index+7);
if (index2 != -1) {
def.resize(index2 + 12);
def[index2 + 9] = ';';
def[index2 + 10] = '\n';
}
}
if (strictfp) {
def.insert(index, "strictfp ");
index += 9;
}
if (! oper_templ.isEmpty())
def.insert(index, (const char *)(oper_templ + " "));
if (name == cl->name()) {
// constructor, remove useless ${}
if ((index = def.find("${static}")) != -1)
def.remove(index, 9);
if ((index = def.find("${type}")) != -1)
def.remove(index, (((const char *) def)[index + 7] == ' ') ? 8 : 7);
if ((index = def.find("${final}")) != -1)
def.remove(index, 8);
if ((index = def.find("${abstract}")) != -1)
def.remove(index, 11);
}
if (type.type != 0) {
UmlClass::manage_generic(def, type, str_actuals, "${type}");
#ifdef ROUNDTRIP
return_type = type;
#else
op->set_ReturnType(type);
#endif
}
else if (first_actual_class != 0) {
#ifndef ROUNDTRIP
UmlTypeSpec return_type;
#endif
return_type.type = first_actual_class;
def.replace(def.find("${type}"), 7, type_def);
#ifndef ROUNDTRIP
op->set_ReturnType(return_type);
#endif
}
else if (!type.explicit_type.isEmpty()) {
// not a contructor
#ifdef ROUNDTRIP
return_type = type;
#else
示例13: compute_dependency
void UmlClass::compute_dependency(Q3PtrList<CppRefType> & dependencies,
const Q3CString &, bool all_in_h) {
Q3PtrVector<UmlItem> ch = children();
const Q3CString stereotype = cpp_stereotype();
bool a_typedef = (stereotype == "typedef");
bool an_enum = (stereotype == "enum");
const Q3ValueList<UmlFormalParameter> formals = this->formals();
const Q3ValueList<UmlActualParameter> actuals = this->actuals();
if (!formals.isEmpty())
// template class, force depend in h
all_in_h = TRUE;
for (unsigned index = 0; index != ch.size(); index += 1) {
if (ch[index]->kind() != aNcRelation) {
UmlClassItem * it = (UmlClassItem *) ch[index];
if (! it->cppDecl().isEmpty())
it->compute_dependency(dependencies, stereotype, all_in_h);
}
}
if (an_enum && (!formals.isEmpty() || !actuals.isEmpty())) {
write_trace_header();
UmlCom::trace(" <font color=\"red\"><b><i>template enum</i></b></font><br>");
incr_warning();
}
else if (a_typedef && !formals.isEmpty()) {
write_trace_header();
UmlCom::trace(" <font color=\"red\"><b><i>template typedef</i></b></font><br>");
incr_warning();
}
else {
Q3ValueList<UmlFormalParameter>::ConstIterator itf;
for (itf = formals.begin(); itf != formals.end(); ++itf)
CppRefType::remove((*itf).name(), dependencies);
Q3ValueList<UmlActualParameter>::ConstIterator ita;
for (ita = actuals.begin(); ita != actuals.end(); ++ita)
UmlClassMember::compute_dependency(dependencies, "${type}",
(*ita).value(), all_in_h);
if (a_typedef) {
Q3CString decl = cppDecl();
int index;
remove_comments(decl);
if ((index = decl.find("${name}")) != -1)
decl.remove((unsigned) index, 7);
replace_alias(decl);
UmlClassMember::compute_dependency(dependencies, decl,
baseType(), all_in_h);
}
}
if ((associatedArtifact() == 0) ||
(associatedArtifact()->associatedClasses().count() == 1))
CppRefType::remove(this, dependencies);
else
CppRefType::force_ref(this, dependencies);
}