本文整理汇总了C++中WrapperStr::find方法的典型用法代码示例。如果您正苦于以下问题:C++ WrapperStr::find方法的具体用法?C++ WrapperStr::find怎么用?C++ WrapperStr::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WrapperStr
的用法示例。
在下文中一共展示了WrapperStr::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replace_alias
void UmlItem::replace_alias(WrapperStr & s)
{
int index = 0;
while ((index = s.find("@{", index)) != -1) {
int index2 = s.find('}', index + 2);
if (index2 == -1)
return;
UmlBaseItem * obj = this;
WrapperStr key = s.mid(index + 2, index2 - index - 2);
WrapperStr value;
for (;;) {
if (obj->propertyValue(key, value)) {
s.replace(index, index2 - index + 1, value);
index += value.length();
break;
}
else if ((obj = obj->parent()) == 0) {
index = index2 + 1;
break;
}
}
}
}
示例2: write_cpp_returntype
void UmlOperation::write_cpp_returntype(FileOut & out, WrapperStr 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}");
}
示例3: create_directory
static void create_directory(WrapperStr s)
{
int index = 0;
QChar sep = QDir::separator(); //[lgfreitas] QChar does not
if (sep != '/') {
while ((index = s.find(sep, index)) != -1)
s.replace(index++, 1, "/");
}
s = QDir::cleanPath(s) + "/";
index = s.find("/");
int index2;
while ((index2 = s.find("/", index + 1)) != -1) {
WrapperStr s2 = s.left(index2);
QDir sd(s2);
if (!sd.exists()) {
if (!sd.mkdir(s2)) {
UmlCom::trace(WrapperStr("<font color=\"red\"><b> cannot create directory <i>")
+ s2 + "</i></b></font><br>");
UmlCom::bye(n_errors() + 1);
UmlCom::fatal_error("UmlPackage::file_path");
}
}
index = index2;
}
}
示例4: is_imported
bool UmlArtifact::is_imported(WrapperStr path, WrapperStr class_name)
{
if (imports == 0) {
imports = new QHash<WrapperStr, UmlArtifact*>;
WrapperStr s = javaSource();
int index = 0;
while ((index = s.find("import", index)) != -1) {
if ((index == 0) || (s[index - 1] < ' ')) {
int index2 = index + 6;
while ((s[index2] == ' ') || (s[index2] == '\t'))
index2 += 1;
if ((index2 != (index + 6)) &&
((index = s.find(';', index2)) != -1) &&
(index != index2)) {
WrapperStr p = s.mid(index2, index - index2);
imports->insert(p, this);
}
else
index = index2;
}
else
index += 6;
}
}
return ((imports->value(path + '.' + class_name) != 0) ||
(imports->value(path + ".*") != 0));
}
示例5: remove_comments
void UmlClassMember::remove_comments(WrapperStr & 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;
}
}
}
示例6: compute_name
WrapperStr UmlOperation::compute_name()
{
WrapperStr get_set_spec = javaNameSpec();
if (! get_set_spec.isEmpty()) {
UmlClassMember * it;
if ((it = getOf()) == 0)
it = setOf();
int index;
WrapperStr s = (it->kind() == aRelation)
? ((UmlRelation *) it)->roleName()
: it->name();
if ((index = get_set_spec.find("${name}")) != -1)
get_set_spec.replace(index, 7, s);
else if ((index = get_set_spec.find("${Name}")) != -1)
get_set_spec.replace(index, 7, capitalize(s));
else if ((index = s.find("${NAME}")) != -1)
get_set_spec.replace(index, 7, s.upper());
else if ((index = s.find("${nAME}")) != -1)
get_set_spec.replace(index, 7, s.lower());
return get_set_spec;
}
else
return name();
}
示例7: remove_python_comments
void remove_python_comments(WrapperStr & s)
{
int index1 = 0;
while ((index1 = s.find('#', index1)) != -1) {
int index2;
if ((index2 = s.find('\n', index1 + 1)) != -1)
s.remove(index1, index2 - index1 + 1);
else
s.truncate(index1);
}
}
示例8: remove_arrays
void UmlClassMember::remove_arrays(WrapperStr & s)
{
int index1 = 0;
while ((index1 = s.find('[', index1)) != -1) {
int index2 = index1 = s.find(']', index1 + 1);
if (index2 == -1) {
s.truncate(index1);
return;
}
else
s.replace(index1, index2 - index1 + 1, " ");
}
}
示例9: manage_decorators
static void manage_decorators(QTextStream & f, const WrapperStr & decorators,
QString indent, BooL & indent_needed)
{
if (! decorators.isEmpty()) {
int index = 0;
int index2;
while ((index2 = decorators.find("\n", index)) != -1) {
if (indent_needed)
f << indent;
else
indent_needed = TRUE;
f << decorators.mid(index, index2 + 1 - index);
index = index2 + 1;
}
if (index != (int) decorators.length()) {
if (indent_needed) {
f << indent;
indent_needed = FALSE;
}
f << decorators.mid(index);
}
}
}
示例10: write_multiplicity
void UmlItem::write_multiplicity(FileOut & out, WrapperStr s, UmlItem * who)
{
if (!s.isEmpty()) {
WrapperStr min;
WrapperStr 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.operator QString() << "\"/>\n";
out.indent();
out << "<upperValue xmi:type=\"uml:LiteralString\"";
out.id_prefix(who, "MULTIPLICITY_U_");
out << " value=\"" << max.operator QString() << "\"/>\n";
}
}
示例11: isPrimitiveType
bool UmlClass::isPrimitiveType(Token & token, UmlTypeSpec & ts)
{
if (token.xmiType() != "uml:PrimitiveType")
return FALSE;
WrapperStr href = token.valueOf("href");
int index;
if (href.isEmpty() || ((index = href.find('#')) == -1))
return FALSE;
ts.explicit_type = href.mid(index + 1);
if ((CppSettings::type(ts.explicit_type) == ts.explicit_type) &&
CppSettings::umlType(ts.explicit_type).isEmpty()) {
// not defined
href = ts.explicit_type.lower();
if (href == "integer")
ts.explicit_type = "int";
else if (href == "boolean")
ts.explicit_type = "bool";
else if (href == "string")
ts.explicit_type = "string";
else if (href == "unlimitednatural")
ts.explicit_type = "long";
}
return TRUE;
}
示例12: extend
void UmlClass::extend(WrapperStr mcl)
{
if (parent()->parent()->kind() != aPackage)
return;
int index = mcl.find('#');
if (index == -1)
return;
WrapperStr path = mcl.left(index);
const char * defltpath0 = "http://schema.omg.org/spec/UML/2.0/uml.xml";
const char * defltpath1 = "http://schema.omg.org/spec/UML/2.1/uml.xml";
bool dflt = ((path == defltpath0) || (path == defltpath1));
mcl = mcl.mid(index + 1);
static Q3PtrList<UmlClass> metaclasses;
Q3PtrListIterator<UmlClass> it(metaclasses);
UmlClass * metacl = UmlClass::get(mcl, 0);
WrapperStr s;
if ((metacl == 0) ||
(metacl->stereotype() != "metaclass") ||
!((dflt) ? (!metacl->propertyValue("metaclassPath", s) ||
(s == defltpath0) ||
(s == defltpath1))
: (metacl->propertyValue("metaclassPath", s) &&
(path == s)))) {
metacl = 0;
if (dflt) {
for (; (metacl = it.current()) != 0; ++it) {
if (!strcmp(mcl, metacl->name()) &&
(!metacl->propertyValue("metaclassPath", s) ||
(s == defltpath0) ||
(s == defltpath1)))
break;
}
}
else {
for (; (metacl = it.current()) != 0; ++it) {
if (!strcmp(mcl, metacl->name()) &&
metacl->propertyValue("metaclassPath", s) &&
(path == s))
break;
}
}
if (metacl == 0) {
metacl = addMetaclass(mcl, (dflt) ? 0 : (const char *)path); //[rageek] different types for ? :
metaclasses.append(metacl);
}
}
UmlRelation::create(aDirectionalAssociation, this, metacl);
}
示例13: write_java_returntype
void UmlOperation::write_java_returntype(FileOut & out, WrapperStr 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}");
}
示例14: multiplicity_column
unsigned UmlSettings::multiplicity_column(const WrapperStr & mult)
{
if (mult.isEmpty() || (mult == "1"))
return 0;
if ((mult == "*") || (mult.find("..") != -1))
return 1;
return 2;
}
示例15: generate_imports
void UmlOperation::generate_imports(QTextStream & f, WrapperStr & made)
{
WrapperStr s = pythonDecl();
if (!s.isEmpty()) {
UmlArtifact * art = ((UmlClass *) parent())->assocArtifact();
returnType().generate_import(f, art, FALSE, made);
int index1 = s.find("${(}");
if (index1 == -1)
return;
index1 += 4;
int index2 = s.find("${)}", index1);
if (index2 == -1)
return;
s = s.mid((unsigned) index1, (unsigned)(index2 - index1));
const QList<UmlParameter> & params = this->params();
QList<UmlParameter>::ConstIterator it;
unsigned rank;
char ti[16];
strcpy(ti, "${p");
for (it = params.begin(), rank = 0;
it != params.end();
++it, rank += 1) {
sprintf(ti + 3, "%u}", rank);
if (s.find(ti) != -1)
(*it).type.generate_import(f, art, FALSE, made);
}
}
}