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

TDevelop Interfaces Library

  • lib
  • interfaces
codemodel.cpp
1/* This file is part of TDevelop
2 Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include "codemodel.h"
21#include "driver.h"
22#include <kdebug.h>
23#include <kdatastream.h>
24
26template<class MapContainer>
27bool eachCanUpdate( const MapContainer& old, const MapContainer& newMap ) {
28 if( old.size() != newMap.size() ) return false;
29
30 typename MapContainer::const_iterator oldIt = old.begin();
31 typename MapContainer::const_iterator newIt = newMap.begin();
32 while( oldIt != old.end() ) {
33 typedef typename MapContainer::mapped_type ListType;
34 if( (*oldIt).size() != (*newIt).size() ) return false;
35 typename ListType::const_iterator it1 = (*oldIt).begin();
36 typename ListType::const_iterator it2 = (*newIt).begin();
37
38 while( it1 != (*oldIt).end() ) {
39 if( !(*it1)->canUpdate( *it2 ) ) return false;
40 ++it1;
41 ++it2;
42 }
43 ++oldIt;
44 ++newIt;
45 }
46 return true;
47}
48
49template<class MapContainer>
50void eachUpdate( MapContainer& old, const MapContainer& newMap ) {
51 if( old.size() != newMap.size() ) kdError( 9007 ) << "error in eachUpdate(...) 1" << endl;
52 typename MapContainer::iterator oldIt = old.begin();
53 typename MapContainer::const_iterator newIt = newMap.begin();
54 while( oldIt != old.end() ) {
55 if( (*oldIt).size() != (*newIt).size() ) kdError( 9007 ) << "error in eachUpdate(...) 2" << endl;
56 typedef typename MapContainer::mapped_type ListType;
57 typename ListType::iterator it1 = (*oldIt).begin();
58 typename ListType::const_iterator it2 = (*newIt).begin();
59 while( it1 != (*oldIt).end() ) {
60 (*it1)->update( *it2 );
61 ++it1;
62 ++it2;
63 }
64 ++oldIt;
65 ++newIt;
66 }
67}
68
70template<class MapContainer>
71bool eachCanUpdateSingle( const MapContainer& old, const MapContainer& newMap ) {
72 if( old.size() != newMap.size() ) return false;
73
74 typename MapContainer::const_iterator oldIt = old.begin();
75 typename MapContainer::const_iterator newIt = newMap.begin();
76 while( oldIt != old.end() ) {
77 if( !(*oldIt)->canUpdate( *newIt ) ) return false;
78 ++oldIt;
79 ++newIt;
80 }
81 return true;
82}
83
84template<class MapContainer>
85void eachUpdateSingle( MapContainer& old, const MapContainer& newMap ) {
86 if( old.size() != newMap.size() ) kdError( 9007 ) << "error in eachUpdate(...) 1" << endl;
87 typename MapContainer::iterator oldIt = old.begin();
88 typename MapContainer::const_iterator newIt = newMap.begin();
89 while( oldIt != old.end() ) {
90 (*oldIt)->update( *newIt );
91 ++oldIt;
92 ++newIt;
93 }
94}
95
96CodeModel::CodeModel()
97{
98 wipeout();
99 m_currentGroupId = 1;
100}
101
102CodeModel::~ CodeModel( )
103{
104}
105
106int CodeModel::newGroupId() {
107 return (m_currentGroupId++) * 2;
108}
109
110inline bool isSingleGroup( const int group ) {
111 return (group % 2) == 0;
112}
113
114TQStringList CodeModel::getGroupStrings(int gid) const {
115 TQStringList ret;
116 for(TQMap<TQString, FileDom>::ConstIterator it = m_files.begin(); it != m_files.end(); ++it) {
117 if((*it)->groupId() == gid) ret.append( (*it)-> name() );
118 }
119 return ret;
120}
121
122
123FileList CodeModel::getGroup(int gid) const {
124 FileList ret;
125 for(TQMap<TQString, FileDom>::ConstIterator it = m_files.begin(); it != m_files.end(); ++it) {
126 if((*it)->groupId() == gid) ret.append(*it);
127 }
128 return ret;
129}
130
131FileList CodeModel::getGroup( const FileDom& dom) const {
132 return getGroup( dom->groupId() );
133}
134
135int CodeModel::mergeGroups( int g1, int g2) {
136 if( !g1 || !g2 ) return 0;
137 if( g1 == g2 ) return g1;
138 int ng = isSingleGroup( g1 ) ? g2 : g1;
139 if( isSingleGroup( ng ) )
140 ng = newGroupId() + 1;
141
142 for( TQMap<TQString, FileDom>::iterator it = m_files.begin(); it != m_files.end(); ++it ) {
143 if( (*it)->groupId() == g2 || (*it)->groupId() == g1 ) (*it)->setGroupId( ng );
144 }
145 return ng;
146}
147
148template<class Type> static void dumpMap( std::ostream& file, TQMap<TQString, Type>& map ) {
149 typename TQMap<TQString, Type>::Iterator it = map.begin();
150 for( ; it != map.end(); ++it) {
151 typename Type::Iterator it2 = (*it).begin();
152 for( ; it2 != (*it).end(); ++it2) {
153 (*it2) -> dump( file, true );
154 }
155 }
156}
157
158template<class Type> static void dumpMapDirect( std::ostream& file, TQMap<TQString, Type>& map ) {
159 typename TQMap<TQString, Type>::Iterator it = map.begin();
160 for( ; it != map.end(); ++it) {
161 (*it) -> dump( file, true );
162 }
163}
164
165void CodeModelItem::dump( std::ostream& file, bool recurse, TQString Info )
166{
167 ostringstream str( ostringstream::out );
168
169 str << "name: " << name().ascii() << "\n";
170 str << "kind: " << m_kind << " ";
171
172 if( isFile() ) str << "isFile ";
173 if( isNamespace() ) str << "isNamespace ";
174 if( isClass() ) str << "isClass ";
175 if( isFunction() ) str << "isFunction ";
176 if( isFunctionDefinition() ) str << "isFunctionDefinition ";
177 if( isVariable() ) str << "isVariable ";
178 if( isArgument() ) str << "isArgument ";
179 if( isEnum() ) str << "isEnum ";
180 if( isEnumerator() ) str << "isEnumerator ";
181 if( isTypeAlias() ) str << "isTypeAlias ";
182 if( isCustom() ) str << "isCustom ";
183 str << "\n";
184 str << "File: " << fileName().ascii() << " ";
185 int line, col;
186 getStartPosition( &line, &col );
187 str << "s:(" << line << ", " << col << ") ";
188 getEndPosition( &line, &col );
189 str << "e:(" << line << ", " << col << ")\n";
190
191
192 Info.prepend( str.str().c_str() );
193
194 file << Info.ascii() << "\n";
195 if(recurse) {}
196}
197
198void ClassModel::dump( std::ostream& file, bool recurse, TQString Info )
199{
200 ostringstream str( ostringstream::out );
201
202
203 str << "scope: " << m_scope.join("::").ascii() << "\n";
204 str << "bases: " << m_baseClassList.join(" ").ascii() << "\n";
205
206 Info.prepend( str.str().c_str() );
207
208 CodeModelItem::dump( file, false, Info );
209
210 if( recurse ) {
211 dumpMap( file, m_classes );
212 }
213}
214
215void NamespaceAliasModel::read( TQDataStream& stream ) {
216 TQString tempFileName;
217 stream >> m_name >> m_aliasName >> tempFileName;
218 m_fileName = HashedString( tempFileName );
219}
220
221void NamespaceAliasModel::write( TQDataStream& stream ) const {
222 stream << m_name << m_aliasName << m_fileName.str();
223}
224
225void NamespaceImportModel::read( TQDataStream& stream ) {
226 TQString tempFileName;
227 stream >> m_name >> tempFileName;
228 m_fileName = HashedString( tempFileName );
229}
230
231void NamespaceImportModel::write( TQDataStream& stream ) const {
232 stream << m_name << m_fileName.str();
233}
234
235void NamespaceModel::dump( std::ostream& file, bool recurse, TQString Info )
236{
237 ostringstream str( ostringstream::out );
238
239 Info.prepend( str.str().c_str() );
240
241 ClassModel::dump( file, false, Info );
242
243 if( recurse ) {
244 dumpMapDirect( file, m_namespaces );
245 }
246}
247
248void ArgumentModel::dump( std::ostream& file, bool recurse, TQString Info )
249{
250 ostringstream str( ostringstream::out );
251
252 str << "type: " << m_type.ascii() << " default: " << m_defaultValue.ascii() << "\n";
253
254 Info.prepend( str.str().c_str() );
255
256 CodeModelItem::dump( file, false, Info );
257
258 if(recurse) {}
259}
260
261void FunctionModel::dump( std::ostream& file, bool recurse, TQString Info )
262{
263 ostringstream str( ostringstream::out );
264
265 str << "access: " << m_access;
266
267 str << " scope: " << m_scope.join("::").ascii() << "\n";
268
269 if(isAbstract()) str << "isAbstract ";
270 if(isConstant()) str << "isConstant ";
271 if(isFunction()) str << "isFunction ";
272 if(isInline()) str << "isInline ";
273 if(isSignal()) str << "isSignal ";
274 if(isSlot()) str << "isSlot ";
275 if(isStatic()) str << "isStatic ";
276 if(isVirtual()) str << "isVirtual ";
277
278 str << "\n";
279 str << "result-type: " << resultType().ascii() << "\n";
280
281 Info.prepend( str.str().c_str() );
282
283 CodeModelItem::dump( file, false, Info );
284
285 if(recurse) {
286 for( ArgumentList::iterator it = m_arguments.begin(); it != m_arguments.end(); ++it) {
287 (*it) -> dump( file, true );
288 }
289 }
290}
291
292void VariableModel::dump( std::ostream& file, bool recurse, TQString Info )
293{
294 ostringstream str( ostringstream::out );
295
296 str << "access: " << m_access << "type: " << m_type.ascii() << "\n";
297
298 if(isStatic()) str << "isStatic ";
299
300 str << "\n";
301
302 Info.prepend( str.str().c_str() );
303
304 CodeModelItem::dump( file, false, Info );
305
306 if(recurse) {}
307}
308
309void CodeModel::dump( std::ostream& file, TQString Info ) {
310 ostringstream str(ostringstream::out);
311
312 Info.prepend( str.str().c_str() );
313
314 file << Info.ascii() << "\n";
315
316 TQMap<TQString, FileDom>::iterator it = m_files.begin();
317 for(; it != m_files.end(); ++it) {
318 (*it) -> dump( file, true );
319 }
320}
321
322void EnumModel::dump( std::ostream& file, bool recurse, TQString Info )
323{
324 ostringstream str( ostringstream::out );
325
326 str << "access: " << m_access << "\n";
327
328 Info.prepend( str.str().c_str() );
329
330 CodeModelItem::dump( file, false, Info );
331
332 if( recurse ) {
333 dumpMapDirect( file, m_enumerators );
334 }
335}
336
337void EnumeratorModel::dump( std::ostream& file, bool recurse, TQString Info )
338{
339 ostringstream str( ostringstream::out );
340
341 str << "value: " << m_value.ascii() << "\n";
342
343 Info.prepend( str.str().c_str() );
344
345 CodeModelItem::dump( file, false, Info );
346
347 if(recurse) {}
348}
349
350void TypeAliasModel::dump( std::ostream& file, bool recurse, TQString Info ) {
351 ostringstream str( ostringstream::out );
352
353 str << "type: " << m_type.ascii() << "\n";
354
355 Info.prepend( str.str().c_str() );
356
357 CodeModelItem::dump( file, false, Info );
358
359 if(recurse) {}
360}
361
362void CodeModel::wipeout()
363{
364 m_files.clear();
365 NamespaceDom ns = create<NamespaceModel>();
366 ns->setName( "::" );
367
368 m_globalNamespace = ns;
369}
370
371FileList CodeModel::fileList( )
372{
373 return m_files.values();
374}
375
376const FileList CodeModel::fileList( ) const
377{
378 return m_files.values();
379}
380
381bool CodeModel::hasFile( const TQString & name ) const
382{
383 return m_files.contains( name );
384}
385
386FileDom CodeModel::fileByName( const TQString & name )
387{
388 TQMap<TQString, FileDom>::const_iterator it = m_files.find( name );
389 if( it != m_files.end() ) {
390 return *it;
391 } else {
392 return FileDom();
393 }
394}
395
396const FileDom CodeModel::fileByName( const TQString & name ) const
397{
398 TQMap<TQString, FileDom>::const_iterator it = m_files.find( name );
399 if( it != m_files.end() ) {
400 return *it;
401 } else {
402 return FileDom();
403 }
404}
405
406void CodeModel::addNamespace( NamespaceDom target, NamespaceDom source )
407{
408 if( source->name().isEmpty() ){
409 return;
410 } else if( !target->hasNamespace(source->name()) ){
411 NamespaceDom ns = this->create<NamespaceModel>();
412 ns->setName( source->name() );
413 ns->setFileName( source->fileName() );
414 ns->setScope( source->scope() );
415 target->addNamespace( ns );
416 }
417
418 NamespaceDom ns = target->namespaceByName( source->name() );
419
420 NamespaceList namespaceList = source->namespaceList();
421 ClassList classList = source->classList();
422 FunctionList functionList = source->functionList();
423 FunctionDefinitionList functionDefinitionList = source->functionDefinitionList();
424 VariableList variableList = source->variableList();
425 EnumList enumList = source->enumList();
426 TypeAliasList typeAliasList = source->typeAliasList();
427 const NamespaceModel::NamespaceAliasModelList& namespaceAliases = source->namespaceAliases();
428 const NamespaceModel::NamespaceImportModelList& namespaceImports = source->namespaceImports();
429
430 for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
431 addNamespace( ns, *it );
432 for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
433 ns->addClass( *it );
434 for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
435 ns->addFunction( *it );
436 for( FunctionDefinitionList::Iterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
437 ns->addFunctionDefinition( *it );
438 for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
439 ns->addVariable( *it );
440 for( EnumList::Iterator it=enumList.begin(); it!=enumList.end(); ++it )
441 ns->addEnum( *it );
442 for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
443 ns->addTypeAlias( *it );
444 for( NamespaceModel::NamespaceAliasModelList::const_iterator it=namespaceAliases.begin(); it != namespaceAliases.end(); ++it )
445 ns->addNamespaceAlias( *it );
446 for( NamespaceModel::NamespaceImportModelList::const_iterator it=namespaceImports.begin(); it != namespaceImports.end(); ++it )
447 ns->addNamespaceImport( *it );
448}
449
450void CodeModel::removeNamespace( NamespaceDom target, NamespaceDom source )
451{
452 if( source->name().isEmpty() || !target->hasNamespace(source->name()) )
453 return;
454
455 NamespaceDom ns = target->namespaceByName( source->name() );
456
457 NamespaceList namespaceList = source->namespaceList();
458 ClassList classList = source->classList();
459 FunctionList functionList = source->functionList();
460 FunctionDefinitionList functionDefinitionList = source->functionDefinitionList();
461 VariableList variableList = source->variableList();
462 EnumList enumList = source->enumList();
463 TypeAliasList typeAliasList = source->typeAliasList();
464 const NamespaceModel::NamespaceAliasModelList& namespaceAliases = source->namespaceAliases();
465 const NamespaceModel::NamespaceImportModelList& namespaceImports = source->namespaceImports();
466
467 for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
468 removeNamespace( ns, *it );
469 for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
470 ns->removeClass( *it );
471 for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
472 ns->removeFunction( *it );
473 for( FunctionDefinitionList::Iterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
474 ns->removeFunctionDefinition( *it );
475 for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
476 ns->removeVariable( *it );
477 for( EnumList::Iterator it=enumList.begin(); it!=enumList.end(); ++it )
478 ns->removeEnum( *it );
479 for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
480 ns->removeTypeAlias( *it );
481 for( NamespaceModel::NamespaceAliasModelList::const_iterator it=namespaceAliases.begin(); it != namespaceAliases.end(); ++it )
482 ns->removeNamespaceAlias( *it );
483 for( NamespaceModel::NamespaceImportModelList::const_iterator it=namespaceImports.begin(); it != namespaceImports.end(); ++it )
484 ns->removeNamespaceImport( *it );
485
486 if( ns->namespaceList().isEmpty() &&
487 ns->classList().isEmpty() &&
488 ns->functionList().isEmpty() &&
489 ns->functionDefinitionList().isEmpty() &&
490 ns->variableList().isEmpty() &&
491 ns->enumList().isEmpty() &&
492 ns->typeAliasList().isEmpty() &&
493 ns->namespaceImports().empty() &&
494 ns->namespaceAliases().empty() )
495 {
496 target->removeNamespace( ns );
497 }
498}
499
500bool CodeModel::addFile( FileDom file )
501{
502 if( file->name().isEmpty() )
503 return false;
504
505 if( m_files.find( file->name() ) != m_files.end() ) {
507 kdDebug(9007) << "file " << file->name() << " was added to code-model without removing it before! \n" << kdBacktrace() << endl;
508 removeFile( fileByName( file->name() ) );
509 }
510
511 // update global namespace
512 NamespaceList namespaceList = file->namespaceList();
513 ClassList classList = file->classList();
514 FunctionList functionList = file->functionList();
515 FunctionDefinitionList functionDefinitionList = file->functionDefinitionList();
516 VariableList variableList = file->variableList();
517 EnumList enumList = file->enumList();
518 TypeAliasList typeAliasList = file->typeAliasList();
519 const NamespaceModel::NamespaceAliasModelList& namespaceAliases = file->namespaceAliases();
520 const NamespaceModel::NamespaceImportModelList& namespaceImports = file->namespaceImports();
521
522 for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
523 addNamespace( m_globalNamespace, *it );
524 for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
525 m_globalNamespace->addClass( *it );
526 for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
527 m_globalNamespace->addFunction( *it );
528 for( FunctionDefinitionList::Iterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
529 m_globalNamespace->addFunctionDefinition( *it );
530 for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
531 m_globalNamespace->addVariable( *it );
532 for( EnumList::Iterator it=enumList.begin(); it!=enumList.end(); ++it )
533 m_globalNamespace->addEnum( *it );
534 for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
535 m_globalNamespace->addTypeAlias( *it );
536 for( NamespaceModel::NamespaceAliasModelList::const_iterator it=namespaceAliases.begin(); it != namespaceAliases.end(); ++it )
537 m_globalNamespace->addNamespaceAlias( *it );
538 for( NamespaceModel::NamespaceImportModelList::const_iterator it=namespaceImports.begin(); it != namespaceImports.end(); ++it )
539 m_globalNamespace->addNamespaceImport( *it );
540
541 m_files.insert( file->name(), file );
542 return true;
543}
544
545void CodeModel::removeFile( FileDom file )
546{
547 // update global namespace
548 NamespaceList namespaceList = file->namespaceList();
549 ClassList classList = file->classList();
550 FunctionList functionList = file->functionList();
551 FunctionDefinitionList functionDefinitionList = file->functionDefinitionList();
552 VariableList variableList = file->variableList();
553 EnumList enumList = file->enumList();
554 TypeAliasList typeAliasList = file->typeAliasList();
555 const NamespaceModel::NamespaceAliasModelList& namespaceAliases = file->namespaceAliases();
556 const NamespaceModel::NamespaceImportModelList& namespaceImports = file->namespaceImports();
557
558 for( NamespaceList::Iterator it=namespaceList.begin(); it!=namespaceList.end(); ++it )
559 removeNamespace( m_globalNamespace, *it );
560 for( ClassList::Iterator it=classList.begin(); it!=classList.end(); ++it )
561 m_globalNamespace->removeClass( *it );
562 for( FunctionList::Iterator it=functionList.begin(); it!=functionList.end(); ++it )
563 m_globalNamespace->removeFunction( *it );
564 for( FunctionDefinitionList::Iterator it=functionDefinitionList.begin(); it!=functionDefinitionList.end(); ++it )
565 m_globalNamespace->removeFunctionDefinition( *it );
566 for( VariableList::Iterator it=variableList.begin(); it!=variableList.end(); ++it )
567 m_globalNamespace->removeVariable( *it );
568 for( EnumList::Iterator it=enumList.begin(); it!=enumList.end(); ++it )
569 m_globalNamespace->removeEnum( *it );
570 for( TypeAliasList::Iterator it=typeAliasList.begin(); it!=typeAliasList.end(); ++it )
571 m_globalNamespace->removeTypeAlias( *it );
572 for( NamespaceModel::NamespaceAliasModelList::const_iterator it=namespaceAliases.begin(); it != namespaceAliases.end(); ++it )
573 m_globalNamespace->removeNamespaceAlias( *it );
574 for( NamespaceModel::NamespaceImportModelList::const_iterator it=namespaceImports.begin(); it != namespaceImports.end(); ++it )
575 m_globalNamespace->removeNamespaceImport( *it );
576
577 m_files.remove( file->name() );
578}
579
580// ------------------------------------------------------------------------
581CodeModelItem::CodeModelItem( int kind, CodeModel* model )
582 : m_kind( kind ), m_model( model )
583{
584 //kdDebug() << "CodeModelItem::CodeModelItem()" << endl;
585 m_startLine = 0;
586 m_startColumn = 0;
587 m_endLine = 0;
588 m_endColumn = 0;
589}
590
591CodeModelItem::~ CodeModelItem( )
592{
593}
594
595TQString CodeModelItem::name( ) const
596{
597 return m_name;
598}
599
600void CodeModelItem::setName( const TQString & name )
601{
602 m_name = name;
603}
604
605const FileDom CodeModelItem::file( ) const
606{
607 return m_model->fileByName( m_fileName );
608}
609
610FileDom CodeModelItem::file( )
611{
612 return m_model->fileByName( m_fileName );
613}
614
615TQString CodeModelItem::fileName() const
616{
617 return m_fileName;
618}
619
620void CodeModelItem::setFileName( const TQString& fileName )
621{
622 m_fileName = fileName;
623}
624
625void CodeModelItem::getStartPosition( int * line, int * column ) const
626{
627 if( line ) *line = m_startLine;
628 if( column ) *column = m_startColumn;
629}
630
631void CodeModelItem::setStartPosition( int line, int column )
632{
633 m_startLine = line;
634 m_startColumn = column;
635}
636
637void CodeModelItem::getEndPosition( int * line, int * column ) const
638{
639 if( line ) *line = m_endLine;
640 if( column ) *column = m_endColumn;
641}
642
643void CodeModelItem::setEndPosition( int line, int column )
644{
645 m_endLine = line;
646 m_endColumn = column;
647}
648
649void CodeModelItem::update( const CodeModelItem* i ) {
650 m_startLine = i->m_startLine;
651 m_startColumn = i->m_startColumn;
652 m_endLine = i->m_endLine;
653 m_endColumn = i->m_endColumn;
654}
655
656bool CodeModelItem::canUpdate( const CodeModelItem* i ) const {
657 if( i->m_kind != m_kind || i->m_name != m_name )
658 return false;
659 return true;
660}
661
662
663// ------------------------------------------------------------------------
664NamespaceModel::NamespaceModel( CodeModel* model )
665 : ClassModel( model )
666{
667 setKind( Namespace );
668}
669
670NamespaceList NamespaceModel::namespaceList( )
671{
672 return m_namespaces.values();
673}
674
675const NamespaceList NamespaceModel::namespaceList( ) const
676{
677 return m_namespaces.values();
678}
679
680NamespaceDom NamespaceModel::namespaceByName( const TQString & name )
681{
682 return m_namespaces.contains( name ) ? m_namespaces[ name ] : NamespaceDom();
683}
684
685const NamespaceDom NamespaceModel::namespaceByName( const TQString & name ) const
686{
687 return m_namespaces.contains( name ) ? m_namespaces[ name ] : NamespaceDom();
688}
689
690bool NamespaceModel::hasNamespace( const TQString & name ) const
691{
692 return m_namespaces.contains( name );
693}
694
695bool NamespaceModel::addNamespace( NamespaceDom ns )
696{
697 if( ns->name().isEmpty() )
698 return false;
699
700 m_namespaces[ ns->name() ] = ns;
701 return true;
702}
703
704void NamespaceModel::removeNamespace( NamespaceDom ns )
705{
706 m_namespaces.remove( ns->name() );
707}
708
709// ------------------------------------------------------------------------
710FileModel::FileModel( CodeModel* model )
711 : NamespaceModel( model ), m_groupId( model->newGroupId() ), m_parseResult( 0 )
712{
713}
714
715// ------------------------------------------------------------------------
716ClassModel::ClassModel( CodeModel* model )
717 : CodeModelItem( Class, model)
718{
719}
720
721TQStringList ClassModel::baseClassList( ) const
722{
723 return m_baseClassList;
724}
725
726bool ClassModel::addBaseClass( const TQString & baseClass )
727{
728 m_baseClassList.push_back( baseClass );
729 return true;
730}
731
732void ClassModel::removeBaseClass( const TQString & baseClass )
733{
734 m_baseClassList.remove( baseClass );
735}
736
737ClassList ClassModel::classList( )
738{
739 ClassList l;
740 TQMap<TQString, ClassList>::Iterator it = m_classes.begin();
741 while( it != m_classes.end() ){
742 l += *it;
743 ++it;
744 }
745
746 return l;
747}
748
749const ClassList ClassModel::classList( ) const
750{
751 ClassList l;
752 TQMap<TQString, ClassList>::ConstIterator it = m_classes.begin();
753 while( it != m_classes.end() ){
754 l += *it;
755 ++it;
756 }
757
758 return l;
759}
760
761bool ClassModel::hasClass( const TQString & name ) const
762{
763 return m_classes.contains( name );
764}
765
766ClassList ClassModel::classByName( const TQString & name )
767{
768 return m_classes.contains( name ) ? m_classes[ name ] : ClassList();
769}
770
771const ClassList ClassModel::classByName( const TQString & name ) const
772{
773 return m_classes.contains( name ) ? m_classes[ name ] : ClassList();
774}
775
776bool ClassModel::addClass( ClassDom klass )
777{
778 if( klass->name().isEmpty() )
779 return false;
780
781 m_classes[ klass->name() ].push_back( klass );
782 return true;
783}
784
785void ClassModel::removeClass( ClassDom klass )
786{
787 m_classes[ klass->name() ].remove( klass );
788
789 if( m_classes[klass->name()].isEmpty() )
790 m_classes.remove( klass->name() );
791}
792
793FunctionList ClassModel::functionList( )
794{
795 FunctionList l;
796 TQMap<TQString, FunctionList>::Iterator it = m_functions.begin();
797 while( it != m_functions.end() ){
798 l += *it;
799 ++it;
800 }
801
802 return l;
803}
804
805const FunctionList ClassModel::functionList( ) const
806{
807 FunctionList l;
808 TQMap<TQString, FunctionList>::ConstIterator it = m_functions.begin();
809 while( it != m_functions.end() ){
810 l += *it;
811 ++it;
812 }
813
814 return l;
815}
816
817bool ClassModel::hasFunction( const TQString & name ) const
818{
819 return m_functions.contains( name );
820}
821
822FunctionList ClassModel::functionByName( const TQString & name )
823{
824 return m_functions.contains( name ) ? m_functions[ name ] : FunctionList();
825}
826
827const FunctionList ClassModel::functionByName( const TQString & name ) const
828{
829 return m_functions.contains( name ) ? m_functions[ name ] : FunctionList();
830}
831
832bool ClassModel::addFunction( FunctionDom fun )
833{
834 if( fun->name().isEmpty() )
835 return false;
836
837 m_functions[ fun->name() ].push_back( fun );
838 return true;
839}
840
841void ClassModel::removeFunction( FunctionDom fun )
842{
843 m_functions[ fun->name() ].remove( fun );
844
845 if( m_functions[fun->name()].isEmpty() )
846 m_functions.remove( fun->name() );
847}
848
849FunctionDefinitionList ClassModel::functionDefinitionList( )
850{
851 FunctionDefinitionList l;
852 TQMap<TQString, FunctionDefinitionList>::Iterator it = m_functionDefinitions.begin();
853 while( it != m_functionDefinitions.end() ){
854 l += *it;
855 ++it;
856 }
857
858 return l;
859}
860
861const FunctionDefinitionList ClassModel::functionDefinitionList( ) const
862{
863 FunctionDefinitionList l;
864 TQMap<TQString, FunctionDefinitionList>::ConstIterator it = m_functionDefinitions.begin();
865 while( it != m_functionDefinitions.end() ){
866 l += *it;
867 ++it;
868 }
869
870 return l;
871}
872
873bool ClassModel::hasFunctionDefinition( const TQString & name ) const
874{
875 return m_functionDefinitions.contains( name );
876}
877
878FunctionDefinitionList ClassModel::functionDefinitionByName( const TQString & name )
879{
880 return m_functionDefinitions.contains( name ) ? m_functionDefinitions[ name ] : FunctionDefinitionList();
881}
882
883const FunctionDefinitionList ClassModel::functionDefinitionByName( const TQString & name ) const
884{
885 return m_functionDefinitions.contains( name ) ? m_functionDefinitions[ name ] : FunctionDefinitionList();
886}
887
888bool ClassModel::addFunctionDefinition( FunctionDefinitionDom fun )
889{
890 if( fun->name().isEmpty() )
891 return false;
892
893 m_functionDefinitions[ fun->name() ].push_back( fun );
894 return true;
895}
896
897void ClassModel::removeFunctionDefinition( FunctionDefinitionDom fun )
898{
899 m_functionDefinitions[ fun->name() ].remove( fun );
900
901 if( m_functionDefinitions[fun->name()].isEmpty() )
902 m_functionDefinitions.remove( fun->name() );
903}
904
905VariableList ClassModel::variableList( )
906{
907 return m_variables.values();
908}
909
910const VariableList ClassModel::variableList( ) const
911{
912 return m_variables.values();
913}
914
915VariableDom ClassModel::variableByName( const TQString & name )
916{
917 return m_variables.contains( name ) ? m_variables[ name ] : VariableDom();
918}
919
920const VariableDom ClassModel::variableByName( const TQString & name ) const
921{
922 return m_variables.contains( name ) ? m_variables[ name ] : VariableDom();
923}
924
925bool ClassModel::hasVariable( const TQString & name ) const
926{
927 return m_variables.contains( name );
928}
929
930bool ClassModel::addVariable( VariableDom var )
931{
932 if( var->name().isEmpty() )
933 return false;
934
935 m_variables.insert( var->name(), var );
936 return true;
937}
938
939void ClassModel::removeVariable( VariableDom var )
940{
941 m_variables.remove( var->name() );
942}
943
944EnumList ClassModel::enumList( )
945{
946 return m_enumerators.values();
947}
948
949const EnumList ClassModel::enumList( ) const
950{
951 return m_enumerators.values();
952}
953
954EnumDom ClassModel::enumByName( const TQString & name )
955{
956 return m_enumerators.contains( name ) ? m_enumerators[ name ] : EnumDom();
957}
958
959const EnumDom ClassModel::enumByName( const TQString & name ) const
960{
961 return m_enumerators.contains( name ) ? m_enumerators[ name ] : EnumDom();
962}
963
964bool ClassModel::hasEnum( const TQString & name ) const
965{
966 return m_enumerators.contains( name );
967}
968
969bool ClassModel::addEnum( EnumDom e )
970{
971 if( e->name().isEmpty() )
972 return false;
973
974 m_enumerators.insert( e->name(), e );
975 return true;
976}
977
978void ClassModel::update( const ClassModel* klass ) {
979 CodeModelItem::update( klass );
980 eachUpdate( m_classes, klass->m_classes ) ;
981 eachUpdate( m_functions, klass->m_functions ) ;
982 eachUpdate( m_functionDefinitions, klass->m_functionDefinitions ) ;
983 eachUpdateSingle( m_variables, klass->m_variables ) ;
984 eachUpdateSingle( m_enumerators, klass->m_enumerators ) ;
985 eachUpdate( m_typeAliases, klass->m_typeAliases );
986}
987
988bool ClassModel::canUpdate( const ClassModel* klass ) const {
989 if( !CodeModelItem::canUpdate( klass ) )
990 return false;
991
992 return eachCanUpdate( m_classes, klass->m_classes ) &&
993 eachCanUpdate( m_functions, klass->m_functions ) &&
994 eachCanUpdate( m_functionDefinitions, klass->m_functionDefinitions ) &&
995 eachCanUpdateSingle( m_variables, klass->m_variables ) &&
996 eachCanUpdateSingle( m_enumerators, klass->m_enumerators ) &&
997 eachCanUpdate( m_typeAliases, klass->m_typeAliases );
998}
999
1000void ClassModel::removeEnum( EnumDom e )
1001{
1002 m_enumerators.remove( e->name() );
1003}
1004
1005TypeAliasList ClassModel::typeAliasList( )
1006{
1007 TypeAliasList l;
1008 TQMap<TQString, TypeAliasList>::Iterator it = m_typeAliases.begin();
1009 while( it != m_typeAliases.end() ){
1010 l += *it;
1011 ++it;
1012 }
1013
1014 return l;
1015}
1016
1017const TypeAliasList ClassModel::typeAliasList( ) const
1018{
1019 TypeAliasList l;
1020 TQMap<TQString, TypeAliasList>::ConstIterator it = m_typeAliases.begin();
1021 while( it != m_typeAliases.end() ){
1022 l += *it;
1023 ++it;
1024 }
1025
1026 return l;
1027}
1028
1029bool ClassModel::hasTypeAlias( const TQString & name ) const
1030{
1031 return m_typeAliases.contains( name );
1032}
1033
1034TypeAliasList ClassModel::typeAliasByName( const TQString & name )
1035{
1036 return m_typeAliases.contains( name ) ? m_typeAliases[ name ] : TypeAliasList();
1037}
1038
1039const TypeAliasList ClassModel::typeAliasByName( const TQString & name ) const
1040{
1041 return m_typeAliases.contains( name ) ? m_typeAliases[ name ] : TypeAliasList();
1042}
1043
1044bool ClassModel::addTypeAlias( TypeAliasDom typeAlias )
1045{
1046 if( typeAlias->name().isEmpty() )
1047 return false;
1048
1049 m_typeAliases[ typeAlias->name() ].push_back( typeAlias );
1050 return true;
1051}
1052
1053void ClassModel::removeTypeAlias( TypeAliasDom typeAlias )
1054{
1055 m_typeAliases[ typeAlias->name() ].remove( typeAlias );
1056
1057 if( m_typeAliases[typeAlias->name()].isEmpty() )
1058 m_typeAliases.remove( typeAlias->name() );
1059}
1060
1061
1062
1063// ------------------------------------------------------------------------
1064ArgumentModel::ArgumentModel( CodeModel* model )
1065 : CodeModelItem( Argument, model)
1066{
1067}
1068
1069TQString ArgumentModel::type( ) const
1070{
1071 return m_type;
1072}
1073
1074void ArgumentModel::setType( const TQString& type )
1075{
1076 m_type = type;
1077}
1078
1079TQString ArgumentModel::defaultValue( ) const
1080{
1081 return m_defaultValue;
1082}
1083
1084void ArgumentModel::setDefaultValue( const TQString & defaultValue )
1085{
1086 m_defaultValue = defaultValue;
1087}
1088
1089// ------------------------------------------------------------------------
1090FunctionModel::FunctionModel( CodeModel* model )
1091 : CodeModelItem( Function, model)
1092{
1093 m_access = Public;
1094 d.v.m_signal = false;
1095 d.v.m_slot = false;
1096 d.v.m_virtual = false;
1097 d.v.m_static = false;
1098 d.v.m_inline = false;
1099 d.v.m_constant = false;
1100 d.v.m_abstract = false;
1101}
1102
1103bool FunctionModel::isVirtual( ) const
1104{
1105 return d.v.m_virtual;
1106}
1107
1108void FunctionModel::setVirtual( bool isVirtual )
1109{
1110 d.v.m_virtual = isVirtual;
1111}
1112
1113bool FunctionModel::isStatic( ) const
1114{
1115 return d.v.m_static;
1116}
1117
1118void FunctionModel::setStatic( bool isStatic )
1119{
1120 d.v.m_static = isStatic;
1121}
1122
1123bool FunctionModel::isInline( ) const
1124{
1125 return d.v.m_inline;
1126}
1127
1128void FunctionModel::setInline( bool isInline )
1129{
1130 d.v.m_inline = isInline;
1131}
1132
1133bool FunctionModel::isConstant( ) const
1134{
1135 return d.v.m_constant;
1136}
1137
1138void FunctionModel::setConstant( bool isConstant )
1139{
1140 d.v.m_constant = isConstant;
1141}
1142
1143bool FunctionModel::isAbstract( ) const
1144{
1145 return d.v.m_abstract;
1146}
1147
1148void FunctionModel::setAbstract( bool isAbstract )
1149{
1150 d.v.m_abstract = isAbstract;
1151}
1152
1153TQString FunctionModel::resultType( ) const
1154{
1155 return m_resultType;
1156}
1157
1158void FunctionModel::setResultType( const TQString& type )
1159{
1160 m_resultType = type;
1161}
1162
1163ArgumentList FunctionModel::argumentList( )
1164{
1165 return m_arguments;
1166}
1167
1168const ArgumentList FunctionModel::argumentList( ) const
1169{
1170 return m_arguments;
1171}
1172
1173bool FunctionModel::addArgument( ArgumentDom arg )
1174{
1175 m_arguments.push_back( arg );
1176 return true;
1177}
1178
1179void FunctionModel::removeArgument( ArgumentDom arg )
1180{
1181 m_arguments.remove( arg );
1182}
1183
1184void FunctionModel::update( const FunctionModel* i ) {
1185 m_access = i->m_access;
1186 CodeModelItem::update( i );
1187}
1188
1189bool FunctionModel::canUpdate( const FunctionModel* i ) const {
1190 if( !CodeModelItem::canUpdate( i ) )
1191 return false;
1192 if( m_resultType != i->m_resultType || m_arguments.count() != i->m_arguments.count() || m_scope != i->m_scope )
1193 return false;
1194 return true;
1195}
1196
1197
1198// ------------------------------------------------------------------------
1199VariableModel::VariableModel( CodeModel* model )
1200 : CodeModelItem( Variable, model)
1201{
1202 m_access = Public;
1203 m_static = false;
1204 m_isEnumeratorVariable = false;
1205}
1206
1207bool VariableModel::isStatic( ) const
1208{
1209 return m_static;
1210}
1211
1212void VariableModel::setStatic( bool isStatic )
1213{
1214 m_static = isStatic;
1215}
1216
1217TQString VariableModel::type( ) const
1218{
1219 return m_type;
1220}
1221
1222void VariableModel::setType( const TQString& type )
1223{
1224 m_type = type;
1225}
1226
1227bool VariableModel::isEnumeratorVariable() const {
1228 return m_isEnumeratorVariable;
1229}
1230
1231void VariableModel::setEnumeratorVariable( bool b) {
1232 m_isEnumeratorVariable = b;
1233}
1234
1235int FunctionModel::access( ) const
1236{
1237 return m_access;
1238}
1239
1240void FunctionModel::setAccess( int access )
1241{
1242 m_access = access;
1243}
1244
1245bool FunctionModel::isSignal( ) const
1246{
1247 return d.v.m_signal;
1248}
1249
1250void FunctionModel::setSignal( bool isSignal )
1251{
1252 d.v.m_signal = isSignal;
1253}
1254
1255bool FunctionModel::isSlot( ) const
1256{
1257 return d.v.m_slot;
1258}
1259
1260void FunctionModel::setSlot( bool isSlot )
1261{
1262 d.v.m_slot = isSlot;
1263}
1264
1265FunctionDefinitionModel::FunctionDefinitionModel( CodeModel* model )
1266 : FunctionModel( model )
1267{
1268}
1269
1270int VariableModel::access( ) const
1271{
1272 return m_access;
1273}
1274
1275void VariableModel::setAccess( int access )
1276{
1277 m_access = access;
1278}
1279
1280const NamespaceDom CodeModel::globalNamespace( ) const
1281{
1282 return m_globalNamespace;
1283}
1284
1285void CodeModelItem::read( TQDataStream & stream )
1286{
1287 stream
1288 >> m_kind
1289 >> m_name
1290 >> m_fileName
1291 >> m_startLine
1292 >> m_startColumn
1293 >> m_endLine
1294 >> m_endColumn
1295 >> m_comment;
1296
1297 if( isTemplateable() ) {
1298 TemplateModelItem* t = (TemplateModelItem*)( this );
1299
1300 t->read( stream );
1301 }
1302}
1303
1304void CodeModelItem::write( TQDataStream & stream ) const
1305{
1306 stream
1307 << m_kind
1308 << m_name
1309 << m_fileName
1310 << m_startLine
1311 << m_startColumn
1312 << m_endLine
1313 << m_endColumn
1314 << m_comment;
1315
1316 if( isTemplateable() ) {
1317 TemplateModelItem* t = (TemplateModelItem*)( this );
1318 t-> write( stream );
1319 }
1320}
1321
1322void ClassModel::read( TQDataStream & stream )
1323{
1324 CodeModelItem::read( stream );
1325
1326 TemplateModelItem::read( stream );
1327
1328 stream >> m_scope >> m_baseClassList;
1329
1330 int n;
1331
1332 m_classes.clear();
1333 stream >> n;
1334 for( int i=0; i<n; ++i ){
1335 ClassDom klass = codeModel()->create<ClassModel>();
1336 klass->read( stream );
1337 addClass( klass );
1338 }
1339
1340 m_functions.clear();
1341 stream >> n;
1342 for( int i=0; i<n; ++i ){
1343 FunctionDom fun = codeModel()->create<FunctionModel>();
1344 fun->read( stream );
1345 addFunction( fun );
1346 }
1347
1348 m_functionDefinitions.clear();
1349 stream >> n;
1350 for( int i=0; i<n; ++i ){
1351 FunctionDefinitionDom fun = codeModel()->create<FunctionDefinitionModel>();
1352 fun->read( stream );
1353 addFunctionDefinition( fun );
1354 }
1355
1356 m_variables.clear();
1357 stream >> n;
1358 for( int i=0; i<n; ++i ){
1359 VariableDom var = codeModel()->create<VariableModel>();
1360 var->read( stream );
1361 addVariable( var );
1362 }
1363
1364 m_enumerators.clear();
1365 stream >> n;
1366 for( int i=0; i<n; ++i ){
1367 EnumDom e = codeModel()->create<EnumModel>();
1368 e->read( stream );
1369 addEnum( e );
1370 }
1371
1372 m_typeAliases.clear();
1373 stream >> n;
1374 for( int i=0; i<n; ++i ){
1375 TypeAliasDom typeAlias = codeModel()->create<TypeAliasModel>();
1376 typeAlias->read( stream );
1377 addTypeAlias( typeAlias );
1378 }
1379}
1380
1381void ClassModel::write( TQDataStream & stream ) const
1382{
1383 CodeModelItem::write( stream );
1384
1385 TemplateModelItem::write( stream );
1386
1387 stream << m_scope << m_baseClassList;
1388
1389 const ClassList class_list = classList();
1390 stream << int( class_list.size() );
1391 for( ClassList::ConstIterator it = class_list.begin(); it!=class_list.end(); ++it )
1392 (*it)->write( stream );
1393
1394 const FunctionList function_list = functionList();
1395 stream << int( function_list.size() );
1396 for( FunctionList::ConstIterator it = function_list.begin(); it!=function_list.end(); ++it )
1397 (*it)->write( stream );
1398
1399 const FunctionDefinitionList function_definition_list = functionDefinitionList();
1400 stream << int( function_definition_list.size() );
1401 for( FunctionDefinitionList::ConstIterator it = function_definition_list.begin(); it!=function_definition_list.end(); ++it )
1402 (*it)->write( stream );
1403
1404 const VariableList variable_list = variableList();
1405 stream << int( variable_list.size() );
1406 for( VariableList::ConstIterator it = variable_list.begin(); it!=variable_list.end(); ++it )
1407 (*it)->write( stream );
1408
1409 const EnumList enum_list = enumList();
1410 stream << int( enum_list.size() );
1411 for( EnumList::ConstIterator it = enum_list.begin(); it!=enum_list.end(); ++it )
1412 (*it)->write( stream );
1413
1414 const TypeAliasList type_alias_list = typeAliasList();
1415 stream << int( type_alias_list.size() );
1416 for( TypeAliasList::ConstIterator it = type_alias_list.begin(); it!=type_alias_list.end(); ++it )
1417 (*it)->write( stream );
1418
1419}
1420
1421void NamespaceModel::read( TQDataStream & stream )
1422{
1423 ClassModel::read( stream );
1424
1425 int n;
1426
1427 m_namespaces.clear(); m_namespaceAliases.clear(); m_namespaceImports.clear();
1428 stream >> n;
1429 for( int i=0; i<n; ++i ){
1430 NamespaceDom ns = codeModel()->create<NamespaceModel>();
1431 ns->read( stream );
1432 addNamespace( ns );
1433 }
1434
1435 stream >> n;
1436 for( int a = 0; a < n; a++ ) {
1437 NamespaceAliasModel m;
1438 m.read( stream );
1439 m_namespaceAliases.insert( m );
1440 }
1441 stream >> n;
1442 for( int a = 0; a < n; a++ ) {
1443 NamespaceImportModel m;
1444 m.read( stream );
1445 m_namespaceImports.insert( m );
1446 }
1447}
1448
1449void NamespaceModel::addNamespaceImport( const NamespaceImportModel& import ) {
1450 m_namespaceImports.insert( import );
1451}
1452
1453void NamespaceModel::addNamespaceAlias( const NamespaceAliasModel& alias ) {
1454 m_namespaceAliases.insert( alias );
1455}
1456
1457void NamespaceModel::removeNamespaceImport( const NamespaceImportModel& import ) {
1458 m_namespaceImports.erase( import );
1459}
1460
1461void NamespaceModel::removeNamespaceAlias( const NamespaceAliasModel& alias ) {
1462 m_namespaceAliases.erase( alias );
1463}
1464
1465void NamespaceModel::write( TQDataStream & stream ) const
1466{
1467 ClassModel::write( stream );
1468
1469 const NamespaceList namespace_list = namespaceList();
1470 stream << int( namespace_list.size() );
1471 for( NamespaceList::ConstIterator it = namespace_list.begin(); it!=namespace_list.end(); ++it )
1472 (*it)->write( stream );
1473
1474 stream << int( m_namespaceAliases.size() );
1475 for( NamespaceAliasModelList::const_iterator it = m_namespaceAliases.begin(); it != m_namespaceAliases.end(); ++it )
1476 (*it).write( stream );
1477 stream << int( m_namespaceImports.size() );
1478 for( NamespaceImportModelList::const_iterator it = m_namespaceImports.begin(); it != m_namespaceImports.end(); ++it )
1479 (*it).write( stream );
1480}
1481
1482bool NamespaceModel::canUpdate( const NamespaceModel* ns ) const {
1483 if( !ClassModel::canUpdate( ns ) )
1484 return false;
1485
1486 const NamespaceAliasModelList& aliases = namespaceAliases();
1487 const NamespaceImportModelList& imports = namespaceImports();
1488 const NamespaceAliasModelList& aliases2 = ns->namespaceAliases();
1489 const NamespaceImportModelList& imports2 = ns->namespaceImports();
1490
1491 if( aliases.size() != aliases2.size() ) return false;
1492 if( imports.size() != imports2.size() ) return false;
1493
1495 NamespaceModel::NamespaceAliasModelList::const_iterator it_al1 = aliases.begin();
1496 NamespaceModel::NamespaceAliasModelList::const_iterator it_al2 = aliases2.begin();
1497 while( it_al1 != aliases.end() ) {
1498 if( !(*it_al1 == *it_al2) )
1499 return false;
1500
1501 ++it_al1;
1502 ++it_al2;
1503 }
1504
1506 NamespaceModel::NamespaceImportModelList::const_iterator it_ip1 = imports.begin();
1507 NamespaceModel::NamespaceImportModelList::const_iterator it_ip2 = imports2.begin();
1508 while( it_ip1 != imports.end() ) {
1509 if( !(*it_ip1 == *it_ip2) )
1510 return false;
1511
1512 ++it_ip1;
1513 ++it_ip2;
1514 }
1515
1516 return eachCanUpdateSingle( m_namespaces, ns->m_namespaces );
1517}
1518
1519void NamespaceModel::update( const NamespaceModel* ns )
1520{
1521 ClassModel::update( ns );
1522
1523 eachUpdateSingle( m_namespaces, ns->m_namespaces );
1524}
1525
1526void FileModel::read( TQDataStream & stream )
1527{
1528 stream >> m_groupId;
1529 bool b;
1530 stream >> b;
1531 if( b ) {
1532 int i;
1533 stream >> i;
1534 ParsedFileType t( (ParsedFileType) i );
1535 switch( t ) {
1536 case CppParsedFile:
1537 m_parseResult = (AbstractParseResult*)(new ParsedFile( stream ));
1538 break;
1539 }
1540 }
1541
1542 NamespaceModel::read( stream );
1543}
1544
1545void FileModel::write( TQDataStream & stream ) const
1546{
1547 stream << m_groupId;
1548 bool b = m_parseResult;
1549 stream << b;
1550 if( b ) {
1551 int i = m_parseResult->type();
1552 stream << i;
1553 m_parseResult->write( stream );
1554 }
1555
1556 NamespaceModel::write( stream );
1557}
1558
1559void ArgumentModel::read( TQDataStream & stream )
1560{
1561 CodeModelItem::read( stream );
1562
1563
1564 stream >> m_type >> m_defaultValue;
1565}
1566
1567void ArgumentModel::write( TQDataStream & stream ) const
1568{
1569 CodeModelItem::write( stream );
1570
1571 stream << m_type << m_defaultValue;
1572}
1573
1574void FunctionModel::read( TQDataStream & stream )
1575{
1576 CodeModelItem::read( stream );
1577 TemplateModelItem::read( stream );
1578
1579 stream >> m_scope;
1580 stream >> d.flags;
1581
1582 int n;
1583
1584 m_arguments.clear();
1585 stream >> n;
1586 for( int i=0; i<n; ++i ){
1587 ArgumentDom arg = codeModel()->create<ArgumentModel>();
1588 arg->read( stream );
1589 addArgument( arg );
1590 }
1591
1592 stream
1593 >> m_resultType;
1594}
1595
1596void FunctionModel::write( TQDataStream & stream ) const
1597{
1598 CodeModelItem::write( stream );
1599 TemplateModelItem::write( stream );
1600
1601 stream << m_scope;
1602 stream << d.flags;
1603
1604 const ArgumentList argument_list = argumentList();
1605 stream << int( argument_list.size() );
1606 for( ArgumentList::ConstIterator it = argument_list.begin(); it!=argument_list.end(); ++it )
1607 (*it)->write( stream );
1608
1609 stream
1610 << m_resultType;
1611}
1612
1613void CodeModel::read( TQDataStream & stream )
1614{
1615 int n;
1616
1617 m_files.clear();
1618
1619 stream >> n;
1620 for( int i=0; i<n; ++i ){
1621 FileDom file = this->create<FileModel>();
1622 file->read( stream );
1623 addFile( file );
1624 }
1625}
1626
1627void CodeModel::write( TQDataStream & stream ) const
1628{
1629 const FileList file_list = fileList();
1630 stream << int( file_list.size() );
1631 for( FileList::ConstIterator it = file_list.begin(); it!=file_list.end(); ++it )
1632 (*it)->write( stream );
1633}
1634
1635void VariableModel::read( TQDataStream & stream )
1636{
1637 CodeModelItem::read( stream );
1638 stream >> m_access >> m_static >> m_type >> m_isEnumeratorVariable;
1639}
1640
1641void VariableModel::write( TQDataStream & stream ) const
1642{
1643 CodeModelItem::write( stream );
1644 stream << m_access << m_static << m_type << m_isEnumeratorVariable;
1645}
1646
1647void VariableModel::update( const VariableModel* i ) {
1648 m_access = i->m_access;
1649 CodeModelItem::update( i );
1650}
1651
1652bool VariableModel::canUpdate( const VariableModel* i ) const {
1653 if( !CodeModelItem::canUpdate( i ) )
1654 return false;
1655 if( m_access != i->m_access || m_static != i->m_static || m_type != i->m_type || m_isEnumeratorVariable != i->m_isEnumeratorVariable )
1656 return false;
1657 return true;
1658}
1659
1660// -------------------------------------------------------
1661EnumModel::EnumModel( CodeModel * model )
1662 : CodeModelItem( Enum, model)
1663{
1664}
1665
1666int EnumModel::access( ) const
1667{
1668 return m_access;
1669}
1670
1671void EnumModel::setAccess( int access )
1672{
1673 m_access = access;
1674}
1675
1676EnumeratorList EnumModel::enumeratorList( )
1677{
1678 return m_enumerators.values();
1679}
1680
1681const EnumeratorList EnumModel::enumeratorList( ) const
1682{
1683 return m_enumerators.values();
1684}
1685
1686void EnumModel::addEnumerator( EnumeratorDom enumerator )
1687{
1688 m_enumerators.insert( enumerator->name(), enumerator );
1689}
1690
1691void EnumModel::read( TQDataStream & stream )
1692{
1693 CodeModelItem::read( stream );
1694 stream >> m_access;
1695
1696 int n;
1697 stream >> n;
1698 for( int i=0; i<n; ++i ){
1699 EnumeratorDom e = codeModel()->create<EnumeratorModel>();
1700 e->read( stream );
1701 addEnumerator( e );
1702 }
1703}
1704
1705void EnumModel::write( TQDataStream & stream ) const
1706{
1707 CodeModelItem::write( stream );
1708
1709 stream << m_access;
1710 const EnumeratorList enumerator_list = enumeratorList();
1711 stream << int( enumerator_list.size() );
1712 for( EnumeratorList::ConstIterator it = enumerator_list.begin(); it!=enumerator_list.end(); ++it )
1713 (*it)->write( stream );
1714}
1715
1716EnumeratorModel::EnumeratorModel( CodeModel * model )
1717 : CodeModelItem( Enumerator, model )
1718{
1719}
1720
1721TQString EnumeratorModel::value( ) const
1722{
1723 return m_value;
1724}
1725
1726void EnumeratorModel::setValue( const TQString & value )
1727{
1728 m_value = value;
1729}
1730
1731void EnumeratorModel::read( TQDataStream & stream )
1732{
1733 CodeModelItem::read( stream );
1734 stream >> m_value;
1735}
1736
1737void EnumeratorModel::write( TQDataStream & stream ) const
1738{
1739 CodeModelItem::write( stream );
1740 stream << m_value;
1741}
1742
1743void EnumModel::removeEnumerator( EnumeratorDom e )
1744{
1745 m_enumerators.remove( e->name() );
1746}
1747
1748void EnumModel::update( const EnumModel* i ) {
1749 m_access = i->m_access;
1750 CodeModelItem::update( i );
1751}
1752
1753bool EnumModel::canUpdate( const EnumModel* i ) const {
1754 if( !CodeModelItem::canUpdate( i ) )
1755 return false;
1757 if( m_access != i->m_access || m_enumerators.count() != i->m_enumerators.count() )
1758 return false;
1759 return true;
1760}
1761
1762// ---------------------------------------------------------------
1763TypeAliasModel::TypeAliasModel( CodeModel * model )
1764 : CodeModelItem( TypeAlias, model )
1765{
1766}
1767
1768void TypeAliasModel::read( TQDataStream & stream )
1769{
1770 CodeModelItem::read( stream );
1771
1772 stream >> m_type;
1773}
1774
1775void TypeAliasModel::write( TQDataStream & stream ) const
1776{
1777 CodeModelItem::write( stream );
1778
1779 stream << m_type;
1780}
1781
1782TQString TypeAliasModel::type( ) const
1783{
1784 return m_type;
1785}
1786
1787void TypeAliasModel::setType( const TQString & type )
1788{
1789 m_type = type;
1790}
1791
1792void TypeAliasModel::update( const TypeAliasModel* i ) {
1793 CodeModelItem::update( i );
1794}
1795
1796bool TypeAliasModel::canUpdate( const TypeAliasModel* i ) const {
1797 if( !CodeModelItem::canUpdate( i ) )
1798 return false;
1799 return m_type == i->m_type;
1800}
1801
1802void FileModel::update( const FileModel* file ) {
1803 m_parseResult = file->m_parseResult;
1804 NamespaceModel::update( file );
1805}
1806
1807FileList FileModel::wholeGroup() {
1808 if( isSingleGroup( m_groupId ) ) return ( FileList() << FileDom(this) );
1809 return codeModel()->getGroup( m_groupId );
1810}
1811
1812TQStringList FileModel::wholeGroupStrings() const {
1813 if( isSingleGroup( m_groupId ) ) return (TQStringList() << name() );
1814 return codeModel()->getGroupStrings( m_groupId );
1815}
1816
1817ParseResultPointer FileModel::parseResult() const {
1818 return m_parseResult;
1819}
1820
1821void FileModel::setParseResult( const ParseResultPointer& result ) {
1822 m_parseResult = result;
1823}
ArgumentDom
Safe pointer to the ArgumentModel.
ArgumentModel
Function (procedure) argument model.
Definition codemodel.h:1192
ArgumentModel::read
virtual void read(TQDataStream &stream)
Reads an item from the stream.
Definition codemodel.cpp:1559
ArgumentModel::write
virtual void write(TQDataStream &stream) const
Writes an item to the stream.
Definition codemodel.cpp:1567
ArgumentModel::defaultValue
TQString defaultValue() const
Definition codemodel.cpp:1079
ArgumentModel::dump
virtual void dump(std::ostream &file, bool recurse=false, TQString Info="")
Definition codemodel.cpp:248
ArgumentModel::setType
void setType(const TQString &type)
Sets the type of this argument.
Definition codemodel.cpp:1074
ArgumentModel::setDefaultValue
void setDefaultValue(const TQString &defaultValue)
Sets the default value of this argument.
Definition codemodel.cpp:1084
ArgumentModel::type
TQString type() const
Definition codemodel.cpp:1069
ClassList
The list of code model classes.
ClassModel
Class model.
Definition codemodel.h:697
ClassModel::hasFunctionDefinition
bool hasFunctionDefinition(const TQString &name) const
Checks if the function definition specified by name is in the model.
Definition codemodel.cpp:873
ClassModel::addTypeAlias
bool addTypeAlias(TypeAliasDom typeAlias)
Adds a type alias to the model.
Definition codemodel.cpp:1044
ClassModel::removeFunctionDefinition
void removeFunctionDefinition(FunctionDefinitionDom fun)
Removes a function definition from the model.
Definition codemodel.cpp:897
ClassModel::addEnum
bool addEnum(EnumDom e)
Adds an enum to the model.
Definition codemodel.cpp:969
ClassModel::read
virtual void read(TQDataStream &stream)
Reads an item from the stream.
Definition codemodel.cpp:1322
ClassModel::addFunction
bool addFunction(FunctionDom fun)
Adds a function to the class model.
Definition codemodel.cpp:832
ClassModel::addClass
bool addClass(ClassDom klass)
Adds a class to the model.
Definition codemodel.cpp:776
ClassModel::functionList
FunctionList functionList()
Definition codemodel.cpp:793
ClassModel::removeBaseClass
void removeBaseClass(const TQString &baseClass)
Removes a base class from the list of base classes.
Definition codemodel.cpp:732
ClassModel::write
virtual void write(TQDataStream &stream) const
Writes an item to the stream.
Definition codemodel.cpp:1381
ClassModel::baseClassList
TQStringList baseClassList() const
Definition codemodel.cpp:721
ClassModel::addBaseClass
bool addBaseClass(const TQString &baseClass)
Adds a base class to the list of base classes.
Definition codemodel.cpp:726
ClassModel::hasVariable
bool hasVariable(const TQString &name) const
Checks if the variable specified by name is in the model.
Definition codemodel.cpp:925
ClassModel::enumList
EnumList enumList()
Definition codemodel.cpp:944
ClassModel::removeClass
void removeClass(ClassDom klass)
Removes a class from the model.
Definition codemodel.cpp:785
ClassModel::functionByName
FunctionList functionByName(const TQString &name)
Definition codemodel.cpp:822
ClassModel::hasTypeAlias
bool hasTypeAlias(const TQString &name) const
Checks if the type alias specified by name is in the model.
Definition codemodel.cpp:1029
ClassModel::classByName
ClassList classByName(const TQString &name)
Definition codemodel.cpp:766
ClassModel::addVariable
bool addVariable(VariableDom var)
Adds a variable to the model.
Definition codemodel.cpp:930
ClassModel::hasClass
bool hasClass(const TQString &name) const
Checks if the class specified by name is in this model.
Definition codemodel.cpp:761
ClassModel::enumByName
EnumDom enumByName(const TQString &name)
Gets the enum specified by name.
Definition codemodel.cpp:954
ClassModel::removeEnum
void removeEnum(EnumDom e)
Removes an enum from the model.
Definition codemodel.cpp:1000
ClassModel::typeAliasList
TypeAliasList typeAliasList()
Definition codemodel.cpp:1005
ClassModel::addFunctionDefinition
bool addFunctionDefinition(FunctionDefinitionDom fun)
Adds a function definition to the model.
Definition codemodel.cpp:888
ClassModel::hasEnum
bool hasEnum(const TQString &name) const
Checks if the enum specified by name is in the model.
Definition codemodel.cpp:964
ClassModel::hasFunction
bool hasFunction(const TQString &name) const
Check if the function specified by name is in the model.
Definition codemodel.cpp:817
ClassModel::removeVariable
void removeVariable(VariableDom var)
Removes a variable from the model.
Definition codemodel.cpp:939
ClassModel::functionDefinitionByName
FunctionDefinitionList functionDefinitionByName(const TQString &name)
Gets the list of functions that match the name given by name.
Definition codemodel.cpp:878
ClassModel::variableList
VariableList variableList()
Definition codemodel.cpp:905
ClassModel::ClassModel
ClassModel(CodeModel *model)
Constructor.
Definition codemodel.cpp:716
ClassModel::removeFunction
void removeFunction(FunctionDom fun)
Removes a function from the class model.
Definition codemodel.cpp:841
ClassModel::classList
ClassList classList()
Definition codemodel.cpp:737
ClassModel::typeAliasByName
TypeAliasList typeAliasByName(const TQString &name)
Gets the list of type aliases that match name.
Definition codemodel.cpp:1034
ClassModel::variableByName
VariableDom variableByName(const TQString &name)
Gets the variable specified by name.
Definition codemodel.cpp:915
ClassModel::removeTypeAlias
void removeTypeAlias(TypeAliasDom typeAlias)
Removes a type alias from the model.
Definition codemodel.cpp:1053
ClassModel::functionDefinitionList
FunctionDefinitionList functionDefinitionList()
Definition codemodel.cpp:849
CodeModelItem
Item in code model (symbol store).
Definition codemodel.h:462
CodeModelItem::dump
virtual void dump(std::ostream &file, bool recurse=false, TQString Info="")
Definition codemodel.cpp:165
CodeModelItem::write
virtual void write(TQDataStream &stream) const
Writes an item to the stream.
Definition codemodel.cpp:1304
CodeModelItem::CodeModelItem
CodeModelItem(int kind, CodeModel *model)
Constructor.
Definition codemodel.cpp:581
CodeModelItem::fileName
TQString fileName() const
Definition codemodel.cpp:615
CodeModelItem::isNamespace
virtual bool isNamespace() const
Definition codemodel.h:566
CodeModelItem::getEndPosition
void getEndPosition(int *line, int *col) const
Get the end position of the item.
Definition codemodel.cpp:637
CodeModelItem::isCustom
virtual bool isCustom() const
Definition codemodel.h:584
CodeModelItem::getStartPosition
void getStartPosition(int *line, int *col) const
Gets the start position of the item.
Definition codemodel.cpp:625
CodeModelItem::isClass
virtual bool isClass() const
Definition codemodel.h:568
CodeModelItem::isEnumerator
virtual bool isEnumerator() const
Definition codemodel.h:580
CodeModelItem::name
TQString name() const
Definition codemodel.cpp:595
CodeModelItem::isVariable
virtual bool isVariable() const
Definition codemodel.h:574
CodeModelItem::file
FileDom file()
Gets the file of the item.
Definition codemodel.cpp:610
CodeModelItem::isFile
virtual bool isFile() const
Definition codemodel.h:564
CodeModelItem::codeModel
CodeModel * codeModel()
Definition codemodel.h:598
CodeModelItem::isEnum
virtual bool isEnum() const
Definition codemodel.h:578
CodeModelItem::isTypeAlias
virtual bool isTypeAlias() const
Definition codemodel.h:582
CodeModelItem::read
virtual void read(TQDataStream &stream)
Reads an item from the stream.
Definition codemodel.cpp:1285
CodeModelItem::setStartPosition
void setStartPosition(int line, int col)
Sets the start position of the item.
Definition codemodel.cpp:631
CodeModelItem::Public
@ Public
Public.
Definition codemodel.h:488
CodeModelItem::setName
void setName(const TQString &name)
Sets the name of the item.
Definition codemodel.cpp:600
CodeModelItem::Namespace
@ Namespace
Namespace.
Definition codemodel.h:471
CodeModelItem::setFileName
void setFileName(const TQString &fileName)
Sets the filename of the item.
Definition codemodel.cpp:620
CodeModelItem::isFunction
virtual bool isFunction() const
Definition codemodel.h:570
CodeModelItem::setEndPosition
void setEndPosition(int line, int col)
Set the end position of the item.
Definition codemodel.cpp:643
CodeModelItem::isFunctionDefinition
virtual bool isFunctionDefinition() const
Definition codemodel.h:572
CodeModelItem::isArgument
virtual bool isArgument() const
Definition codemodel.h:576
CodeModelItem::setKind
void setKind(int kind)
Sets the type (kind) of item.
Definition codemodel.h:510
CodeModel
Code Model - a memory symbol store.
Definition codemodel.h:325
CodeModel::removeFile
void removeFile(FileDom file)
Removes a file from the store.
Definition codemodel.cpp:545
CodeModel::dump
virtual void dump(std::ostream &file, TQString Info="")
this will dump the whole tree into dot-file-format so it can be inspected, not ready yet
Definition codemodel.cpp:309
CodeModel::fileByName
FileDom fileByName(const TQString &name)
Gets the FileDom object for a file.
Definition codemodel.cpp:386
CodeModel::addFile
bool addFile(FileDom file)
Adds a file to the store.
Definition codemodel.cpp:500
CodeModel::write
virtual void write(TQDataStream &stream) const
Writes the model to a stream.
Definition codemodel.cpp:1627
CodeModel::wipeout
void wipeout()
Resets the CodeModel.
Definition codemodel.cpp:362
CodeModel::read
virtual void read(TQDataStream &stream)
Reads the model from a stream.
Definition codemodel.cpp:1613
CodeModel::create
T::Ptr create()
Creates a code model item.
Definition codemodel.h:343
CodeModel::mergeGroups
int mergeGroups(int g1, int g2)
Merges two groups, by changing the group-ids of the files.
Definition codemodel.cpp:135
CodeModel::fileList
FileList fileList()
Gets the list of files in the store.
Definition codemodel.cpp:371
CodeModel::CodeModel
CodeModel()
Constructor.
Definition codemodel.cpp:96
CodeModel::globalNamespace
const NamespaceDom globalNamespace() const
Gets the global namespace.
Definition codemodel.cpp:1280
CodeModel::hasFile
bool hasFile(const TQString &name) const
Checks to see if a file is in the store.
Definition codemodel.cpp:381
CodeModel::getGroup
FileList getGroup(int gid) const
Returns all files within the given group it should be preferred calling FileModel::wholeGroup and Fil...
Definition codemodel.cpp:123
CodeModel::getGroupStrings
virtual TQStringList getGroupStrings(int gid) const
Same as above, but returns the names instead of the objects.
Definition codemodel.cpp:114
EnumDom
Safe pointer to the EnumModel.
EnumList
The list of code model enums.
EnumModel
Enum model.
Definition codemodel.h:1475
EnumModel::setAccess
void setAccess(int access)
Sets the access level of the enum.
Definition codemodel.cpp:1671
EnumModel::addEnumerator
void addEnumerator(EnumeratorDom e)
Adds an enumerator to the model.
Definition codemodel.cpp:1686
EnumModel::write
virtual void write(TQDataStream &stream) const
Writes an item to the stream.
Definition codemodel.cpp:1705
EnumModel::removeEnumerator
void removeEnumerator(EnumeratorDom e)
Removes an enumerator from the model.
Definition codemodel.cpp:1743
EnumModel::canUpdate
bool canUpdate(const EnumModel *i) const
Definition codemodel.cpp:1753
EnumModel::access
int access() const
Definition codemodel.cpp:1666
EnumModel::dump
virtual void dump(std::ostream &file, bool recurse=false, TQString Info="")
The dump-function is not ready yet.
Definition codemodel.cpp:322
EnumModel::enumeratorList
EnumeratorList enumeratorList()
Definition codemodel.cpp:1676
EnumModel::EnumModel
EnumModel(CodeModel *model)
Constructor.
Definition codemodel.cpp:1661
EnumModel::read
virtual void read(TQDataStream &stream)
Reads an item from the stream.
Definition codemodel.cpp:1691
EnumeratorDom
Safe pointer to the EnumeratorModel.
EnumeratorList
The list of code model enumerators.
EnumeratorModel
Enumerator model.
Definition codemodel.h:1538
EnumeratorModel::setValue
void setValue(const TQString &value)
Sets the value of an enumerator.
Definition codemodel.cpp:1726
EnumeratorModel::EnumeratorModel
EnumeratorModel(CodeModel *model)
Constructor.
Definition codemodel.cpp:1716
EnumeratorModel::value
TQString value() const
Definition codemodel.cpp:1721
EnumeratorModel::dump
virtual void dump(std::ostream &file, bool recurse=false, TQString Info="")
Definition codemodel.cpp:337
EnumeratorModel::write
virtual void write(TQDataStream &stream) const
Writes an item to the stream.
Definition codemodel.cpp:1737
EnumeratorModel::read
virtual void read(TQDataStream &stream)
Reads an item from the stream.
Definition codemodel.cpp:1731
FileDom
Safe pointer to the FileModel.
FileList
The list of code model files.
FileModel
File model.
Definition codemodel.h:1139
FileModel::read
virtual void read(TQDataStream &stream)
Reads an item from the stream.
Definition codemodel.cpp:1526
FileModel::write
virtual void write(TQDataStream &stream) const
This function additionally does version-checking and should be used instead of read when read should ...
Definition codemodel.cpp:1545
FileModel::FileModel
FileModel(CodeModel *model)
Constructor.
Definition codemodel.cpp:710
FunctionDefinitionDom
Safe pointer to the FunctionDefinitionModel.
FunctionDefinitionList
The list of code model function definitions.
FunctionDefinitionModel
Function model.
Definition codemodel.h:1384
FunctionDefinitionModel::FunctionDefinitionModel
FunctionDefinitionModel(CodeModel *model)
Constructor.
Definition codemodel.cpp:1265
FunctionDom
Safe pointer to the FunctionModel.
FunctionList
The list of code model functions.
FunctionModel
Function model.
Definition codemodel.h:1246
FunctionModel::resultType
TQString resultType() const
Definition codemodel.cpp:1153
FunctionModel::access
int access() const
Definition codemodel.cpp:1235
FunctionModel::isFunction
virtual bool isFunction() const
Definition codemodel.h:1256
FunctionModel::removeArgument
void removeArgument(ArgumentDom arg)
Removes an argument from the function.
Definition codemodel.cpp:1179
FunctionModel::argumentList
ArgumentList argumentList()
Gets the list of arguments being passed to the function.
Definition codemodel.cpp:1163
FunctionModel::setSignal
void setSignal(bool isSignal)
Sets the function to be a signal.
Definition codemodel.cpp:1250
FunctionModel::setVirtual
void setVirtual(bool isVirtual)
Sets the function to be a virtual function.
Definition codemodel.cpp:1108
FunctionModel::setSlot
void setSlot(bool isSlot)
Sets the function to be a slot.
Definition codemodel.cpp:1260
FunctionModel::read
virtual void read(TQDataStream &stream)
Reads an item from the stream.
Definition codemodel.cpp:1574
FunctionModel::isStatic
bool isStatic() const
Definition codemodel.cpp:1113
FunctionModel::setAbstract
void setAbstract(bool isAbstract)
Sets the function to be an inline function.
Definition codemodel.cpp:1148
FunctionModel::isConstant
bool isConstant() const
Definition codemodel.cpp:1133
FunctionModel::write
virtual void write(TQDataStream &stream) const
Writes an item to the stream.
Definition codemodel.cpp:1596
FunctionModel::setInline
void setInline(bool isInline)
Sets the function to be an inline function.
Definition codemodel.cpp:1128
FunctionModel::setAccess
void setAccess(int access)
Sets the access level of the function.
Definition codemodel.cpp:1240
FunctionModel::setConstant
void setConstant(bool isConstant)
Sets the function to be a constant function.
Definition codemodel.cpp:1138
FunctionModel::FunctionModel
FunctionModel(CodeModel *model)
Constructor.
Definition codemodel.cpp:1090
FunctionModel::setResultType
void setResultType(const TQString &type)
Sets the result type of a function.
Definition codemodel.cpp:1158
FunctionModel::isSignal
bool isSignal() const
Definition codemodel.cpp:1245
FunctionModel::addArgument
bool addArgument(ArgumentDom arg)
Adds an argument to the function.
Definition codemodel.cpp:1173
FunctionModel::isSlot
bool isSlot() const
Definition codemodel.cpp:1255
FunctionModel::isAbstract
bool isAbstract() const
Definition codemodel.cpp:1143
FunctionModel::isVirtual
bool isVirtual() const
Definition codemodel.cpp:1103
FunctionModel::isInline
bool isInline() const
Definition codemodel.cpp:1123
FunctionModel::setStatic
void setStatic(bool isStatic)
Sets the function to be a static function.
Definition codemodel.cpp:1118
HashedString
A simple class that stores a string together with it's appropriate hash-key.
Definition hashedstring.h:26
NamespaceDom
Safe pointer to the NamespaceModel.
NamespaceList
The list of code model namespaces.
NamespaceModel
Namespace model.
Definition codemodel.h:1040
NamespaceModel::NamespaceModel
NamespaceModel(CodeModel *model)
Constructor.
Definition codemodel.cpp:664
NamespaceModel::hasNamespace
bool hasNamespace(const TQString &name) const
Checks if the namespace referenced by name is in the model.
Definition codemodel.cpp:690
NamespaceModel::write
virtual void write(TQDataStream &stream) const
Writes an item to the stream.
Definition codemodel.cpp:1465
NamespaceModel::read
virtual void read(TQDataStream &stream)
Reads an item from the stream.
Definition codemodel.cpp:1421
NamespaceModel::namespaceByName
NamespaceDom namespaceByName(const TQString &name)
Gets the namespace specified by name.
Definition codemodel.cpp:680
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
NamespaceModel::NamespaceImportModelList
std::set< NamespaceImportModel > NamespaceImportModelList
I'm using std-sets here, because TQt-3 has no appropriate replacement.
Definition codemodel.h:1048
NamespaceModel::update
void update(const NamespaceModel *ns)
Updates this model so it has the same content as the other one.
Definition codemodel.cpp:1519
NamespaceModel::addNamespace
bool addNamespace(NamespaceDom ns)
Adds a namespace to the model.
Definition codemodel.cpp:695
NamespaceModel::namespaceList
NamespaceList namespaceList()
Definition codemodel.cpp:670
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
NamespaceModel::removeNamespace
void removeNamespace(NamespaceDom ns)
Removes the namespace from the model.
Definition codemodel.cpp:704
NamespaceModel::canUpdate
bool canUpdate(const NamespaceModel *ns) const
Definition codemodel.cpp:1482
TypeAliasDom
Safe pointer to the TypeAliasModel.
TypeAliasList
The list of code model type aliases.
TypeAliasModel
Type alias model.
Definition codemodel.h:1576
TypeAliasModel::dump
virtual void dump(std::ostream &file, bool recurse=false, TQString Info="")
Definition codemodel.cpp:350
TypeAliasModel::setType
void setType(const TQString &type)
Sets the type of an alias.
Definition codemodel.cpp:1787
TypeAliasModel::type
TQString type() const
Definition codemodel.cpp:1782
TypeAliasModel::TypeAliasModel
TypeAliasModel(CodeModel *model)
Constructor.
Definition codemodel.cpp:1763
TypeAliasModel::write
virtual void write(TQDataStream &stream) const
Writes an item to the stream.
Definition codemodel.cpp:1775
TypeAliasModel::read
virtual void read(TQDataStream &stream)
Reads an item from the stream.
Definition codemodel.cpp:1768
VariableDom
Safe pointer to the VariableModel.
VariableList
The list of code model variables.
VariableModel
Variable model.
Definition codemodel.h:1410
VariableModel::VariableModel
VariableModel(CodeModel *model)
Constructor.
Definition codemodel.cpp:1199
VariableModel::read
virtual void read(TQDataStream &stream)
Reads an item from the stream.
Definition codemodel.cpp:1635
VariableModel::access
int access() const
Definition codemodel.cpp:1270
VariableModel::dump
virtual void dump(std::ostream &file, bool recurse=false, TQString Info="")
Definition codemodel.cpp:292
VariableModel::type
TQString type() const
Definition codemodel.cpp:1217
VariableModel::setType
void setType(const TQString &type)
Sets the type of the variable.
Definition codemodel.cpp:1222
VariableModel::write
virtual void write(TQDataStream &stream) const
Writes an item to the stream.
Definition codemodel.cpp:1641
VariableModel::isEnumeratorVariable
bool isEnumeratorVariable() const
Definition codemodel.cpp:1227
VariableModel::isStatic
bool isStatic() const
Definition codemodel.cpp:1207
VariableModel::setStatic
void setStatic(bool isStatic)
Sets the variable to be a static variable.
Definition codemodel.cpp:1212
VariableModel::setAccess
void setAccess(int access)
Sets the access level of the variable.
Definition codemodel.cpp:1275
codemodel.h
Code Model - a memory symbol store.

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.9.8
This website is maintained by Timothy Pearson.