コード例 #1
0
ファイル: UmlClass.cpp プロジェクト: SciBoy/douml
void UmlClass::java(Q3Dict<Q3CString> & prop) {
  if (!scanning) {
    Q3CString d = (stereotype() == "interface") 
      ? JavaSettings::interfaceDecl()
      : JavaSettings::classDecl();
    
    Q3CString * v;
    
    if ((v = prop.find("Java/Final")) != 0) {
      if (*v == "TRUE")
	set_isJavaFinal(TRUE);
      prop.remove("Java/Final");
    }
    
    if ((v = prop.find("Java/Strictfp")) != 0) {
      if (*v == "TRUE") {
	int index;
	
	if ((index = d.find("${public}")) != -1)
	  d.insert((unsigned) index + 9, "strictfp ");
	else if ((index = d.find("${visibility}")) != -1)
	  d.insert((unsigned) index + 13, "strictfp ");
      }
      prop.remove("Java/Strictfp");
    }
    
    set_JavaDecl(d);
  }
}
コード例 #2
0
ファイル: UmlClass.cpp プロジェクト: SciBoy/douml
void UmlClass::corba(Q3Dict<Q3CString> & prop) {
  if (!scanning) {
    Q3CString * v;
    
    if (stereotype() == "union") {
      if ((v = prop.find("CORBA/ImplementationType")) != 0) {
	UmlTypeSpec t;
	
	t.explicit_type = *v;	// !!!!!!!!!!!!
	set_SwitchType(t);
	prop.remove("CORBA/ImplementationType");
      }
      
      set_IdlDecl(IdlSettings::unionDecl());
    }
    else if (stereotype() == "typedef") {
      if ((v = prop.find("CORBA/ImplementationType")) != 0) {
	UmlTypeSpec t;
	
	t.explicit_type = *v;	// no quidu
	set_BaseType(t);
	prop.remove("CORBA/ImplementationType");
      }
      
      QString d = IdlSettings::typedefDecl();
      
      if ((v = prop.find("CORBA/ArrayDimensions")) != 0) {
	if (!v->isEmpty()) {
	  int index;
	  
	  if ((index = d.find("${name}")) != -1)
	    d.insert(index + 7, "[" + *v + "]");
	}
	
	prop.remove("CORBA/ArrayDimensions");
      }
      
      set_IdlDecl(d);
    }
    else if (stereotype() == "struct")
      set_IdlDecl(IdlSettings::structDecl());
    else if (stereotype() == "enum")
      set_IdlDecl(IdlSettings::enumDecl());
    else if (stereotype() == "interface")
      set_IdlDecl(IdlSettings::interfaceDecl());
    else if (stereotype() == "exception")
      set_IdlDecl(IdlSettings::exceptionDecl());
    else if (stereotype() == "")
      set_IdlDecl(IdlSettings::valuetypeDecl());
  }
}
コード例 #3
0
ファイル: Images.cpp プロジェクト: SciBoy/douml
// return pixmap for zoom 100%
QPixmap * get_pixmap(const char * path)
{
  QPixmap * px = DiagramPixmap.find(path);
  
  if (px == 0) {
    QString abspath;
    
    if (!QDir::isRelativePath(path))
      abspath = path;
    else if ((UmlWindow::images_root_dir().isEmpty() ||
	      !QFile::exists(abspath = QDir::cleanDirPath(UmlWindow::images_root_dir() + '/' + path))) &&
	     !QFile::exists(abspath = path))
      abspath = BrowserView::get_dir().absFilePath(path);
    
    px = new QPixmap(abspath);
    
    DiagramPixmap.insert(path, px);
    
    if (px->isNull()) {
      msg_critical(TR("Error"),
		   QString(path) + TR("\ndoesn't exist or is not a know image format"));
      return 0;
    }
    
    DiagramScaledPixmap.insert(path, new Q3PtrDict<QPixmap>());
  }

  return (px->isNull()) ? 0 : px;
}
コード例 #4
0
ファイル: UmlClass.cpp プロジェクト: SciBoy/douml
void UmlClass::cplusplus(Q3Dict<Q3CString> & prop) {
  if (!scanning) {
    if (stereotype() == "typedef") {
      Q3CString * bt = prop.find("Cplusplus/ImplementationType");
      
      if (bt != 0) {
	UmlTypeSpec t;
	
	t.explicit_type = *bt;	// no quidu
	set_BaseType(t);
      }
      
      set_CppDecl(CppSettings::typedefDecl());
    }
    else if (stereotype() == "struct")
      set_CppDecl(CppSettings::structDecl());
    else if (stereotype() == "union")
      set_CppDecl(CppSettings::unionDecl());
    else if (stereotype() == "enum")
      set_CppDecl(CppSettings::enumDecl());
    else
      set_CppDecl(CppSettings::classDecl());
    
    prop.remove("Cplusplus/ImplementationType");
  }

  Q3CString * v;
  
  if ((v = prop.find("Cplusplus/BodySourceFile")) != 0) {
    _body_file = *v;
    prop.remove("Cplusplus/BodySourceFile");
  }
  else if ((v = prop.find("Traversal/BodyFile")) != 0) {
    _body_file = *v;
    prop.remove("Traversal/BodyFile");
  }
  
  if ((v = prop.find("Cplusplus/HeaderSourceFile")) != 0) {
    _file = *v;
    prop.remove("Cplusplus/HeaderSourceFile");
  }
  else if ((v = prop.find("Traversal/CodeFile")) != 0) {
    _file = *v;
    prop.remove("Traversal/CodeFile");
  }
}
コード例 #5
0
ファイル: UmlClass.cpp プロジェクト: SciBoy/douml
void UmlClass::importIdlConstant(UmlItem * parent, const Q3CString & id, const Q3CString & s, const Q3CString & doc, Q3Dict<Q3CString> & prop)
{
  // use a class to define the constant !
  UmlClass * x;

  if ((x = UmlClass::create(parent, legalName(s))) == 0) {
    UmlCom::trace("<br>cannot create class '" + s + "' in " +
		  parent->fullName());
    throw 0;
  }

  newItem(x, id);
  x->lang = Corba;
  x->set_Stereotype("constant");
  
  if (!doc.isEmpty())
    x->set_Description(doc);

  Q3CString type;
  Q3CString value;
  Q3CString * v;
  
  if ((v = prop.find("CORBA/ImplementationType")) != 0) {
    type = *v;
    prop.remove("CORBA/ImplementationType");
  }

  if ((v = prop.find("CORBA/ConstValue")) != 0) {
    if (!v->isEmpty())
      value = " = " + *v;
    prop.remove("CORBA/ConstValue");
  }

  Q3CString d = IdlSettings::constDecl();
  int index;
  
  if ((index = d.find("${type}")) != -1)
    d.replace(index, 7, type);
    
  if ((index = d.find("${value}")) != -1)
    d.replace(index, 8, value);
  
  x->setProperties(prop);
  x->set_IdlDecl(d);
}
コード例 #6
0
ファイル: BrowserNode.cpp プロジェクト: harmegnies/douml
// synchronize all in todir, current packages are 'nodes'
void BrowserNode::synchronize(QDir & todir, Q3Dict<BrowserNode> & nodes)
{
    static Q3Dict<void> useful(9973);	// all useful files
    static bool made_useful = TRUE;	// set at the first call

    // compare nodes with young packages

    Q3DictIterator<BrowserNode> ity(Youngs);

    for (; ity.current(); ++ity) {
        BrowserNode * from = ity.current();
        BrowserNode * curr_bn = nodes.find(ity.currentKey());

        if ((curr_bn == 0) || (curr_bn->state == Old)) {
            // don't exist or must be updated
            if (made_useful)
                useful.insert(ity.currentKey(), (void *) 1);

            QDir & fromdir = from->view->get_dir();

            // copy package file
            copy(fromdir, todir, from->filename);

            // copy diagrams files
            QStringList::Iterator its;
            QStringList & diags = from->diagrams;

            if (made_useful) {
                for (its = diags.begin(); its != diags.end(); ++its) {
                    copy_if_needed(fromdir, todir, *its);
                    useful.insert(*its, (void *) 1);
                }
            }
            else
                for (its = diags.begin(); its != diags.end(); ++its)
                    copy_if_needed(fromdir, todir, *its);

            // copy class body files
            QStringList & cls = from->classes;

            if (made_useful) {
                for (its = cls.begin(); its != cls.end(); ++its) {
                    copy_if_needed(fromdir, todir, *its);
                    useful.insert(*its, (void *) 1);
                }
            }
            else
                for (its = cls.begin(); its != cls.end(); ++its)
                    copy_if_needed(fromdir, todir, *its);

            if (from->parent() == 0) {
                // project, special files
                copy_if_needed(fromdir, todir, "cpp_includes");
                copy_if_needed(fromdir, todir, "idl_includes");
                copy_if_needed(fromdir, todir, "java_imports");
                copy_if_needed(fromdir, todir, "generation_settings");
                copy_if_needed(fromdir, todir, "import");
                copy_if_needed(fromdir, todir, "include");
                copy_if_needed(fromdir, todir, "stereotypes");
                copy_if_needed(fromdir, todir, "tools");
            }
        }
        else if (made_useful)
            // young, memorize packages, diagrams and classes body file
            from->memo(useful);
    }

    if (made_useful) {
        // memorize up to date packages, diagrams and classes body file
        Q3DictIterator<BrowserNode> itn(nodes);

        for (; itn.current(); ++itn)
            if (itn.current()->state == UpToDate)
                itn.current()->memo(useful);

        made_useful = FALSE;
    }

    // remove files associated to deleted elements
    purge(todir, useful);
}