Esempio n. 1
0
ClassData::ClassData(const ClassData * model, BrowserNode * bn)
    : BasicData(model), constraint(model->constraint)
{
    browser_node = bn;

    if ((nformals = model->nformals) == 0)
        formals = 0;
    else {
        FormalParamData * mformals = model->formals;
        formals = new FormalParamData[nformals];

        for (int index = 0; index != nformals; index += 1)
            formals[index] = mformals[index];
    }

    Q3PtrListIterator<ActualParamData> it(model->actuals);
    BrowserClass * cl = 0;

    for (; it.current(); ++it) {
        ActualParamData * actual = new ActualParamData(*(it.current()));

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

        actuals.append(actual);
    }

    set_base_type(model->base_type);
    is_deleted = FALSE;
    bodies_read = FALSE;
    bodies_modified = FALSE;
    is_abstract = model->is_abstract;
    is_active = model->is_active;
    cpp_external = model->cpp_external;
    java_external = model->java_external;
    java_final = model->java_final;
    php_external = model->php_external;
    php_final = model->php_final;
    python_2_2 = model->python_2_2;
    python_external = model->python_external;
    idl_external = model->idl_external;
    idl_local = model->idl_local;
    idl_custom = model->idl_custom;
    uml_visibility = model->uml_visibility;
    cpp_visibility = model->cpp_visibility;
    cpp_decl = model->cpp_decl;
    java_decl = model->java_decl;
    java_annotation = model->java_annotation;
    php_decl = model->php_decl;
    python_decl = model->python_decl;
    set_switch_type(model->switch_type);
    idl_decl = model->idl_decl;

    connect(this, SIGNAL(changed()), this, SLOT(update_actuals()));
}
Esempio n. 2
0
void ClassData::update_actuals(BrowserClass * parent,
                               Q3PtrList<ActualParamData> & new_actuals,
                               Q3PtrList<ActualParamData> & managed)
{
    if (((BrowserNode *) parent->parent())->get_type() == UmlClass)
        update_actuals((BrowserClass *) parent->parent(), new_actuals, managed);

    ActualParamData * actual;
    int n = ((ClassData *) parent->get_data())->nformals;

    if (n != 0) {
        // search the first associated actual
        for (actual = actuals.first(); actual != 0; actual = actuals.next()) {
            if ((actual->get_class() == parent) &&
                (managed.findRef(actual) == -1))
                // find;
                break;
        }

        int nth = 0;

        // progress on still present formals
        while (actual && (nth < n) && (actual->get_class() == parent)) {
            // actual ok
            new_actuals.append(actual);
            managed.append(actual);

            actual = actuals.next();
            nth += 1;
        }

        if (nth < n) {
            // adds necessary actuals
            if (nth == 0) {
                // new inheritance
                connect(parent->get_data(), SIGNAL(deleted()),
                        this, SLOT(update_actuals()));
                connect(parent->get_data(), SIGNAL(changed()),
                        this, SLOT(update_actuals()));
            }

            do {
                new_actuals.append(new ActualParamData(parent, nth));
                nth += 1;
            }
            while (nth != n);
        }
    }
}
Esempio n. 3
0
ClassData::ClassData()
    : formals(0), nformals(0), 
      is_deleted(FALSE), is_abstract(FALSE), is_active(FALSE),
      bodies_read(FALSE), bodies_modified(FALSE),
      cpp_external(FALSE), 
      java_external(FALSE), java_final(FALSE),
      php_external(FALSE), php_final(FALSE),
      python_external(FALSE),
      idl_external(FALSE), idl_local(FALSE), idl_custom(FALSE),
      uml_visibility(UmlPackageVisibility), cpp_visibility(UmlDefaultVisibility) {
  if (GenerationSettings::cpp_get_default_defs())
    cpp_decl = GenerationSettings::cpp_default_class_decl();

  if (GenerationSettings::java_get_default_defs())
    java_decl = GenerationSettings::java_default_class_decl();

  if (GenerationSettings::php_get_default_defs())
    php_decl = GenerationSettings::php_default_class_decl();

  if (GenerationSettings::python_get_default_defs())
    python_decl = GenerationSettings::python_default_class_decl();
  python_2_2 = GenerationSettings::python_default_2_2();

  if (GenerationSettings::idl_get_default_defs())
    idl_decl = GenerationSettings::idl_default_valuetype_decl();
  
  connect(this, SIGNAL(changed()), this, SLOT(update_actuals()));
}
Esempio n. 4
0
void ClassData::update_actuals() {
  if (DontUpdateActuals)
    return;
  
  // an inherited parent was modified/deleted, updates all actuals
  QList<BrowserNode> parents = browser_node->parents();
  QList<ActualParamData> new_actuals;
  QList<ActualParamData> managed;
  BrowserClass * parent;
  
  for (parent = (BrowserClass *) parents.first();
       parent != 0;
       parent = (BrowserClass *) parents.next())
    update_actuals(parent, new_actuals, managed);
  
  if (!(actuals == new_actuals)) {
    ActualParamData * actual;
    
    for (actual = actuals.first(); actual != 0; actual = actuals.next())
      if (new_actuals.findRef(actual) == -1)
	delete actual;

    actuals = new_actuals;
    browser_node->package_modified();
  }
  
  // note : even if actuals == new_actuals to take
  // into account change in already existing formal and actual
  emit actuals_changed();
}
Esempio n. 5
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);
}
Esempio n. 6
0
void ClassData::inherit_or_instantiate(BrowserClass *) {
  update_actuals();
}