本文整理汇总了C++中Q3CString::at方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3CString::at方法的具体用法?C++ Q3CString::at怎么用?C++ Q3CString::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3CString
的用法示例。
在下文中一共展示了Q3CString::at方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decl
Q3CString UmlClass::decl() {
Q3CString result;
Q3CString close_template;
UmlArtifact * cp = associatedArtifact();
Q3CString nasp = ((UmlPackage *)
((cp != 0) ? (UmlItem *) cp : (UmlItem *) this)->package())
->cppNamespace();
if (! nasp.isEmpty()) {
int index =
// bypass :: allowing ::a...
((nasp.at(0) == ':') && (nasp != "::")) ? 2 : 0;
int index2 = 0;
while ((index2 = nasp.find("::", index)) != -1) {
result += "namespace " + nasp.mid(index, index2 - index) + " { ";
close_template += " } ";
index = index2 + 2;
}
result += "namespace " + nasp.mid(index) + " { ";
close_template += " } ";
}
Q3CString template1;
Q3CString template2;
get_template_prefixes(template1, template2);
if (!template1.isEmpty())
result += template1.left(template1.length() - 1) + ' ';
result += cpp_stereotype() + ' ';
return result + name() + ';' + close_template + '\n';
}
示例2: write
void UmlClass::write(QTextOStream & f, const UmlTypeSpec & t,
bool with_formals, BooL * is_template)
{
if (t.type != 0)
t.type->write(f, with_formals, is_template);
else {
Q3CString s = CppSettings::type(t.explicit_type);
f << s;
if (is_template != 0)
*is_template = (!s.isEmpty() && (s.at(s.length() - 1) == '>'));
}
}
示例3: 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';
}
//.........这里部分代码省略.........
示例4: new_one
bool UmlAttribute::new_one(Class * container, const Q3CString & name,
const Q3CString & type, const Q3CString & modifier,
const Q3CString & pretype, const Q3CString & array,
aVisibility visibility, bool staticp, bool constp,
bool typenamep, bool mutablep, bool volatilep,
const Q3CString & bitfield, const Q3CString & value,
Q3CString comment, Q3CString description
#ifdef ROUNDTRIP
, bool roundtrip, Q3PtrList<UmlItem> & expected_order
#endif
)
{
#ifdef DEBUG_BOUML
cout << "ATTRIBUTE '" << name << "' type '" << type << "' modifier '" << modifier << "' array '" << array << "'\n";
#endif
if (
#ifdef REVERSE
container->from_libp() &&
#endif
(visibility == PrivateVisibility)) {
Lex::finish_line();
Lex::clear_comments();
return TRUE;
}
UmlClass * cl = container->get_uml();
UmlAttribute * at;
#ifdef ROUNDTRIP
bool created;
if (!roundtrip ||
((at = search_attr(cl, name)) == 0)) {
#endif
at = UmlBaseAttribute::create(cl, name);
if (at == 0) {
UmlCom::trace(Q3CString("<font face=helvetica><b>cannot add attribute <i>")
+ name + "</i> in <i>" + Q3CString(cl->name())
+ "</i></b></font><br><hr>");
return FALSE;
}
#ifdef REVERSE
# ifndef ROUNDTRIP
Statistic::one_attribute_more();
# else
if (roundtrip)
container->set_updated();
created = TRUE;
}
else
created = FALSE;
# endif
#endif
Lex::finish_line();
comment = Lex::get_comments(comment);
description = Lex::get_description(description);
bool pfunc = (type.find('$') != -1);
UmlTypeSpec typespec;
Q3CString typeform;
Q3CString stereotype;
if (! pfunc) {
typeform = (pretype.isEmpty())
? Q3CString("${type}")
: pretype + " ${type}";
container->compute_type(type, typespec, typeform);
}
else {
typespec.explicit_type = type.simplifyWhiteSpace();
int index = typespec.explicit_type.find("${name}");
if (index != -1)
typespec.explicit_type.remove(index, 7);
}
Q3CString decl = CppSettings::attributeDecl("");
int index = decl.find("${type}");
if ((index == -1) ||
(decl.find("${const}") == -1) ||
(decl.find("${name}") == -1) ||
(decl.find("${mutable}") == -1) ||
(decl.find("${volatile}") == -1) ||
(decl.find(';') == -1)) {
decl = " ${comment}${static}${mutable}${volatile}${const}${type} ${name}${value};";
index = decl.find("${type}");
}
if (pfunc)
decl.replace(index, decl.find("${name}") + 7 - index, type);
else {
if (!modifier.isEmpty())
//.........这里部分代码省略.........
示例5: generate
void UmlRelation::generate(QTextOStream & f, const Q3CString & cl_stereotype,
Q3CString indent) {
switch (relationKind()) {
case aDependency:
case aGeneralisation:
case aRealization:
break;
default:
if (!javaDecl().isEmpty()) {
if (cl_stereotype == "enum_pattern") {
write_trace_header();
UmlCom::trace(" <font color=\"red\"><b>an <i>enum_pattern</i> cannot have relation</b></font><br>");
incr_warning();
return;
}
const char * p = javaDecl();
const char * pp = 0;
Q3CString s;
while ((*p == ' ') || (*p == '\t'))
indent += *p++;
f << indent;
for (;;) {
if (*p == 0) {
if (pp == 0)
break;
// comment management done
p = pp;
pp = 0;
if (*p == 0)
break;
f << indent;
}
if (*p == '\n') {
f << *p++;
if (*p)
f << indent;
}
else if (*p == '@')
manage_alias(p, f);
else if (*p != '$')
f << *p++;
else if (!strncmp(p, "${comment}", 10))
manage_comment(p, pp, JavaSettings::isGenerateJavadocStyleComment());
else if (!strncmp(p, "${description}", 14))
manage_description(p, pp);
else if (!strncmp(p, "${visibility}", 13)) {
p += 13;
generate_visibility(f, cl_stereotype);
}
else if (!strncmp(p, "${static}", 9)) {
p += 9;
if (isClassMember())
f << "static ";
}
else if (!strncmp(p, "${final}", 8)) {
p += 8;
if (isReadOnly())
f << "final ";
}
else if (!strncmp(p, "${transient}", 12)) {
p += 12;
if (isJavaTransient())
f << "transient ";
}
else if (!strncmp(p, "${volatile}", 11)) {
p += 11;
if (isVolatile())
f << "volatile ";
}
else if (!strncmp(p, "${type}", 7)) {
p += 7;
roleType()->write(f);
}
else if (!strncmp(p, "${stereotype}", 13)) {
p += 13;
f << JavaSettings::relationAttributeStereotype(stereotype());
}
else if (!strncmp(p, "${name}", 7)) {
p += 7;
f << roleName();
}
else if (!strncmp(p, "${inverse_name}", 15)) {
p += 15;
switch (relationKind()) {
case anAssociation:
case anAggregation:
case anAggregationByValue:
f << side(side(TRUE) != this)->roleName();
default:
break;
}
}
else if (!strncmp(p, "${multiplicity}", 15)) {
p += 15;
//.........这里部分代码省略.........
示例6: compute_type
void ClassContainer::compute_type(Q3CString type, UmlTypeSpec & typespec,
Q3CString & typeform,
bool get_first_template_actual,
const Q3ValueList<FormalParameterList> & tmplts) {
typespec.type = 0;
typespec.explicit_type = 0;
if (!strncmp((const char *) type, "struct ", 7) ||
!strncmp((const char *) type, "union ", 6) ||
!strncmp((const char *) type, "enum ", 5)) {
typespec.explicit_type = "<complex type>";
typeform = type;
return;
}
int index;
if (get_first_template_actual && ((index = type.find('<')) != -1)) {
type = Lex::normalize(type);
index = type.find('<');
const char * p = type;
if (strncmp(p + index + 1, "const ", 6) == 0)
index += 6;
// look at each actual in <>
unsigned level = 1;
int index2;
Q3CString tf1;
Q3CString t1;
for (;;) {
// earch for the current arg end
for (index2 = index + 1; p[index2]; index2 += 1) {
char c = p[index2];
if ((c == ',') || (c == '*') || (c == '[') || (c == '&')) {
if (level == 1)
break;
}
else if (c == '<')
level += 1;
else if ((c == '>') && (--level == 0))
break;
}
if (p[index2]) {
Q3CString tf = type.left(index + 1) + typeform + type.mid(index2);
Q3CString t = type.mid(index + 1, index2 - index - 1).stripWhiteSpace();
#ifdef DEBUG_BOUML
cout << "typeform '" << tf << "' type '" << t << "'\n";
#endif
UmlTypeSpec ts;
Q3CString normalized = Lex::normalize(t);
if (!find_type(normalized, ts) &&
(Namespace::current().isEmpty() ||
(normalized.at(0) == ':') ||
!find_type("::" + normalized, ts))) {
if (get_first_template_actual) {
get_first_template_actual = FALSE;
tf1 = tf;
t1 = t;
}
index = index2;
}
else {
// find a class
typeform = tf;
type = t;
typespec.type = ts.type;
break;
}
}
else if (!get_first_template_actual) {
// has first actual
typeform = tf1;
type = t1;
break;
}
else {
typespec.explicit_type = type;
return;
}
}
}
if (! tmplts.isEmpty()) {
Q3ValueList<FormalParameterList>::ConstIterator it1;
for (it1 = tmplts.begin(); it1 != tmplts.end(); ++it1) {
FormalParameterList::ConstIterator it2;
for (it2 = (*it1).begin(); it2 != (*it1).end(); ++it2) {
if ((*it2).name() == type) {
typespec.type = 0;
typespec.explicit_type = type;
return;
//.........这里部分代码省略.........
示例7: normalize
Q3CString Lex::normalize(const Q3CString & s)
{
int index = s.find('<');
if (index == -1)
return s;
Q3CString r;
const char * p = s;
index = 0;
for (;;) {
char c = *p++;
switch (c) {
case 0:
return r;
case '<':
if (!r.isEmpty() && (r.at(r.length() - 1) == ' '))
r.truncate(r.length() - 1);
r += '<';
break;
case '>':
if (!r.isEmpty() && (r.at(r.length() - 1) == '>'))
r += " >";
else
r += '>';
break;
case '/':
if (*p == '/') {
// comment
p += 1;
do p += 1;
while (*p && (*p != '\n'));
}
else if (*p == '*') {
/* comment */
p += 1;
do p += 1;
while (*p && ((*p != '*') || (p[1] != '/')));
p += 2;
}
else {
if (!r.isEmpty() && (r.at(r.length() - 1) == ' '))
r.truncate(r.length() - 1);
}
break;
case '#':
do {
if (*++p == '\\')
p += 2;
else if ((*p == '/') && (p[1] == '*')) {
/* comment */
p += 1;
do p += 1; while (*p && ((*p != '*') || (p[1] != '/')));
p += 2;
}
} while (*p && (*p != '\n'));
break;
case '"':
if (!r.isEmpty() &&
(r.at(r.length() - 1) == '"') &&
(p[-2] != '"'))
r += ' ';
do {
if (*++p == '\\')
p += 2;
} while (*p && (*p != '"'));
break;
case '\'':
if (!r.isEmpty() && (r.at(r.length() - 1) == ' '))
r.truncate(r.length() - 1);
do {
if (*++p == '\\')
p += 2;
} while (*p && (*p != '\''));
break;
case ':':
if (!r.isEmpty() && (p[-2] <= ' '))
r += " :";
else
r += ':';
break;
default:
if (c > ' ') {
if (::identifierp(c)) {
if (!r.isEmpty() && ::identifierp(r.at(r.length() - 1)))
r += ' ';
r += c;
while ((*p == ':') || ::identifierp(*p))
r += *p++;
}
else
r += c;
}
}
}
return r;
//.........这里部分代码省略.........