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

TDevelop Catalog Library

  • lib
  • catalog
tag.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 "tag.h"
21 #include <tqdatastream.h>
22 
23 Tag::Tag()
24 {
25  data = new TagData();
26  data->kind = 0;
27  data->flags = 0;
28  data->startLine = 0;
29  data->startColumn = 0;
30  data->endLine = 0;
31  data->endColumn = 0;
32 }
33 
34 Tag::Tag( const Tag& source )
35 {
36  data = source.data;
37  data->ref();
38 }
39 
40 Tag::~Tag()
41 {
42  if( data->deref() ){
43  delete( data );
44  data = 0;
45  }
46 }
47 
48 void Tag::detach()
49 {
50  if( data->count != 1 )
51  *this = copy();
52 }
53 
54 Tag Tag::copy()
55 {
56  Tag t;
57 
58  t.data->id = data->id;
59  t.data->kind = data->kind;
60  t.data->flags = data->flags;
61  t.data->name = data->name;
62  t.data->scope = data->scope;
63  t.data->fileName = data->fileName;
64  t.data->startLine = data->startLine;
65  t.data->startColumn = data->startColumn;
66  t.data->endLine = data->endLine;
67  t.data->endColumn = data->endColumn;
68  t.data->attributes = data->attributes;
69 
70  return t;
71 }
72 
73 Tag& Tag::operator = ( const Tag& source )
74 {
75  source.data->ref();
76  if ( data->deref() ){
77  delete data;
78  }
79  data = source.data;
80 
81  return( *this );
82 }
83 
84 void Tag::load( TQDataStream& stream )
85 {
86  stream
87  >> data->id
88  >> data->kind
89  >> data->flags
90  >> data->name
91  >> data->scope
92  >> data->fileName
93  >> data->startLine
94  >> data->startColumn
95  >> data->endLine
96  >> data->endColumn
97  >> data->attributes;
98 }
99 
100 void Tag::store( TQDataStream& stream ) const
101 {
102  stream
103  << data->id
104  << data->kind
105  << data->flags
106  << data->name
107  << data->scope
108  << data->fileName
109  << data->startLine
110  << data->startColumn
111  << data->endLine
112  << data->endColumn
113  << data->attributes;
114 }
115 
116 TQDataStream& operator << ( TQDataStream& s, const Tag& t)
117 {
118  t.store( s );
119  return s;
120 }
121 
122 TQDataStream& operator >> ( TQDataStream& s, Tag& t )
123 {
124  t.load( s );
125  return s;
126 }
127 

TDevelop Catalog Library

Skip menu "TDevelop Catalog Library"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

TDevelop Catalog Library

Skip menu "TDevelop Catalog 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 Catalog Library by doxygen 1.8.13
This website is maintained by Timothy Pearson.