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


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

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


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

示例1: isAppliedStereotype

bool UmlClass::isAppliedStereotype(Token & tk, WrapperStr & prof_st, Q3ValueList<WrapperStr> & base_v)
{
    static Q3Dict<WrapperStr> stereotypes;
    static Q3Dict<Q3ValueList<WrapperStr> > bases;

    WrapperStr s = tk.what();
    WrapperStr * st = stereotypes[s];

    if (st != 0) {
        prof_st = *st;
        base_v = *bases[s];
        return TRUE;
    }

    base_v.clear();

    if (tk.xmiType().isEmpty() && (getFct(tk) == 0))  {
        int index = s.find(':');

        if ((index != -1) &&
            ((index != 3) || ((s.left(3) != "uml") && (s.left(3) != "xmi")))) {
            UmlClass * cl = findStereotype(s, FALSE);

            if (cl != 0) {
                const Q3PtrVector<UmlItem> ch = cl->children();
                unsigned n = ch.size();

                for (unsigned i = 0; i != n; i += 1) {
                    UmlItem * x = ch[i];

                    if ((x->kind() == aRelation) &&
                        (((UmlRelation *) x)->relationKind() == aDirectionalAssociation) &&
                        (((UmlRelation *) x)->roleType()->stereotype() == "metaclass"))
                        base_v.append("base_" + ((UmlRelation *) x)->roleType()->name().lower());
                }

                if (base_v.isEmpty())
                    base_v.append("base_element");

                prof_st = cl->parent()->parent()->name() + ":" + cl->name();
                stereotypes.insert(s, new WrapperStr(prof_st));
                bases.insert(s, new Q3ValueList<WrapperStr>(base_v));
                return TRUE;
            }
        }
    }

    return FALSE;
}
开发者ID:daniel7solis,项目名称:douml,代码行数:49,代码来源:UmlClass.cpp

示例2: 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

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

示例4: 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

示例5: 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

示例6: setEncoding

