本文整理汇总了C++中Q3CString::stripWhiteSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3CString::stripWhiteSpace方法的具体用法?C++ Q3CString::stripWhiteSpace怎么用?C++ Q3CString::stripWhiteSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3CString
的用法示例。
在下文中一共展示了Q3CString::stripWhiteSpace方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QCOMPARE
void tst_Q3CString::stripWhiteSpace()
{
Q3CString a;
a="Text";
QCOMPARE(a,(Q3CString)"Text");
QCOMPARE(a.stripWhiteSpace(),(Q3CString)"Text");
QCOMPARE(a,(Q3CString)"Text");
a=" ";
QCOMPARE(a.stripWhiteSpace(),(Q3CString)"");
QCOMPARE(a,(Q3CString)" ");
a=" a ";
QCOMPARE(a.stripWhiteSpace(),(Q3CString)"a");
}
示例2: read_list_elt
Q3CString Lex::read_list_elt()
{
const char * p = _context.pointer;
int level = 1;
Q3CString s;
while (!((s = read_word(TRUE)).isEmpty())) {
int c = *s;
if ((c == '>') || (c == ')') || (c == ']')) {
if (--level == 0)
break;
}
else if (c == ',') {
if (level == 1)
break;
}
else if ((c == '<') || (c == '(') || (c == '['))
level += 1;
}
if (! s.isEmpty())
unread_word();
char c = *_context.pointer;
*_context.pointer = 0;
s = p;
*_context.pointer = c;
return s.stripWhiteSpace();
}
示例3: write_multiplicity
void UmlItem::write_multiplicity(FileOut & out, Q3CString s, UmlItem * who)
{
if (!s.isEmpty()) {
Q3CString min;
Q3CString max;
int index = s.find("..");
if (index != -1) {
min = s.left(index).stripWhiteSpace();
max = s.mid(index+2).stripWhiteSpace();
}
else
min = max = s.stripWhiteSpace();
out.indent();
out << "<lowerValue xmi:type=\"uml:LiteralString\"";
out.id_prefix(who, "MULTIPLICITY_L_");
out << " value=\"" << min << "\"/>\n";
out.indent();
out << "<upperValue xmi:type=\"uml:LiteralString\"";
out.id_prefix(who, "MULTIPLICITY_U_");
out << " value=\"" << max << "\"/>\n";
}
}
示例4: write
void UmlClass::write(QTextOStream & f, bool with_formals, BooL * is_template,
const Q3ValueList<UmlActualParameter> & actuals) {
if (context.findRef(this) == -1) {
if (parent()->kind() == aClass) {
if (context.findRef((UmlClass *) parent()) == -1) {
// parent cannot have formals, but may have actuals
((UmlClass *) parent())->write(f, FALSE, 0, actuals);
f << "::";
}
}
else {
UmlArtifact * cp = associatedArtifact();
Q3CString nasp = ((UmlPackage *)
((cp != 0) ? (UmlItem *) cp : (UmlItem *) this)->package())
->cppNamespace();
if (CppSettings::isForceNamespacePrefixGeneration() ||
(nasp != UmlArtifact::generation_package()->cppNamespace()))
f << nasp << "::";
}
}
Q3CString s;
if (isCppExternal()) {
s = cppDecl();
int index = s.find('\n');
s = (index == -1) ? s.stripWhiteSpace()
: s.left(index).stripWhiteSpace();
if ((index = s.find("${name}")) != -1)
s.replace(index, 7, name());
else if ((index = s.find("${Name}")) != -1)
s.replace(index, 7, capitalize(name()));
else if ((index = s.find("${NAME}")) != -1)
s.replace(index, 7, name().upper());
else if ((index = s.find("${nAME}")) != -1)
s.replace(index, 7, name().lower());
}
else
s = name(); // true_name
if (! s.isEmpty()){
f << s;
if (is_template != 0)
*is_template = (s.at(s.length() - 1) == '>');
}
else if (is_template != 0)
*is_template = FALSE;
if (with_formals) {
Q3ValueList<UmlFormalParameter> formals = this->formals();
if (! formals.isEmpty()) {
const char * sep = "<";
Q3ValueList<UmlFormalParameter>::ConstIterator it;
for (it = formals.begin(); it != formals.end(); ++it) {
f << sep << (*it).name();
sep = ", ";
}
f << '>';
if (is_template != 0)
*is_template = TRUE;
}
}
else if (!actuals.isEmpty()) {
Q3ValueList<UmlActualParameter>::ConstIterator ita;
BooL need_space = FALSE;
bool used = FALSE;
for (ita = actuals.begin(); ita != actuals.end(); ++ita) {
if ((*ita).superClass() == this) {
used = TRUE;
(*ita).generate(f, need_space);
}
}
if (used) {
if (need_space)
f << " >";
else
f << '>';
if (is_template != 0)
*is_template = TRUE;
}
}
}
示例5: tool_cmd
bool ClassData::tool_cmd(ToolCom * com, const char * args,
BrowserNode * bn,
const QString & comment) {
if (((unsigned char) args[-1]) >= firstSetCmd) {
if (!bn->is_writable() && !root_permission())
com->write_ack(FALSE);
else {
switch ((unsigned char) args[-1]) {
case setIsAbstractCmd:
if ((*args == 0) &&
strcmp(browser_node->get_stereotype(), "enum") &&
((BrowserClass *) browser_node)->have_abstract_operation()) {
com->write_ack(FALSE);
return TRUE;
}
else
is_abstract = (*args != 0);
break;
case setActiveCmd:
is_active = (*args != 0);
break;
case setVisibilityCmd:
{
UmlVisibility v;
if (! com->get_visibility(v, args)) {
com->write_ack(FALSE);
return TRUE;
}
else
uml_visibility = v;
}
break;
case setBaseTypeCmd:
if (stereotype != "typedef") {
com->write_ack(FALSE);
return TRUE;
}
else {
AType t;
com->get_type(t, args);
set_base_type(t);
}
break;
case setConstraintCmd:
constraint = args;
break;
case setIsCppExternalCmd:
cpp_external = (*args != 0);
break;
case setCppVisibilityCmd:
{
UmlVisibility v;
if (! com->get_extended_visibility(v, args)) {
com->write_ack(FALSE);
return TRUE;
}
else
cpp_visibility = v;
}
break;
case setCppDeclCmd:
cpp_decl = args;
break;
case setIsJavaExternalCmd:
java_external = (*args != 0);
break;
case setJavaDeclCmd:
java_decl = args;
break;
case setJavaAnnotationCmd:
{
Q3CString s = args;
s = s.stripWhiteSpace();
if (! s.isEmpty())
s += '\n';
java_annotation = s;
}
break;
case setIsJavaPublicCmd:
{
UmlVisibility v = (*args != 0) ? UmlPublic : UmlPackageVisibility;
if ((cpp_visibility == UmlDefaultVisibility) &&
(uml_visibility != UmlPublic) &&
(uml_visibility != UmlPackageVisibility))
cpp_visibility = uml_visibility;
uml_visibility = v;
}
break;
case setIsJavaFinalCmd:
java_final = (*args != 0);
break;
case setIsPhpExternalCmd:
php_external = (*args != 0);
break;
case setPhpDeclCmd:
//.........这里部分代码省略.........