当前位置: 首页>>代码示例>>C++>>正文


C++ WrapperStr::mid方法代码示例

本文整理汇总了C++中WrapperStr::mid方法的典型用法代码示例。如果您正苦于以下问题:C++ WrapperStr::mid方法的具体用法?C++ WrapperStr::mid怎么用?C++ WrapperStr::mid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WrapperStr的用法示例。


在下文中一共展示了WrapperStr::mid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
        }
    }
}
开发者ID:gilbertoca,项目名称:douml,代码行数:27,代码来源:UmlOperation.cpp

示例2: 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;
}
开发者ID:daniel7solis,项目名称:douml,代码行数:30,代码来源:UmlClass.cpp

示例3: 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";
    }
}
开发者ID:vresnev,项目名称:douml,代码行数:25,代码来源:UmlItem.cpp

示例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));
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:33,代码来源:UmlArtifact.cpp

示例5: 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;
            }
        }
    }
}
开发者ID:javrillon,项目名称:douml,代码行数:27,代码来源:UmlItem.cpp

示例6: root_relative_if_possible

static WrapperStr root_relative_if_possible(WrapperStr p)
{
    unsigned rln = RootCDir.length();

    return ((p.length() >= rln) && (p.left(rln) == RootCDir))
           ? p.mid(rln)
           : p;
}
开发者ID:jeremysalwen,项目名称:douml,代码行数:8,代码来源:Package.cpp

示例7: 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);
}
开发者ID:daniel7solis,项目名称:douml,代码行数:58,代码来源:UmlClass.cpp

示例8: applyStereotype

void UmlPackage::applyStereotype(FileIn & in, Token & token)
{
    WrapperStr prof_st;
    Q3ValueList<WrapperStr> base_v;
    WrapperStr s;

    if (UmlClass::isAppliedStereotype(token, prof_st, base_v)) {
        WrapperStr s;
        Q3ValueList<WrapperStr>::Iterator it_ext;

        for (it_ext = base_v.begin(); it_ext != base_v.end(); ++it_ext) {
            WrapperStr s2;

            if (token.valueOf(*it_ext, s2)) {
                if (s.isEmpty())
                    s = s2;
                else if (s != s2)
                    in.warning("doesn't refer to the same element ('" + s + "' != '" + s2 + "')");
            }
        }

        if (s.isEmpty())
            in.warning("value of 'base_...' is missing");
        else {
            UmlItem * elt = All[s];

            if (elt == 0) {
                if (!FileIn::isBypassedId(s))
                    in.warning("unknown reference '" + s + "'");
            }
            else {
                elt->set_Stereotype(prof_st);
                elt->UmlItem::applyStereotype();	// set properties

                Q3Dict<WrapperStr> props = elt->properties();
                Q3DictIterator<WrapperStr> it(props);

                while (it.current()) {
                    WrapperStr k = it.currentKey().latin1();

                    if (token.valueOf(k.mid(k.findRev(':') + 1).lower(), s))
                        elt->set_PropertyValue(k, s);

                    ++it;
                }
            }
        }

        if (! token.closed())
            in.finish(token.what());
    }
    else
        in.bypass(token);

}
开发者ID:bleakxanadu,项目名称:douml,代码行数:55,代码来源:UmlPackage.cpp

示例9: importExtension

void UmlItem::importExtension(FileIn & in, Token & token, UmlItem * where)
{
    if (! token.closed()) {
        WrapperStr s = token.valueOf("extender");

        if (s.isNull())
            s = token.valueOf("xmi:extender");

        if (s == "Bouml") {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                s = token.what();

                if (s == "taggedvalue")
                    // is closed
                    where->set_PropertyValue(token.valueOf("tag"), token.valueOf("value"));
                else if (s == "stereotype")
                    where->set_Stereotype(token.valueOf("name"));

                if (! token.closed())
                    in.finish(token.what());
            }
        }
        else if (s == "Visual Paradigm for UML") {
            WrapperStr k = token.what();
            const char * kstr = k;

            while (in.read(), !token.close(kstr)) {
                s = token.what();

                if (s == "appliedstereotype") {
                    s = token.valueOf("xmi:value");

                    if (s.right(3) == "_id") {
                        s = s.mid(s.find("_") + 1);
                        s = s.left(s.length() - 3).lower();
                    }

                    where->set_Stereotype(s);
                }

                if (! token.closed())
                    in.finish(token.what());
            }
        }
        else
            in.finish(token.what());
    }
}
开发者ID:daniel7solis,项目名称:douml,代码行数:51,代码来源:UmlItem.cpp

示例10: define_datatypes

