00001 /****************************************************************************** 00002 * 00003 * $Id: membername.cpp,v 1.16 2001/03/19 19:27:41 root Exp $ 00004 * 00005 * Copyright (C) 1997-2008 by Dimitri van Heesch. 00006 * 00007 * Permission to use, copy, modify, and distribute this software and its 00008 * documentation under the terms of the GNU General Public License is hereby 00009 * granted. No representations are made about the suitability of this software 00010 * for any purpose. It is provided "as is" without express or implied warranty. 00011 * See the GNU General Public License for more details. 00012 * 00013 * Documents produced by Doxygen are derivative works derived from the 00014 * input used in their production; they are not affected by this license. 00015 * 00016 */ 00017 00018 #include "membername.h" 00019 #include "classdef.h" 00020 #include "util.h" 00021 #include "filedef.h" 00022 00023 MemberName::MemberName(const char *n) : QList<MemberDef>() 00024 { 00025 name=n; 00026 setAutoDelete(TRUE); 00027 } 00028 00029 MemberName::~MemberName() 00030 { 00031 } 00032 00033 int MemberName::compareItems(GCI item1, GCI item2) 00034 { 00035 MemberDef *m1=(MemberDef *)item1; 00036 MemberDef *m2=(MemberDef *)item2; 00037 ClassDef *c1=m1->getClassDef(); 00038 ClassDef *c2=m2->getClassDef(); 00039 FileDef *f1=m1->getFileDef(); 00040 FileDef *f2=m2->getFileDef(); 00041 if (c1 && c2) 00042 return strcmp(c1->name(),c2->name()); 00043 else if (f1 && f2) 00044 return strcmp(f1->name(),f2->name()); 00045 else 00046 return 0; 00047 } 00048 00049 MemberNameInfo::MemberNameInfo(const char *n) : QList<MemberInfo>() 00050 { 00051 name=n; 00052 setAutoDelete(TRUE); 00053 } 00054 00055 int MemberNameInfo::compareItems(GCI item1, GCI item2) 00056 { 00057 MemberInfo *m1=(MemberInfo *)item1; 00058 MemberInfo *m2=(MemberInfo *)item2; 00059 ClassDef *c1=m1->memberDef->getClassDef(); 00060 ClassDef *c2=m2->memberDef->getClassDef(); 00061 FileDef *f1=m1->memberDef->getFileDef(); 00062 FileDef *f2=m2->memberDef->getFileDef(); 00063 if (c1 && c2) 00064 return strcmp(c1->name(),c2->name()); 00065 else if (f1 && f2) 00066 return strcmp(f1->name(),f2->name()); 00067 else 00068 return 0; 00069 } 00070 MemberNameIterator::MemberNameIterator(const MemberName &mnlist) : 00071 QListIterator<MemberDef>(mnlist) 00072 { 00073 } 00074 00075 int MemberNameSDict::compareItems(GCI item1, GCI item2) 00076 { 00077 MemberName *n1=(MemberName *)item1; 00078 MemberName *n2=(MemberName *)item2; 00079 return stricmp(n1->memberName()+getPrefixIndex(n1->memberName()), 00080 n2->memberName()+getPrefixIndex(n2->memberName()) 00081 ); 00082 } 00083