Beispiel #1
0
void ObjectData::read(char * & st, char * & k) { 
  AType t;
  
  t.read(st, "type", "explicit_type", k);	// k unchanged
  set_type(t);
  
  k = read_keyword(st);
  
  if (!strcmp(k, "multiplicity")) {
    multiplicity = read_string(st);
    k = read_keyword(st);
  }
  
  ordering = ::ordering(k);
  
  k = read_keyword(st);
  
  if (!strcmp(k, "in_state")) {
    in_state = read_string(st);
    k = read_keyword(st);
  }
  
  if (!strcmp(k, "is_control")) {
    is_control = TRUE;
    k = read_keyword(st);
  }
  
  if (!strcmp(k, "uml_selection")) {
    uml_selection = read_string(st);
    k = read_keyword(st);
  }
  
  if (!strcmp(k, "cpp_selection")) {
    cpp_selection = read_string(st);
    k = read_keyword(st);
  }
  
  if (!strcmp(k, "java_selection")) {
    java_selection = read_string(st);
    k = read_keyword(st);
  }
}
Beispiel #2
0
void ClassData::read(char * & st, char * & k) {
  if (!strcmp(k, "abstract")) {
    is_abstract = TRUE;
    k = read_keyword(st);
  }
  else
    is_abstract = FALSE;
  
  if (!strcmp(k, "active")) {
    is_active = TRUE;
    k = read_keyword(st);
  }
  else
    is_active = FALSE;
  
  if (!strcmp(k, "visibility")) {
    uml_visibility = ::visibility(read_keyword(st));  
    k = read_keyword(st);
  }
  else {
    // old non nested class
    uml_visibility = UmlPackageVisibility;
  }
  
  if (!strcmp(k, "stereotype")) {
    set_stereotype(read_string(st));
    
    if (!strcmp(stereotype, "typedef")) {
      AType t;
      
      t.read(st, "base_type", "explicit_base_type");
      set_base_type(t);
    }
    
    k = read_keyword(st);
  }
  
  unsigned n, i;
  
  if (!strcmp(k, "nformals")) {
    n = read_unsigned(st);
    set_n_formalparams(n);
    
    for (i = 0; i != n; i += 1)
      formals[i].read(st);
    
    k = read_keyword(st);
  }
  else
    set_n_formalparams(0);

  if (!strcmp(k, "nactuals")) {
    n = read_unsigned(st);
    
    BrowserClass * cl = 0;

    for (i = 0; i != n; i += 1) {
      ActualParamData * actual = ActualParamData::read(st);

      actuals.append(actual);
      
      if (actual->get_class() != cl) {
	cl = actual->get_class();
	connect(cl->get_data(), SIGNAL(deleted()),
		this, SLOT(update_actuals()));
	connect(cl->get_data(), SIGNAL(changed()),
		this, SLOT(update_actuals()));
      }
    }

    k = read_keyword(st);
  }
  else {
    n = 0;
    actuals.clear();
  }
  
  if (!strcmp(k, "constraint")) {
    constraint = read_string(st);
    k = read_keyword(st);
  }
  else
    constraint = QString::null;
  
  if (!strcmp(k, "cpp_external")) {
    cpp_external = TRUE;
    k = read_keyword(st);
  }
  else
    cpp_external = FALSE;
  
  if (!strcmp(k, "cpp_visibility")) {
    cpp_visibility = ::visibility(read_keyword(st));
    k = read_keyword(st);
  }
  else
    cpp_visibility = UmlDefaultVisibility;

  if (!strcmp(k, "cpp_decl")) {
    cpp_decl = read_string(st);
    k = read_keyword(st);
  }
  else
    wrong_keyword(k, "cpp_decl");
  
  if (!strcmp(k, "java_external")) {
    java_external = TRUE;
    k = read_keyword(st);
  }
  else
    java_external = FALSE;
  
  if (read_file_format() <= 33) {
    // old file
    if ((cpp_visibility == UmlDefaultVisibility) &&
	(uml_visibility != UmlPublic) && 
	(uml_visibility != UmlPackageVisibility))
      cpp_visibility = uml_visibility;
    
    if (!strcmp(k, "public")) {
      uml_visibility = UmlPublic;
      k = read_keyword(st);
    }
    else
      uml_visibility = UmlPackageVisibility;
  }
  
  if (!strcmp(k, "final")) {
    java_final = TRUE;
    k = read_keyword(st);
  }
  else
    java_final = FALSE;
  
  if (!strcmp(k, "java_decl")) {
    java_decl = read_string(st);
    k = read_keyword(st);
  }
  else
    wrong_keyword(k, "java_decl");
  
  if (!strcmp(k, "java_annotation")) {
    java_annotation = read_string(st);
    k = read_keyword(st);
  }
  else
    java_annotation = QString::null;
  
  if (!strcmp(k, "php_external")) {
    php_external = TRUE;
    k = read_keyword(st);
  }
  else
    php_external = FALSE;
  
  if (!strcmp(k, "php_final")) {
    php_final = TRUE;
    k = read_keyword(st);
  }
  else
    php_final = FALSE;
  
  if (!strcmp(k, "php_decl")) {
    php_decl = read_string(st);
    k = read_keyword(st);
  }
  else if (read_file_format() >= 44)
    wrong_keyword(k, "php_decl");
  else
    php_decl = "";
  
  if (!strcmp(k, "python_external")) {
    python_external = TRUE;
    k = read_keyword(st);
  }
  else
    python_external = FALSE;
  
  if (!strcmp(k, "python_2_2")) {
    python_2_2 = TRUE;
    k = read_keyword(st);
  }
  else
    python_2_2 = (read_file_format() < 51);
  
  if (!strcmp(k, "python_decl")) {
    python_decl = read_string(st);
    k = read_keyword(st);
  }
  else if (read_file_format() >= 51)
    wrong_keyword(k, "python_decl");
  else
    python_decl = "";
  
  if (!strcmp(k, "idl_external")) {
    idl_external = TRUE;
    k = read_keyword(st);
  }
  else
    idl_external = FALSE;
  
  if (!strcmp(k, "local")) {
    idl_local = TRUE;
    k = read_keyword(st);
  }
  else
    idl_local = FALSE;
  
  if (!strcmp(k, "custom")) {
    idl_custom = TRUE;
    k = read_keyword(st);
  }
  else
    idl_custom = FALSE;
  
  if (!strcmp(k, "idl_decl")) {
    idl_decl = read_string(st);
    k = read_keyword(st);
  }
  else
    wrong_keyword(k, "idl_decl");
  
  AType t;
  
  t.read(st, "switch_type", "explicit_switch_type", k);
  set_switch_type(t);
  
  k = read_keyword(st);
}
Beispiel #3
0
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) {
            case UmlRealize:
            case UmlGeneralisation:
                if (result->a.cpp_decl == "Generated")
                    result->a.cpp_decl = "${type}";

                if (result->a.java_decl == "Generated")
                    result->a.java_decl = "${type}";

                if (result->a.idl_decl == "Generated")
                    result->a.idl_decl = "${type}";

                break;

            case UmlDependency:
                if (!result->a.cpp_decl.isEmpty()) {
                    if (result->stereotype == "friend")
                        result->a.cpp_decl = "${type}";
                    else if ((result->a.cpp_decl == "Generated") ||
                             (result->a.cpp_decl == "${type}"))
                        result->a.cpp_decl = "#include in header";
                    else if ((result->a.cpp_decl == "#include in source") &&
                             (read_file_format() < 56))
                        IncludeToHeaderIfExternal.append(result);
                }

                break;

            default:
                break;
            }
        }

        k = read_keyword(st);

        AType t;

        if (!strcmp(k, "association_type") ||
            !strcmp(k, "association_explicit_type")) {
            t.read(st, "association_type", "association_explicit_type", k);
            result->set_association(t);
            k = read_keyword(st);
        }

        return result;
    }
    else
        return 0;
}
Beispiel #4
0
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;

    if (!strcmp(k, "cpp_visibility")) {
        cpp_visibility = ::visibility(read_keyword(st));
        k = read_keyword(st);
    }
    else
        cpp_visibility = UmlDefaultVisibility;

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

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

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

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

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

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

    if (!strcmp(k, "idl_case")) {
        set_idlcase(BrowserAttribute::read_ref(st), "");
        k = read_keyword(st);
    }
    else if (!strcmp(k, "idl_explicit_case")) {
        set_idlcase(0, read_string(st));
        k = read_keyword(st);
    }
    else
        set_idlcase(0, "");

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