void FileIn::setEncoding(WrapperStr s)
{
    if (s.left(3).lower() == "utf") {
        if (s.right(1) != "8") {
            UmlCom::trace("sorry, in the UTF encoding, only UTF-8 is managed");
            throw 0;
        }
        else
            _utf8 = TRUE;
    }
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:11,代码来源:FileIn.cpp

示例7: 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

示例8: 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

示例9: setInState

void UmlActivityObject::setInState(WrapperStr s)
{
    if (FromBouml && (s.left(8) != "BOUML_0x"))
        set_InState(s);
    else {
        QMap<QString, UmlItem *>::Iterator it = All.find(s);

        if (it != All.end()) {
            if ((*it)->kind() == aState)
                set_InState((*it)->name());
        }
        else
            UnresolvedWithContext::add(this, s, 1);
    }
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:15,代码来源:UmlActivityObject.cpp

示例10: text_path

WrapperStr UmlPackage::text_path(const WrapperStr & f)
{
    WrapperStr r = file_path(f);

    return r.left(r.length() - 1 - PythonSettings::sourceExtension().length());
}
开发者ID:gilbertoca,项目名称:douml,代码行数:6,代码来源:UmlPackage.cpp

示例11: need_artifact

void UmlClass::need_artifact(const WrapperStr & nmsp)
{
    if (parent()->kind() == aClassView) {
        UmlArtifact * cp;

        if ((cp = associatedArtifact()) == 0) {
            // search artifact
#ifdef ROUNDTRIP
            if ((cp = Package::get_artifact()) != 0) {
                cp->addAssociatedClass(this);
                return;
            }

#endif

            WrapperStr name = Package::get_fname();
            int index;

            if (name.isEmpty()) {
                // defined in a source rather than a header
                // will create it own artifact
                name = this->name();
                index = name.find('<');

                if (index != -1)
                    name = name.left(index);
            }

            UmlDeploymentView * cpv =
                ((UmlPackage *) parent()->parent())->get_deploymentview(nmsp);
            const QVector<UmlItem*> & children = cpv->children();
            int n = (int) children.count();

            for (index = 0; index != n; index += 1) {
                if ((children[index]->name() == name) &&
                    (children[index]->kind() == anArtifact)) {
                    cp = (UmlArtifact *) children[index];
                    break;
                }
            }

            if (cp == 0) {
                // does not exist, create associated artifact
                if ((cp = UmlBaseArtifact::create(cpv, name))
                    == 0) {
#ifdef REVERSE
                    UmlCom::trace(WrapperStr("<font face=helvetica><b>cannot create artifact <i>")
                                  + Lex::quote(name) + "</i> under <i>"
                                  + Lex::quote(cpv->name()) +
                                  "</b></font><br>");
                    UmlCom::message("");
                    throw 0;
#else
                    QMessageBox::critical(0, "Fatal Error",
                                          WrapperStr("<font face=helvetica><b>cannot create artifact <i>")
                                          + Lex::quote(name) + "</i> under <i>"
                                          + Lex::quote(cpv->Name()) + "</b></font><br>");
                    QApplication::exit(1);
#endif
                }

                cp->set_Stereotype("source");
                cp->set_CppHeader(CppSettings::headerContent());
            }

            cp->addAssociatedClass(this);
        }

        // source needed ?

        if (need_source() && cp->cppSource().isEmpty())
            cp->set_CppSource(CppSettings::sourceContent());
    }
}
开发者ID:ErickCastellanos,项目名称:douml,代码行数:74,代码来源:UmlClass.cpp

示例12: new_one


//.........这里部分代码省略.........
                at->set_Multiplicity(array);
                container->set_updated();
            }

            WrapperStr v = at->defaultValue();

            if (!v.isEmpty() && (((const char *) v)[0] == '='))
                v = v.mid(1);

            if (nequal(v, value)) {
                at->set_DefaultValue(value);
                container->set_updated();
            }

            if (nequal(at->javaAnnotations(), annotation)) {
                at->set_JavaAnnotations(annotation);
                container->set_updated();
            }

            WrapperStr stereotype;
            bool force_ste = FALSE;

            if (cl->stereotype() == "enum") {
                stereotype = "attribute";
                force_ste = TRUE;
            }
            else if (typespec.type == 0) {
                WrapperStr t = typespec.explicit_type;
                int index2;

                if (!t.isEmpty() &&
                    (t.at(t.length() - 1) == ">") &&
                    ((index2 = t.find('<')) > 0)) {
                    stereotype = t.left(index2);
                    typespec.explicit_type =
                        // may be a,b ...
                        t.mid(index2 + 1, t.length() - 2 - index2);
                    decl.replace(index, 7, "${stereotype}<${type}>");
                    force_ste = TRUE;
                }
            }

            if (at->visibility() != visibility) {
                at->set_Visibility(visibility);
                container->set_updated();
            }

            if (neq(at->stereotype(), stereotype)) {
                WrapperStr jst;

                if (! at->stereotype().isEmpty())
                    jst = JavaSettings::relationAttributeStereotype(at->stereotype());

                if ((force_ste) ? (jst != stereotype) : (jst == "attribute")) {
                    at->set_Stereotype(stereotype);
                    container->set_updated();
                }
            }

            if (neq(at->javaDecl(), decl)) {
                at->set_JavaDecl(decl);
                container->set_updated();
            }

            if (!at->type().equal(typespec)) {
                at->set_Type(typespec);
开发者ID:ErickCastellanos,项目名称:douml,代码行数:67,代码来源:UmlAttribute.cpp

示例13: packageImport

void UmlPackage::packageImport(FileIn & in, Token & tk)
{
    if (! tk.closed()) {
        WrapperStr id = tk.xmiId();
        WrapperStr k = tk.what();
        const char * kstr = k;

        while (in.read(), !tk.close(kstr)) {
            if (tk.what() == "importedpackage") {
                if (tk.xmiType() == "uml:Model") {
                    WrapperStr v;

                    if (propertyValue("metamodelReference", v) && (v == id)) {
                        WrapperStr href = tk.valueOf("href");
                        int index = href.find('#');

                        set_PropertyValue("metamodelReference",
                                          (index == -1)
                                          ? href : href.left(index));
                    }
                }
                else if (tk.xmiType() == "uml:Profile") {
                    WrapperStr s = tk.xmiIdref();
                    UmlPackage * pf = 0;

                    if (!s.isEmpty()) {
                        QMap<WrapperStr, UmlItem *>::Iterator it = All.find(s);

                        if (it == All.end())
                            UnresolvedRelation::add(4, this->id(), s, "", "");
                        else if ((*it)->kind() == aPackage)
                            pf = (UmlPackage *) *it;
                    }
                    else
                        pf = importProfile(in, tk.valueOf("href"));

                    if (pf != 0) {
                        UmlNcRelation * ncr = UmlNcRelation::create(aDependency, this, pf);

                        if (ncr != 0)
                            ncr->set_Stereotype("import");
                    }
                }
            }
            else if (tk.what() == "importedelement") {
                WrapperStr v;

                if (propertyValue("metaclassReference", v) && (v == id)) {
                    WrapperStr href = tk.valueOf("href");
                    int index = href.find('#');

                    set_PropertyValue("metaclassReference",
                                      (index == -1)
                                      ? href : href.left(index));
                }
            }

            if (! tk.closed())
                in.finish(tk.what());
        }
    }
}
开发者ID:bleakxanadu,项目名称:douml,代码行数:62,代码来源:UmlPackage.cpp

示例14: file_path

WrapperStr UmlPackage::file_path(const WrapperStr & f)
{
    if (!dir.read) {
        dir.file = pythonDir();

        if (! RootDirRead) {
            RootDirRead = TRUE;
            RootDir = PythonSettings::rootDir();

            if (!RootDir.isEmpty() && // empty -> error
                QDir::isRelativePath(RootDir)) {
                QFileInfo f(getProject()->supportFile());
                QDir d(f.path());

                RootDir = d.filePath(RootDir);
            }
        }

        QDir d_root(RootDir);

        if (dir.file.isEmpty())
            dir.file = RootDir;
        else if (QDir::isRelativePath(dir.file))
            dir.file = d_root.filePath(dir.file);

        if (dir.file.isEmpty()) {
            UmlCom::trace(WrapperStr("<font color=\"red\"><b><b> The generation directory "
                                    "must be specified for the package<i> ") + name()
                          + "</i>, edit the <i> generation settings</i> (tab 'directory') "
                          "or edit the package (tab 'Python')</b></font><br>");
            UmlCom::bye(n_errors() + 1);
            UmlCom::fatal_error("UmlPackage::file_path");
        }

        dir.read = TRUE;
    }

    QDir d(dir.file);

    if (! d.exists()) {
        // create directory including the intermediates
        WrapperStr s = dir.file;
        int index = 0;
        QChar sep = QDir::separator();

        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;
        }
    }

    return WrapperStr(d.filePath(f).toLatin1().constData()) + WrapperStr(".") +
           PythonSettings::sourceExtension();
}
开发者ID:gilbertoca,项目名称:douml,代码行数:75,代码来源:UmlPackage.cpp

示例15: new_one


//.........这里部分代码省略.........
            int index = typespec.explicit_type.find("${name}");

            if (index != -1)
                typespec.explicit_type.remove(index, 7);
        }

        WrapperStr 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())
                decl.insert(index + 7, (const char *)(WrapperStr(" ") + modifier));

            if (typeform != "${type}")
                decl.replace(index, 7, typeform);
            else if (typespec.type == 0) {
                WrapperStr t = typespec.explicit_type;
                int index2 = 0;

                if (!t.isEmpty() && (t.at(t.length() - 1) == ">") && ((index2 = t.find('<')) > 0))
                {
                    stereotype = t.left(index2);
                    typespec.explicit_type =
                        // may be a,b ...
                        t.mid(index2 + 1, t.length() - 2 - index2);
                    decl.replace(index, 7, "${stereotype}<${type}>");
                }
            }

            if (!array.isEmpty())
                decl.insert(decl.find("${name}") + 7, "${multiplicity}");

            if (!bitfield.isEmpty())
                decl.insert(decl.find(';'), (const char *)(WrapperStr(" : ") + bitfield));
        }

        if (typenamep) {
            int index = decl.find("${const}") + 8; // find cannot return -1
            int index2 = decl.find("${mutable}") + 10; // find cannot return -1
            int index3 = decl.find("${volatile}") + 11; // find cannot return -1

            if (index2 > index) index = index2;

            if (index3 > index) index = index3;

            decl.insert(index, "typename ");
        }

        if (!value.isEmpty() && ((index = decl.find("${value}")) != -1))
            decl.insert(index + 2,  "h_");

#ifdef ROUNDTRIP

        if (roundtrip && !created) {
开发者ID:gilbertoca,项目名称:douml,代码行数:67,代码来源:UmlAttribute.cpp


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