• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • TDevelop Interfaces Library
 

TDevelop Interfaces Library

  • lib
  • interfaces
codemodel.h
Go to the documentation of this file.
1 /* This file is part of TDevelop
2  Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
3  Copyright (C) 2004 Matt Rogers <mattr@kde.org>
4  Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 #ifndef CODEMODEL_H
22 #define CODEMODEL_H
23 
30 #include <tqmap.h>
31 #include <tqstringlist.h>
32 #include <ksharedptr.h>
33 #include <tqvaluevector.h>
34 #include "hashedstring.h"
35 
36 #include <iostream>
37 #include <ostream>
38 #include <string>
39 #include <sstream>
40 #include <set>
41 
42 enum ParsedFileType {
43  CppParsedFile
44 };
45 
46 class AbstractParseResult : public TDEShared {
47 public:
48  virtual void read( TQDataStream& stream ) = 0;
49 
50  virtual void write( TQDataStream& stream ) const = 0;
51 
52  virtual ParsedFileType type() const = 0;
53 };
54 
55 typedef TDESharedPtr<AbstractParseResult> ParseResultPointer;
56 
57 using namespace std;
58 
59 class CodeModel;
60 class CodeModelItem;
61 class FileModel;
62 class NamespaceModel;
63 class ClassModel;
64 class FunctionModel;
65 class FunctionDefinitionModel;
66 class VariableModel;
67 class ArgumentModel;
68 class EnumModel;
69 class EnumeratorModel;
70 class TypeAliasModel;
71 
78 typedef TDESharedPtr<CodeModelItem> ItemDom;
79 
86 typedef TDESharedPtr<FileModel> FileDom;
87 
94 typedef TDESharedPtr<NamespaceModel> NamespaceDom;
95 
102 typedef TDESharedPtr<ClassModel> ClassDom;
103 
110 typedef TDESharedPtr<FunctionModel> FunctionDom;
111 
118 typedef TDESharedPtr<FunctionDefinitionModel> FunctionDefinitionDom;
119 
126 typedef TDESharedPtr<VariableModel> VariableDom;
127 
134 typedef TDESharedPtr<ArgumentModel> ArgumentDom;
135 
142 typedef TDESharedPtr<EnumModel> EnumDom;
143 
150 typedef TDESharedPtr<TypeAliasModel> TypeAliasDom;
151 
158 typedef TDESharedPtr<EnumeratorModel> EnumeratorDom;
159 
166 typedef TQValueList<ItemDom> ItemList;
167 
174 typedef TQValueList<FileDom> FileList;
175 
182 typedef TQValueList<NamespaceDom> NamespaceList;
183 
190 typedef TQValueList<ClassDom> ClassList;
191 
198 typedef TQValueList<FunctionDom> FunctionList;
199 
207 typedef TQValueList<FunctionDefinitionDom> FunctionDefinitionList;
214 typedef TQValueList<VariableDom> VariableList;
215 
222 typedef TQValueList<ArgumentDom> ArgumentList;
223 
230 typedef TQValueList<EnumDom> EnumList;
231 
238 typedef TQValueList<TypeAliasDom> TypeAliasList;
239 
246 typedef TQValueList<EnumeratorDom> EnumeratorList;
247 
257 template <class ItemList>
258 TQStringList sortedNameList( const ItemList& lst )
259 {
260  TQStringList nameList;
261 
262  typename ItemList::ConstIterator it = lst.begin();
263  while( it != lst.end() ){
264  if( !(*it)->name().isEmpty() )
265  nameList << (*it)->name();
266  ++it;
267  }
268 
269  nameList.sort();
270  return nameList;
271 }
272 
284 template <class Result, class T>
285 Result model_cast( TDESharedPtr<T> x )
286 {
287  Result r( static_cast<T*>(x) );
288  return r;
289 }
290 
302 template <class Result, class T>
303 Result model_cast( T* x )
304 {
305  Result r( static_cast<T*>(x) );
306  return r;
307 }
308 
309 
324 class CodeModel
325 {
326 public:
328  CodeModel();
330  virtual ~CodeModel();
331 
343  template <class T> typename T::Ptr create()
344  {
345  typename T::Ptr ptr( new T(this) );
346  return ptr;
347  }
348 
350  void wipeout();
351 
354  FileList fileList();
355 
359  const FileList fileList() const;
360 
363  bool hasFile( const TQString& name ) const;
364 
367  FileDom fileByName( const TQString& name );
368 
372  const FileDom fileByName( const TQString& name ) const;
373 
377  bool addFile( FileDom file );
378 
381  void removeFile( FileDom file );
382 
385  const NamespaceDom globalNamespace() const;
386 
394  virtual void read( TQDataStream& stream );
401  virtual void write( TQDataStream& stream ) const;
402 
404  virtual void dump( std::ostream& file, TQString Info="" );
405 
410  int mergeGroups( int g1, int g2 );
411 
416  FileList getGroup( int gid ) const;
417 
418  FileList getGroup( const FileDom& file) const;
419 
421  virtual TQStringList getGroupStrings( int gid ) const;
422 
423 private:
427  void addNamespace( NamespaceDom target, NamespaceDom source );
428 
432  void removeNamespace( NamespaceDom target, NamespaceDom source );
433 
434 private:
435  TQMap<TQString, FileDom> m_files;
436  NamespaceDom m_globalNamespace;
437 
438  virtual int newGroupId();
442  int m_currentGroupId;
443 
444 private:
445  CodeModel( const CodeModel& source );
446  void operator = ( const CodeModel& source );
447  friend class CodeModelItem;
448  friend class FileModel;
449 };
450 
451 
461 class CodeModelItem: public TDEShared
462 {
463 public:
465  typedef ItemDom Ptr;
466 
468  enum Kind
469  {
470  File,
471  Namespace,
472  Class,
473  Function,
474  Variable,
475  Argument,
476  FunctionDefinition,
477  Enum,
478  Enumerator,
480  TypeAlias,
482  Custom = 1000
483  };
484 
486  enum Access
487  {
488  Public,
489  Protected,
490  Private
491  };
492  void update( const CodeModelItem* i );
493  bool canUpdate( const CodeModelItem* i ) const;
494 
495 protected:
499  CodeModelItem( int kind, CodeModel* model );
500 
501 public:
503  virtual ~CodeModelItem();
504 
506  int kind() const { return m_kind; }
507 
510  void setKind( int kind ) { m_kind = kind; }
511 
513  TQString name() const;
514 
515  TQString comment() const {
516  return m_comment;
517  }
518 
519  void setComment( TQString comment ) {
520  m_comment = comment;
521  }
522 
525  void setName( const TQString& name );
526 
529  FileDom file();
530 
534  const FileDom file() const;
535 
537  TQString fileName() const;
538 
541  void setFileName( const TQString& fileName );
542 
546  void getStartPosition( int* line, int* col ) const;
547 
551  void setStartPosition( int line, int col );
552 
556  void getEndPosition( int* line, int* col ) const;
557 
561  void setEndPosition( int line, int col );
562 
564  virtual bool isFile() const { return false; }
566  virtual bool isNamespace() const { return false; }
568  virtual bool isClass() const { return false; }
570  virtual bool isFunction() const { return false; }
572  virtual bool isFunctionDefinition() const { return false; }
574  virtual bool isVariable() const { return false; }
576  virtual bool isArgument() const { return false; }
578  virtual bool isEnum() const { return false; }
580  virtual bool isEnumerator() const { return false; }
582  virtual bool isTypeAlias() const { return false; }
584  virtual bool isCustom() const { return false; }
585 
586  virtual bool isTemplateable() const { return false; }
587 
590  virtual void read( TQDataStream& stream );
593  virtual void write( TQDataStream& stream ) const;
594 
595  virtual void dump( std::ostream& file, bool recurse=false, TQString Info="" );
596 
598  CodeModel* codeModel() { return m_model; }
599 
602  const CodeModel* codeModel() const { return m_model; }
603 
604 private:
605  int m_kind;
606  CodeModel* m_model;
607  TQString m_name;
608  TQString m_fileName;
609  TQString m_comment;
610  int m_startLine, m_startColumn;
611  int m_endLine, m_endColumn;
612 
613 private:
614  CodeModelItem( const CodeModelItem& source );
615  void operator = ( const CodeModelItem& source );
616 };
617 
618 
619 
620 class TemplateModelItem {
621  public:
622  typedef TQPair< TQString, TQString > ParamPair;
623  typedef TQValueVector< ParamPair > ParamMap;
624 
625  virtual const ParamMap& getTemplateParams() {
626  return m_params;
627  }
628 
629  virtual void addTemplateParam( TQString name, TQString def = "" ) {
630  m_params.push_back( ParamPair( name, def ) );
631  }
632 
633  virtual void clearTemplateParams() {
634  m_params.clear();
635  }
636 
637  bool hasSpecializationDeclaration() const {
638  return !m_specialization.isEmpty();
639  }
640 
641  virtual TQString getSpecializationDeclaration() const {
642  return m_specialization;
643  }
644 
645  void setSpecializationDeclaration( const TQString& str ) {
646  m_specialization = str;
647  }
648 
650  virtual int findTemplateParam( const TQString& name ) const {
651  for( unsigned int a = 0; a< m_params.size(); a++)
652  if( m_params[a].first == name ) return a;
653  return -1;
654  }
655 
656  const ParamPair getParam( int index ) const {
657  return m_params[index];
658  }
659 
660  virtual bool isTemplateable() const { return true; }
661 
662  void write( TQDataStream & stream ) const {
663  stream << m_specialization;
664  stream << (int)m_params.size();
665  for( ParamMap::const_iterator it = m_params.begin(); it != m_params.end(); ++it ) {
666  stream << (*it).first;
667  stream << (*it).second;
668  }
669  }
670 
671  void read( TQDataStream & stream ) {
672  int count;
673  stream >> m_specialization;
674  stream >> count;
675  for( int a = 0; a < count; a++ ) {
676  ParamPair tmp;
677  stream >> tmp.first;
678  stream >> tmp.second;
679  m_params.push_back( tmp );
680  }
681  }
682 
683  protected:
684  ParamMap m_params;
685  TQString m_specialization;
686 };
687 
688 
689 
696 class ClassModel: public CodeModelItem, public TemplateModelItem
697 {
698 protected:
701  ClassModel( CodeModel* model );
702 
703 public:
705  typedef ClassDom Ptr;
706 
707  virtual bool isClass() const { return true; }
708 
710  TQStringList scope() const { return m_scope; }
713  void setScope( const TQStringList& scope ) { m_scope = scope; }
714 
716  TQStringList baseClassList() const;
717 
720  bool addBaseClass( const TQString& baseClass );
721 
724  void removeBaseClass( const TQString& baseClass );
725 
727  ClassList classList();
728 
731  const ClassList classList() const;
732 
736  bool hasClass( const TQString& name ) const;
737 
740  ClassList classByName( const TQString& name );
741 
745  const ClassList classByName( const TQString& name ) const;
746 
750  bool addClass( ClassDom klass );
751 
754  void removeClass( ClassDom klass );
755 
757  FunctionList functionList();
758 
761  const FunctionList functionList() const;
762 
766  bool hasFunction( const TQString& name ) const;
767 
770  FunctionList functionByName( const TQString& name );
771 
775  const FunctionList functionByName( const TQString& name ) const;
776 
780  bool addFunction( FunctionDom fun );
781 
784  void removeFunction( FunctionDom fun );
785 
787  FunctionDefinitionList functionDefinitionList();
788 
791  const FunctionDefinitionList functionDefinitionList() const;
792 
796  bool hasFunctionDefinition( const TQString& name ) const;
797 
802  FunctionDefinitionList functionDefinitionByName( const TQString& name );
803 
809  const FunctionDefinitionList functionDefinitionByName( const TQString& name ) const;
810 
814  bool addFunctionDefinition( FunctionDefinitionDom fun );
815 
818  void removeFunctionDefinition( FunctionDefinitionDom fun );
819 
821  VariableList variableList();
822 
825  const VariableList variableList() const;
826 
830  bool hasVariable( const TQString& name ) const;
831 
836  VariableDom variableByName( const TQString& name );
837 
843  const VariableDom variableByName( const TQString& name ) const;
844 
848  bool addVariable( VariableDom var );
849 
852  void removeVariable( VariableDom var );
853 
855  TypeAliasList typeAliasList();
856 
859  const TypeAliasList typeAliasList() const;
860 
864  bool hasTypeAlias( const TQString& name ) const;
865 
870  TypeAliasList typeAliasByName( const TQString& name );
871 
877  const TypeAliasList typeAliasByName( const TQString& name ) const;
878 
882  bool addTypeAlias( TypeAliasDom typeAlias );
883 
886  void removeTypeAlias( TypeAliasDom typeAlias );
887 
889  EnumList enumList();
890 
893  const EnumList enumList() const;
894 
898  bool hasEnum( const TQString& name ) const;
899 
904  EnumDom enumByName( const TQString& name );
905 
910  const EnumDom enumByName( const TQString& name ) const;
911 
915  bool addEnum( EnumDom e );
916 
919  void removeEnum( EnumDom e );
920 
921  void update( const ClassModel* i );
922  bool canUpdate( const ClassModel* i ) const;
923 
924  virtual void read( TQDataStream& stream );
925  virtual void write( TQDataStream& stream ) const;
926 
927  virtual void dump( std::ostream& file, bool recurse=false, TQString Info="" );
928 
929 private:
930  TQStringList m_scope;
931  TQStringList m_baseClassList;
932  TQMap<TQString, ClassList> m_classes;
933  TQMap<TQString, FunctionList> m_functions;
934  TQMap<TQString, FunctionDefinitionList> m_functionDefinitions;
935  TQMap<TQString, VariableDom> m_variables;
936  TQMap<TQString, TypeAliasList> m_typeAliases;
937  TQMap<TQString, EnumDom> m_enumerators;
938 
939 private:
940  ClassModel( const ClassModel& source );
941  void operator = ( const ClassModel& source );
942  friend class CodeModel;
943 };
944 
945 class NamespaceAliasModel {
946 public:
947  virtual void read( TQDataStream& stream );
948  virtual void write( TQDataStream& stream ) const;
949 
950  TQString name() const {
951  return m_name;
952  }
953 
954  void setName( const TQString& name ) {
955  m_name = name;
956  }
957 
958  void setAliasName( const TQString& theValue ) {
959  m_aliasName = theValue;
960  }
961 
962  TQString aliasName() const {
963  return m_aliasName;
964  }
965 
966  void setFileName( const HashedString& theValue ) {
967  m_fileName = theValue;
968  }
969 
970  HashedString fileName() const {
971  return m_fileName;
972  }
973 
974  bool operator < ( const NamespaceAliasModel& rhs ) const {
975  if( m_name < rhs.m_name ) return true;
976  if( m_name == rhs.m_name ) {
977  if( m_aliasName < rhs.m_aliasName ) return true;
978  if( m_aliasName == rhs.m_aliasName && m_fileName < rhs.m_fileName ) return true;
979  }
980  return false;
981  }
982 
983  bool operator == ( const NamespaceAliasModel& rhs ) const {
984  return m_name == rhs.m_name && m_aliasName == rhs.m_aliasName && m_fileName == rhs.m_fileName;
985  }
986 
987 private:
988  TQString m_name;
989  TQString m_aliasName;
990  HashedString m_fileName;
991 };
992 
993 class NamespaceImportModel {
994 public:
995  virtual void read( TQDataStream& stream );
996  virtual void write( TQDataStream& stream ) const;
997 
998  TQString name() const {
999  return m_name;
1000  }
1001 
1002  HashedString fileName() const {
1003  return m_fileName;
1004  }
1005 
1006  void setName( const TQString& name ) {
1007  m_name = name;
1008  }
1009 
1010  void setFileName( const HashedString& file ) {
1011  m_fileName = file;
1012  }
1013 
1014  bool operator < ( const NamespaceImportModel& rhs ) const {
1015  if( m_name < rhs.m_name ) return true;
1016  if( m_name == rhs.m_name )
1017  if( m_fileName < rhs.m_fileName ) return true;
1018 
1019  return false;
1020  }
1021 
1022  bool operator == ( const NamespaceImportModel& rhs ) const {
1023  return m_name == rhs.m_name && m_fileName == rhs.m_fileName;
1024  }
1025 
1026 private:
1027  TQString m_name;
1028  HashedString m_fileName;
1029 };
1030 
1039 class NamespaceModel: public ClassModel
1040 {
1041 protected:
1044  NamespaceModel( CodeModel* model );
1045 
1046 public:
1047  typedef std::set<NamespaceAliasModel> NamespaceAliasModelList;
1048  typedef std::set<NamespaceImportModel> NamespaceImportModelList;
1049 
1051  typedef NamespaceDom Ptr;
1052 
1053  virtual bool isClass() const { return false; }
1054  virtual bool isNamespace() const { return true; }
1055 
1057  NamespaceList namespaceList();
1058 
1061  const NamespaceList namespaceList() const;
1062 
1066  bool hasNamespace( const TQString& name ) const;
1067 
1072  NamespaceDom namespaceByName( const TQString& name );
1073 
1079  const NamespaceDom namespaceByName( const TQString& name ) const;
1080 
1084  bool addNamespace( NamespaceDom ns );
1085 
1088  void removeNamespace( NamespaceDom ns );
1089 
1093  void update( const NamespaceModel* ns );
1094  bool canUpdate( const NamespaceModel* ns ) const;
1095 
1096  virtual void read( TQDataStream& stream );
1097  virtual void write( TQDataStream& stream ) const;
1098 
1099  virtual void dump( std::ostream& file, bool recurse=false, TQString Info="" );
1100 
1101  void addNamespaceImport( const NamespaceImportModel& import );
1102  void addNamespaceAlias( const NamespaceAliasModel& alias );
1103  void removeNamespaceImport( const NamespaceImportModel& import );
1104  void removeNamespaceAlias( const NamespaceAliasModel& alias );
1105 
1107  const NamespaceAliasModelList& namespaceAliases() const {
1108  return m_namespaceAliases;
1109  }
1110 
1112  const NamespaceImportModelList& namespaceImports() const {
1113  return m_namespaceImports;
1114  }
1115 private:
1116  TQMap<TQString, NamespaceDom> m_namespaces;
1117  NamespaceAliasModelList m_namespaceAliases;
1118  NamespaceImportModelList m_namespaceImports;
1119 
1120 private:
1121 
1122  NamespaceModel( const NamespaceModel& source );
1123  void operator = ( const NamespaceModel& source );
1124  friend class CodeModel;
1125 };
1126 
1127 
1128 
1129 
1138 class FileModel: public NamespaceModel
1139 {
1140 protected:
1143  FileModel( CodeModel* model );
1144 
1145 public:
1147  typedef FileDom Ptr;
1148 
1149  virtual bool isFile() const { return true; }
1150 
1151  virtual int groupId() const {
1152  return m_groupId;
1153  }
1154 
1155  virtual void setGroupId(int newId) {
1156  m_groupId = newId;
1157  }
1158 
1164  virtual void write( TQDataStream& stream ) const;
1165 
1166  FileList wholeGroup() ;
1167 
1168  TQStringList wholeGroupStrings() const;
1169 
1170  virtual void read( TQDataStream& stream );
1171 
1172  ParseResultPointer parseResult() const;
1173  void setParseResult( const ParseResultPointer& result );
1174 
1175  void update( const FileModel* i );
1176 private:
1177  int m_groupId;
1178  ParseResultPointer m_parseResult;
1179  FileModel( const FileModel& );
1180  void operator = ( const FileModel& );
1181  friend class CodeModel;
1182 };
1183 
1184 
1191 class ArgumentModel: public CodeModelItem
1192 {
1193 protected:
1194  ArgumentModel( CodeModel* model );
1195 
1196 public:
1198  typedef ArgumentDom Ptr;
1199 
1200  virtual bool isArgument() const { return true; }
1201 
1203  TQString type() const;
1204 
1207  void setType( const TQString& type );
1208 
1210  TQString defaultValue() const;
1211 
1214  void setDefaultValue( const TQString& defaultValue );
1215 
1216  virtual void read( TQDataStream& stream );
1217  virtual void write( TQDataStream& stream ) const;
1218 
1219  virtual void dump( std::ostream& file, bool recurse=false, TQString Info="" );
1220 
1221 private:
1222  TQString m_type;
1223  TQString m_defaultValue;
1224 
1225 private:
1226  ArgumentModel( const ArgumentModel& source );
1227  void operator = ( const ArgumentModel& source );
1228  friend class CodeModel;
1229 };
1230 
1231 
1245 class FunctionModel: public CodeModelItem, public TemplateModelItem
1246 {
1247 protected:
1250  FunctionModel( CodeModel* model );
1251 
1252 public:
1254  typedef FunctionDom Ptr;
1255 
1256  virtual bool isFunction() const { return true; }
1257 
1260  TQStringList scope() const { return m_scope; }
1261 
1264  void setScope( const TQStringList& scope ) { m_scope = scope; }
1265 
1269  int access() const;
1270 
1273  void setAccess( int access );
1274 
1276  bool isSignal() const;
1279  void setSignal( bool isSignal );
1280 
1282  bool isSlot() const;
1285  void setSlot( bool isSlot );
1286 
1288  bool isVirtual() const;
1291  void setVirtual( bool isVirtual );
1292 
1294  bool isStatic() const;
1297  void setStatic( bool isStatic );
1298 
1300  bool isInline() const;
1303  void setInline( bool isInline );
1304 
1306  bool isConstant() const;
1309  void setConstant( bool isConstant );
1310 
1312  bool isAbstract() const;
1315  void setAbstract( bool isAbstract );
1316 
1318  TQString resultType() const;
1321  void setResultType( const TQString& type );
1322 
1326  ArgumentList argumentList();
1327 
1332  const ArgumentList argumentList() const;
1333 
1337  bool addArgument( ArgumentDom arg );
1338 
1341  void removeArgument( ArgumentDom arg );
1342 
1343  virtual void read( TQDataStream& stream );
1344  virtual void write( TQDataStream& stream ) const;
1345 
1346  virtual void dump( std::ostream& file, bool recurse=false, TQString Info="" );
1347 
1348  void update( const FunctionModel* i );
1349  bool canUpdate( const FunctionModel* i ) const;
1350 
1351 private:
1352  TQStringList m_scope;
1353  int m_access;
1354 
1355  union {
1356  struct {
1357  int m_signal : 1;
1358  int m_slot : 1;
1359  int m_virtual : 1;
1360  int m_static : 1;
1361  int m_inline : 1;
1362  int m_constant : 1;
1363  int m_abstract : 1;
1364  } v;
1365  int flags;
1366  } d;
1367 
1368  TQString m_resultType;
1369  ArgumentList m_arguments;
1370 
1371 private:
1372  FunctionModel( const FunctionModel& source );
1373  void operator = ( const FunctionModel& source );
1374  friend class CodeModel;
1375 };
1376 
1383 class FunctionDefinitionModel: public FunctionModel
1384 {
1385 protected:
1388  FunctionDefinitionModel( CodeModel* model );
1389 
1390 public:
1392  typedef FunctionDefinitionDom Ptr;
1393 
1394  virtual bool isFunctionDefinition() const { return true; }
1395 
1396 private:
1397  FunctionDefinitionModel( const FunctionDefinitionModel& source );
1398  void operator = ( const FunctionDefinitionModel& source );
1399  friend class CodeModel;
1400 };
1401 
1402 
1409 class VariableModel: public CodeModelItem
1410 {
1411 protected:
1414  VariableModel( CodeModel* model );
1415 
1416 public:
1418  typedef VariableDom Ptr;
1419 
1420  virtual bool isVariable() const { return true; }
1421 
1425  int access() const;
1428  void setAccess( int access );
1429 
1431  bool isStatic() const;
1434  void setStatic( bool isStatic );
1435 
1437  TQString type() const;
1440  void setType( const TQString& type );
1441 
1443  bool isEnumeratorVariable() const;
1444 
1445  void setEnumeratorVariable( bool b );
1446 
1447  virtual void read( TQDataStream& stream );
1448  virtual void write( TQDataStream& stream ) const;
1449 
1450  virtual void dump( std::ostream& file, bool recurse=false, TQString Info="" );
1451 
1452  void update( const VariableModel* i );
1453  bool canUpdate( const VariableModel* i ) const;
1454 
1455 private:
1456  int m_access;
1457  int m_static;
1458  TQString m_type;
1459  int m_isEnumeratorVariable;
1460 
1461 private:
1462  VariableModel( const VariableModel& source );
1463  void operator = ( const VariableModel& source );
1464  friend class CodeModel;
1465 };
1466 
1467 
1474 class EnumModel: public CodeModelItem
1475 {
1476 protected:
1479  EnumModel( CodeModel* model );
1480 
1481 public:
1483  typedef EnumDom Ptr;
1484 
1485  virtual bool isEnum() const { return true; }
1486 
1489  int access() const;
1492  void setAccess( int access );
1493 
1495  EnumeratorList enumeratorList();
1498  const EnumeratorList enumeratorList() const;
1501  void addEnumerator( EnumeratorDom e );
1504  void removeEnumerator( EnumeratorDom e );
1505 
1506  virtual void read( TQDataStream& stream );
1507  virtual void write( TQDataStream& stream ) const;
1508 
1510  virtual void dump( std::ostream& file, bool recurse=false, TQString Info="" );
1511 
1512  void update( const EnumModel* i );
1513  bool canUpdate( const EnumModel* i ) const;
1514 
1515 private:
1516  int m_access;
1517  TQMap<TQString, EnumeratorDom> m_enumerators;
1518 
1519 private:
1520  EnumModel( const EnumModel& source );
1521  void operator = ( const EnumModel& source );
1522  friend class CodeModel;
1523 };
1524 
1525 
1537 class EnumeratorModel: public CodeModelItem
1538 {
1539 protected:
1542  EnumeratorModel( CodeModel* model );
1543 
1544 public:
1546  typedef EnumeratorDom Ptr;
1547 
1548  virtual bool isEnumerator() const { return true; }
1549 
1551  TQString value() const;
1554  void setValue( const TQString& value );
1555 
1556  virtual void read( TQDataStream& stream );
1557  virtual void write( TQDataStream& stream ) const;
1558 
1559  virtual void dump( std::ostream& file, bool recurse=false, TQString Info="" );
1560 
1561 private:
1562  TQString m_value;
1563 
1564 private:
1565  EnumeratorModel( const EnumeratorModel& source );
1566  void operator = ( const EnumeratorModel& source );
1567  friend class CodeModel;
1568 };
1569 
1570 
1575 class TypeAliasModel: public CodeModelItem
1576 {
1577 protected:
1580  TypeAliasModel( CodeModel* model );
1581 
1582 public:
1584  typedef TypeAliasDom Ptr;
1585 
1586  virtual bool isTypeAlias() const { return true; }
1587 
1589  TQString type() const;
1592  void setType( const TQString& type );
1593 
1594  virtual void read( TQDataStream& stream );
1595  virtual void write( TQDataStream& stream ) const;
1596 
1597 
1598  virtual void dump( std::ostream& file, bool recurse=false, TQString Info="" );
1599 
1600  void update( const TypeAliasModel* i );
1601  bool canUpdate( const TypeAliasModel* i ) const;
1602 
1603 private:
1604  TQString m_type;
1605 
1606 private:
1607  TypeAliasModel( const TypeAliasModel& source );
1608  void operator = ( const TypeAliasModel& source );
1609  friend class CodeModel;
1610 };
1611 
1612 #endif
CodeModelItem::Namespace
Namespace.
Definition: codemodel.h:471
EnumeratorDom
Safe pointer to the EnumeratorModel.
ArgumentList
The list of code model arguments.
CodeModelItem::isClass
virtual bool isClass() const
Definition: codemodel.h:568
CodeModelItem::File
File.
Definition: codemodel.h:470
EnumList
The list of code model enums.
CodeModelItem::isFunctionDefinition
virtual bool isFunctionDefinition() const
Definition: codemodel.h:572
VariableModel
Variable model.
Definition: codemodel.h:1409
FunctionModel::setScope
void setScope(const TQStringList &scope)
Sets the scope of the function.
Definition: codemodel.h:1264
NamespaceModel::isClass
virtual bool isClass() const
Definition: codemodel.h:1053
EnumeratorModel::Ptr
EnumeratorDom Ptr
A definition of safe pointer to the enumerator model.
Definition: codemodel.h:1546
CodeModelItem::isEnumerator
virtual bool isEnumerator() const
Definition: codemodel.h:580
CodeModelItem::Protected
Protected.
Definition: codemodel.h:489
CodeModelItem::isArgument
virtual bool isArgument() const
Definition: codemodel.h:576
FunctionModel::isFunction
virtual bool isFunction() const
Definition: codemodel.h:1256
EnumeratorModel::isEnumerator
virtual bool isEnumerator() const
Definition: codemodel.h:1548
FunctionDefinitionModel
Function model.
Definition: codemodel.h:1383
FileModel::Ptr
FileDom Ptr
A definition of safe pointer to the file model.
Definition: codemodel.h:1147
std
ClassModel::scope
TQStringList scope() const
Definition: codemodel.h:710
FunctionModel::scope
TQStringList scope() const
Definition: codemodel.h:1260
model_cast
Result model_cast(TDESharedPtr< T > x)
Casts safe code model pointers (TDESharedPtr<T> objects like FileDom, NamespaceDom, etc.) to the Result type.
Definition: codemodel.h:285
NamespaceList
The list of code model namespaces.
FunctionDefinitionModel::isFunctionDefinition
virtual bool isFunctionDefinition() const
Definition: codemodel.h:1394
VariableDom
Safe pointer to the VariableModel.
NamespaceModel::NamespaceImportModelList
std::set< NamespaceImportModel > NamespaceImportModelList
I&#39;m using std-sets here, because TQt-3 has no appropriate replacement.
Definition: codemodel.h:1048
CodeModelItem::Enum
Enum.
Definition: codemodel.h:477
CodeModelItem::Kind
Kind
A type of a code model item.
Definition: codemodel.h:468
FileModel
File model.
Definition: codemodel.h:1138
VariableList
The list of code model variables.
CodeModelItem::isFile
virtual bool isFile() const
Definition: codemodel.h:564
ClassModel::setScope
void setScope(const TQStringList &scope)
Sets the scope of this class.
Definition: codemodel.h:713
FunctionDefinitionList
The list of code model function definitions.
EnumeratorModel
Enumerator model.
Definition: codemodel.h:1537
TypeAliasDom
Safe pointer to the TypeAliasModel.
sortedNameList
TQStringList sortedNameList(const ItemList &lst)
Iterates through lst and creates sorted list of code model item names.
Definition: codemodel.h:258
EnumDom
Safe pointer to the EnumModel.
ItemDom
Safe pointer to the CodeModelItem.
Definition: codemodel.h:70
FileModel::isFile
virtual bool isFile() const
Definition: codemodel.h:1149
ClassList
The list of code model classes.
CodeModelItem::Function
Function or class method.
Definition: codemodel.h:473
ArgumentModel::Ptr
ArgumentDom Ptr
A definition of safe pointer to the argument model.
Definition: codemodel.h:1198
ArgumentDom
Safe pointer to the ArgumentModel.
NamespaceModel
Namespace model.
Definition: codemodel.h:1039
CodeModelItem
Item in code model (symbol store).
Definition: codemodel.h:461
TypeAliasModel::isTypeAlias
virtual bool isTypeAlias() const
Definition: codemodel.h:1586
NamespaceModel::Ptr
NamespaceDom Ptr
A definition of safe pointer to the namespace model.
Definition: codemodel.h:1051
CodeModelItem::Class
Class.
Definition: codemodel.h:472
VariableModel::isVariable
virtual bool isVariable() const
Definition: codemodel.h:1420
FunctionDom
Safe pointer to the FunctionModel.
ClassModel::isClass
virtual bool isClass() const
Definition: codemodel.h:707
CodeModelItem::Access
Access
An access to the code model item.
Definition: codemodel.h:486
FunctionModel
Function model.
Definition: codemodel.h:1245
HashedString
A simple class that stores a string together with it&#39;s appropriate hash-key.
Definition: hashedstring.h:26
NamespaceModel::isNamespace
virtual bool isNamespace() const
Definition: codemodel.h:1054
CodeModelItem::isCustom
virtual bool isCustom() const
Definition: codemodel.h:584
EnumModel
Enum model.
Definition: codemodel.h:1474
ClassDom
Safe pointer to the ClassModel.
CodeModelItem::Variable
Variable.
Definition: codemodel.h:474
CodeModelItem::kind
int kind() const
Definition: codemodel.h:506
TypeAliasModel
Type alias model.
Definition: codemodel.h:1575
CodeModel
Code Model - a memory symbol store.
Definition: codemodel.h:324
NamespaceModel::namespaceAliases
const NamespaceAliasModelList & namespaceAliases() const
Must not be called on temporary objects because a reference is returned(for performance-reasons) ...
Definition: codemodel.h:1107
CodeModelItem::Argument
Function or method parameter.
Definition: codemodel.h:475
FileList
The list of code model files.
ClassModel::Ptr
ClassDom Ptr
A definition of safe pointer to the class model.
Definition: codemodel.h:705
CodeModelItem::setKind
void setKind(int kind)
Sets the type (kind) of item.
Definition: codemodel.h:510
FunctionDefinitionModel::Ptr
FunctionDefinitionDom Ptr
A definition of safe pointer to the function definition model.
Definition: codemodel.h:1392
FunctionModel::Ptr
FunctionDom Ptr
A definition of safe pointer to the function model.
Definition: codemodel.h:1254
FunctionDefinitionDom
Safe pointer to the FunctionDefinitionModel.
CodeModelItem::isEnum
virtual bool isEnum() const
Definition: codemodel.h:578
CodeModelItem::codeModel
CodeModel * codeModel()
Definition: codemodel.h:598
CodeModel::create
T::Ptr create()
Creates a code model item.
Definition: codemodel.h:343
CodeModelItem::Public
Public.
Definition: codemodel.h:488
CodeModelItem::TypeAlias
Type alias (aka typedef in c++).
Definition: codemodel.h:480
FileDom
Safe pointer to the FileModel.
TypeAliasList
The list of code model type aliases.
CodeModelItem::isVariable
virtual bool isVariable() const
Definition: codemodel.h:574
ArgumentModel::isArgument
virtual bool isArgument() const
Definition: codemodel.h:1200
CodeModelItem::isFunction
virtual bool isFunction() const
Definition: codemodel.h:570
ItemList
The list of code model items.
VariableModel::Ptr
VariableDom Ptr
A definition of safe pointer to the variable model.
Definition: codemodel.h:1418
TypeAliasModel::Ptr
TypeAliasDom Ptr
A definition of safe pointer to the type alias model.
Definition: codemodel.h:1584
ArgumentModel
Function (procedure) argument model.
Definition: codemodel.h:1191
NamespaceDom
Safe pointer to the NamespaceModel.
EnumModel::isEnum
virtual bool isEnum() const
Definition: codemodel.h:1485
EnumModel::Ptr
EnumDom Ptr
A definition of safe pointer to the enum model.
Definition: codemodel.h:1483
CodeModelItem::FunctionDefinition
Function definition.
Definition: codemodel.h:476
FunctionList
The list of code model functions.
EnumeratorList
The list of code model enumerators.
CodeModelItem::codeModel
const CodeModel * codeModel() const
Definition: codemodel.h:602
ClassModel
Class model.
Definition: codemodel.h:696
NamespaceModel::namespaceImports
const NamespaceImportModelList & namespaceImports() const
Must not be called on temporary objects because a reference is returned(for performance-reasons) ...
Definition: codemodel.h:1112
CodeModelItem::isTypeAlias
virtual bool isTypeAlias() const
Definition: codemodel.h:582
CodeModelItem::isNamespace
virtual bool isNamespace() const
Definition: codemodel.h:566
CodeModelItem::Ptr
ItemDom Ptr
A definition of safe pointer to the code model item.
Definition: codemodel.h:465

TDevelop Interfaces Library

Skip menu "TDevelop Interfaces Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

TDevelop Interfaces Library

Skip menu "TDevelop Interfaces Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for TDevelop Interfaces Library by doxygen 1.8.13
This website is maintained by Timothy Pearson.