void FileOut::define_datatypes(bool uml_20, bool primitive_type, bool gen_extension)
{
    const char * pfix = (primitive_type)
            ? ((uml_20) ? "<ownedMember xmi:type=\"uml:PrimitiveType\""
                        : "<packagedElement xmi:type=\"uml:PrimitiveType\"")
            : ((uml_20) ? "<ownedMember xmi:type=\"uml:DataType\""
                        : "<packagedElement xmi:type=\"uml:DataType\"");

    QMap<QString, int>::ConstIterator it;

    for (it = _datatypes.begin();
         it != _datatypes.end();
         ++it) {
        indent();
        (*this) << pfix << " xmi:id=\"BOUML_datatype_"
                        << it.value() << "\" name=\"";
        quote(it.key()); //[jasa] ambiguous call
        (*this) << "\"/>\n";
    }

    const char * postfix =
            (uml_20) ? "</ownedMember>\n" : "</packagedElement>\n";

    for (it = _modifiedtypes.begin();
         it != _modifiedtypes.end();
         ++it) {
        WrapperStr k = it.key();
        int index = k.find('_');

        indent();
        (*this) << pfix << " xmi:id=\"BOUML_basedontype_"
                        << it.value() << "\" name = \"";
        quote((const char *)k.mid(index + 1));
        (*this) << '"';

        if (gen_extension) {
            (*this) << ">\n";
            indent();
            (*this) << "\t<xmi:Extension extender=\"Bouml\">\n";
            indent();
            (*this) << "\t\t<basedOn \"BOUML_" << k.left(index).operator QString() << "\"/>\n";
            indent();
            (*this) << "\t</xmi:Extension>\n";
            indent();
            (*this) << postfix;
        }
        else
            (*this) << "/>\n";
    }
}
开发者ID:gilbertoca,项目名称:douml,代码行数:50,代码来源:FileOut.cpp

示例11: decl

WrapperStr UmlClass::decl()
{
    WrapperStr result;
    WrapperStr close_template;
    UmlArtifact * cp = associatedArtifact();
    WrapperStr nasp = ((UmlPackage *)
                      ((cp != 0) ? (UmlItem *) cp : (UmlItem *) this)->package())
                     ->cppNamespace();

    if (!nasp.isEmpty()) {
        int index =
            // bypass :: allowing ::a...
            ((nasp.at(0) == ":") && (nasp != QString("::"))) ? 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 += " } ";
    }

    WrapperStr template1;
    WrapperStr template2;

    get_template_prefixes(template1, template2);

    if (!template1.isEmpty())
        result += template1.left(template1.length() - 1) + ' ';

    result += cpp_stereotype() + ' ';

    return result + name() + ';' + close_template + '\n';
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:37,代码来源:UmlClass.cpp

示例12: is_itself

bool UmlClass::is_itself(WrapperStr t)
{
    // class is a template class and t is x<...> where x is the class,
    // t is normalized
    // return true if t is the class with its formals
    int index = t.find('<');

    t = t.mid(index + 1, t.length() - index - 2);

    QList<UmlFormalParameter> l = formals();
    QList<UmlFormalParameter>::ConstIterator it = l.begin();
    WrapperStr t2 = (*it).name();

    while ((++it) != l.end())
        t2 += ',' + (*it).name();

    return (t == t2);
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:18,代码来源:UmlClass.cpp

示例13: importGeneralization

void UmlItem::importGeneralization(FileIn & in, Token & token, UmlItem * where)
{
    WrapperStr id = token.valueOf("general");
    WrapperStr constraint;

    if (! token.closed()) {
        WrapperStr k = token.what();
        const char * kstr = k;

        while (in.read(), !token.close(kstr)) {
            WrapperStr s = token.what();

            if (s == "general") {
                id = token.xmiIdref();

                if (id.isEmpty() && !(id = token.valueOf("href")).isEmpty()) {
                    int index = id.find('#');

                    if (index != -1)
                        id = id.mid(index + 1);
                }
            }
            else if (s == "ownedrule") {
                constraint = UmlItem::readConstraint(in, token);
                continue;
            }

            if (! token.closed())
                in.finish(s);
        }
    }

    if (!id.isEmpty()) {
        QMap<QString, UmlItem *>::ConstIterator iter = All.find(id);

        if (iter != All.end())
            where->generalizeDependRealize(*iter, in, 0, "", constraint);
        else
            Unresolved::addGeneralization(where, id, constraint);
    }
    else
        in.warning("'general' is missing");
}
开发者ID:daniel7solis,项目名称:douml,代码行数:43,代码来源:UmlItem.cpp

示例14: 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);
        }
    }
}
开发者ID:gilbertoca,项目名称:douml,代码行数:40,代码来源:UmlOperation.cpp

示例15: write_default_value

void UmlItem::write_default_value(FileOut & out, WrapperStr v, UmlItem * who, int rank)
{
    if (! v.isEmpty()) {
        if (v[0] == '=') {
            v = v.mid(1);

            if (v.isEmpty())
                return;
        }

        out.indent();
        out << "<defaultValue xmi:type=\"uml:LiteralString\"";

        if (rank == -1)
            out.id_prefix(who, "VALUE_");
        else
            out.id_prefix(who, "VALUE", rank);

        out << " value=\"";
        out.quote((const char *)v); //[jasa] ambiguous call
        out << "\"/>\n";
    }
}
开发者ID:vresnev,项目名称:douml,代码行数:23,代码来源:UmlItem.cpp


注:本文中的WrapperStr::mid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。