[Uml-devel] Problem with C++ parsing, typedef and namespace
Yan Morin
yansanmo at iquebec.com
Sun Feb 19 12:10:07 UTC 2006
Hi, I try to import sflphone .h files inside Umbrello. The src/
directory. When I import managerimpl.h two times it crash when he try to
add a class with a new name and refuse (click on no in the popup).
Source code:
http://forge.novell.com/modules/xfmod/cvs/cvsbrowse.php/sflphone/sflphone/src/managerimpl.h?rev=1.53&content-type=text/vnd.viewcvs-markup
Backtrace:
http://yansanmo.no-ip.org/test/kde/crash-import-globalh.txt
Since, the project is quite big, I've tried to reproduce the bug with a
smaller file, without success.
But, I've found that there is a lot of strange thing that happens with
the typedef, namespace and friend keyword.
By example, take this file:
http://yansanmo.no-ip.org/test/kde/typedef-namespace.h
====
#include <map>
typedef unsigned int uint;
namespace NS_TEST {
class TestItem;
typedef std::map<std::string, TestItem> TestItemMap;
typedef std::map<std::string, TestItemMap*> TestPtrMap;
class TestIterator
{
private:
TestItemMap::iterator _iterItem;
TestPtrMap::iterator _iterPtr;
};
class TestItem {
private:
void myFunction(uint);
friend class TestIterator;
};
};
====
1. It puts "uint" as a class, even if the "unsigned int" is already a
datatype
2. It puts TestItemMap and TestPtrMap as a datatype inside the namespace
and a class outside the namespace.
3. It create two "std" namespace.
4. When you re-import the file, it add a new TestIterator.
Something that could be good with typedef is to check the source type
and assign the same type of class/datatype to it.
If we have:
typedef int myInt; // myInt should be a Datatype since "int" is known
as a datatype.
typedef std::map<int> myMap; // myMap should have the 'map' type (so
it's a UML class)
--
Yan Morin
http://yansanmo.no-ip.org/
More information about the umbrello-devel
mailing list