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


C++ AType::read方法代码示例

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


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

示例1: if

RelationData * RelationData::read(char *& st, char *& k,
                                  BrowserRelation *& unconsistent)
{
    unconsistent = 0;

    RelationData * result;
    int id;

    if (!strcmp(k, "relation_ref")) {
        if ((result = all[id = read_id(st)]) == 0)
            result = new RelationData(UmlRelations/*!!*/, id);

        k = read_keyword(st);
        return result;
    }
    else if (!strcmp(k, "relation")) {
        if ((result = all[id = read_id(st)]) == 0)
            result = new RelationData(relation_type(read_keyword(st)), id);
        else if (result->type != UmlRelations) {
            // shared identifier
            result->set_unconsistent();
            unconsistent = result->start;
            result = new RelationData(relation_type(read_keyword(st)), id);
            result->set_unconsistent();
        }
        else {
            result->type = relation_type(read_keyword(st));
            result->name = default_name(result->type);

            if (result->start != 0) {
                // Created by RelationData::read_ref()
                // invalidate start/end to not delete result
                // when start/end will be deleted
                result->start->invalidate();
                result->end->invalidate();
            }
        }

        k = read_keyword(st);

        if (!strcmp(k, "name")) {
            result->name = read_string(st);
            k = read_keyword(st);
        }

        result->BasicData::read(st, k);	// updates k

        if (in_lib_import()) {
            result->original_id = id;

            if (! strcmp(k, "oid")) {
                // a sub lib is imported as a part of the imported lib
                (void) read_id(st);
                k = read_keyword(st);
            }
        }
        else if (! strcmp(k, "oid")) {
            result->original_id = read_id(st);
            k = read_keyword(st);
        }

        bool assoc = isa_association(result->type);

        if (strcmp(k, "a"))
            wrong_keyword(k, "a");

        read_role(result->a, assoc, st, k, result);		// updates k
        result->start = BrowserRelation::read_ref(st, k);

        read_keyword(st, "b");

        if (!RelationData::uni_directional(result->type)) {
            read_role(result->b, assoc, st, k, result);	// updates k
            result->end = BrowserRelation::read_ref(st, k);
            // 'end' may be read before 'start' : relation's type was unknown
            result->end->set_name(0);
            result->end->set_name(result->name);
        }
        else {
            k = read_keyword(st);

            if (!strcmp(k, "multiplicity")) {
                result->b.multiplicity = read_string(st);
                k = read_keyword(st);
            }
            else
                result->b.multiplicity = 0;

            if (strcmp(k, "parent"))
                wrong_keyword(k, "parent");

            result->end_removed_from = BrowserClass::read_ref(st);
            result->b.uml_visibility =
                ((BrowserNode *) result->end_removed_from->parent())->get_visibility(UmlRelations);
            connect(result->end_removed_from->get_data(), SIGNAL(deleted()),
                    result, SLOT(end_deleted()));
            result->end = 0;

            // manage old declarations
            switch (result->type) {
//.........这里部分代码省略.........
开发者ID:harmegnies,项目名称:douml,代码行数:101,代码来源:RelationData.cpp

示例2: read

void AttributeData::read(char *& st, char *& k)
{
    if (!strcmp(k, "class_attribute") ||
        !strcmp(k, "class_attribut")) {
        isa_class_attribute = TRUE;
        k = read_keyword(st);
    }
    else
        isa_class_attribute = FALSE;

    if (!strcmp(k, "volatile")) {
        isa_volatile_attribute = TRUE;
        k = read_keyword(st);
    }
    else
        isa_volatile_attribute = FALSE;

    if (!strcmp(k, "const_attribute") ||
        !strcmp(k, "const_attribut")) {
        isa_const_attribute = TRUE;
        k = read_keyword(st);
    }
    else
        isa_const_attribute = FALSE;

    if (!strcmp(k, "derivedunion")) {
        is_derived = TRUE;
        is_derivedunion = TRUE;
        k = read_keyword(st);
    }
    else if (!strcmp(k, "derived")) {
        is_derived = TRUE;
        is_derivedunion = FALSE;
        k = read_keyword(st);
    }
    else
        is_derived = is_derivedunion = FALSE;

    if (!strcmp(k, "ordered")) {
        is_ordered = TRUE;
        k = read_keyword(st);
    }
    else
        is_ordered = FALSE;

    if (!strcmp(k, "unique")) {
        is_unique = TRUE;
        k = read_keyword(st);
    }
    else
        is_unique = FALSE;

    uml_visibility = ::visibility(k);

    k = read_keyword(st);

    AType t;

    t.read(st, "type", "explicit_type", k);
    set_type(t);

    k = read_keyword(st);

    if (!strcmp(k, "multiplicity")) {
        multiplicity = read_string(st);
        k = read_keyword(st);
    }
    else
        multiplicity = 0;

    if (!strcmp(k, "init_value")) {
        init_value = QString(QTextCodec::codecForName(codec().toLatin1().constData())->fromUnicode(read_string(st)));
//        init_value = read_string(st);
        k = read_keyword(st);
    }
    else
        init_value = QString();

    if (!strcmp(k, "constraint")) {
        constraint = read_string(st);
        k = read_keyword(st);
    }
    else
        constraint = QString();

    BasicData::read(st, k);	// updates k

    if (!strcmp(k, "cpp_volatile")) {
        // old version
        isa_volatile_attribute = TRUE;
        k = read_keyword(st);
    }

    if (!strcmp(k, "cpp_mutable")) {
        cpp_mutable = TRUE;
        k = read_keyword(st);
    }
    else
        cpp_mutable = FALSE;

//.........这里部分代码省略.........
开发者ID:gilbertoca,项目名称:douml,代码行数:101,代码来源:AttributeData.cpp


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