本文整理汇总了C++中Q3CString::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3CString::resize方法的具体用法?C++ Q3CString::resize怎么用?C++ Q3CString::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3CString
的用法示例。
在下文中一共展示了Q3CString::resize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: remove_comments
void UmlClassMember::remove_comments(Q3CString & s)
{
int index;
if ((index = s.find("${comment}")) != -1)
s.replace(index, 10, " ");
index = 0;
while ((index = s.find('#', index)) != -1) {
int index2 = s.find('\n', index + 1);
if (index2 == -1) {
s.resize(index);
break;
}
s.remove(index, index2 - index);
}
index = 0;
while ((index = s.find("//", index)) != -1) {
int index2 = s.find('\n', index + 2);
if (index2 == -1) {
s.resize(index);
break;
}
s.remove(index, index2 - index);
}
index = 0;
while ((index = s.find("/*", index)) != -1) {
int index2 = s.find("*/", index + 2);
if (index2 == -1) {
s.resize(index);
break;
}
s.replace(index, index2 + 2 - index, " ");
}
s = s.simplifyWhiteSpace();
}
示例3: 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;
}
}
}
示例4: qstrlen
Q3CString Q3CString::rightJustify(uint width, char fill, bool truncate) const
{
Q3CString result;
int len = qstrlen(constData());
int padlen = width - len;
if (padlen > 0) {
result.resize(len+padlen);
memset(result.data(), fill, padlen);
memcpy(result.data()+padlen, constData(), len);
} else {
if (truncate)
result = left(width);
else
result = *this;
}
return result;
}
示例5: new_one
bool UmlOperation::new_one(Class * container, const Q3CString & name,
const Q3ValueList<FormalParameterList> & tmplts,
const Q3CString & oper_templ,
UmlTypeSpec & type, Q3CString str_actuals,
UmlClass * first_actual_class, Q3CString type_def,
aVisibility visibility,
bool finalp, bool abstractp, bool staticp,
bool nativep, bool strictfp, bool synchronizedp,
const Q3CString & array, Q3CString comment,
Q3CString description, Q3CString annotation
#ifdef ROUNDTRIP
, bool roundtrip, Q3PtrList<UmlItem> & expected_order
#endif
)
{
// the "(" was read
#ifdef TRACE
QLOG_INFO() <<"OPERATION '" << name << "'\n";
#endif
UmlClass * cl = container->get_uml();
UmlOperation * op;
#ifdef ROUNDTRIP
bool may_roundtrip = roundtrip &&
(!container->from_libp() || (visibility != PrivateVisibility));
UmlTypeSpec return_type;
Q3ValueList<UmlParameter> params;
Q3ValueList<UmlTypeSpec> exceptions;
Q3CString body;
if (may_roundtrip)
#else
if (
# ifdef REVERSE
container->from_libp() &&
# endif
(visibility == PrivateVisibility))
#endif
op = 0;
else {
op = UmlBaseOperation::create(cl, name);
if (op == 0) {
JavaCatWindow::trace(Q3CString("<font face=helvetica><b>cannot add operation <i>")
+ name + "</i> in <i>" + cl->name()
+ "</i></b></font><br>");
return FALSE;
}
#ifndef ROUNDTRIP
# if defined(REVERSE)
Statistic::one_operation_more();
# endif
#endif
}
Q3CString def;
#ifdef ROUNDTRIP
if (may_roundtrip || (op != 0)) {
#else
if (op != 0) {
op->set_Visibility(visibility);
if (staticp) op->set_isClassMember(TRUE);
if (abstractp) op->set_isAbstract(TRUE);
if (finalp) op->set_isJavaFinal(TRUE);
if (synchronizedp) op->set_isJavaSynchronized(TRUE);
if (! annotation.isEmpty()) op->set_JavaAnnotations(annotation);
#endif
def = JavaSettings::operationDef();
int index;
if (((index = def.find("${(}")) == -1) ||
((index = def.find("${)}", index + 4)) == -1) ||
((index = def.find("${throws}", index + 4)) == -1) ||
(def.find("${body}", index + 9) == -1) ||
((index = def.find("${type}")) == -1)) {
// 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';
}
//.........这里部分代码省略.........
示例6: gen_app
void UmlArtifact::gen_app(const Q3CString & path) {
Q3CString target;
Q3CString pro;
propertyValue("genpro target", target);
propertyValue("genpro pro", pro);
if (target.isEmpty()) {
if ((target = name()) == "executable")
target = UmlPackage::getProject()->name();
#ifdef WIN32
target += ".exe";
#endif
}
if (pro.isEmpty()) {
pro = target;
#ifdef WIN32
if (pro.right(4) == ".exe")
pro.resize(pro.length() - 4);
#endif
QDir d(path);
pro = d.absFilePath(pro + ".pro");
}
Q3CString tmplt;
Q3CString config;
Q3CString defines;
Q3CString includepath;
Q3CString dependpath;
Q3CString objectsdir;
Q3CString footer;
if (!propertyValue("genpro tmplt", tmplt))
tmplt = "app";
if (!propertyValue("genpro config", config))
config = "debug warn_on qt";
if (!propertyValue("genpro defines", defines))
defines = "WITHCPP WITHJAVA WITHPHP WITHPYTHON WITHIDL";
else if (defines.find("WITHPHP") == -1) {
int n = 0;
if (defines.find("WITHCPP") != -1)
n += 1;
if (defines.find("WITHJAVA") != -1)
n += 1;
if (defines.find("WITHIDL") != -1)
n += 1;
if (n > 1)
defines += " WITHPHP WITHPYTHON";
}
else if (defines.find("WITHPYTHON") == -1) {
int n = 0;
if (defines.find("WITHCPP") != -1)
n += 1;
if (defines.find("WITHJAVA") != -1)
n += 1;
if (defines.find("WITHIDL") != -1)
n += 1;
if (defines.find("WITHPHP") != -1)
n += 1;
if (n > 1)
defines += " WITHPYTHON";
}
propertyValue("genpro includepath", includepath);
propertyValue("genpro dependpath", dependpath);
propertyValue("genpro objectsdir", objectsdir);
propertyValue("genpro footer", footer);
for (;;) {
Dialog dialog(this, path, pro, target, tmplt, config, defines,
includepath, dependpath, objectsdir, footer);
if (dialog.exec() != QDialog::Accepted)
return;
set_PropertyValue("genpro pro", pro);
set_PropertyValue("genpro path", path);
set_PropertyValue("genpro target", target);
set_PropertyValue("genpro tmplt", tmplt);
set_PropertyValue("genpro config", config);
set_PropertyValue("genpro defines", defines);
set_PropertyValue("genpro includepath", includepath);
set_PropertyValue("genpro dependpath", dependpath);
set_PropertyValue("genpro objectsdir", objectsdir);
set_PropertyValue("genpro footer", footer);
QFile f(pro);
if (! f.open(QIODevice::WriteOnly))
//.........这里部分代码省略.........