10
10
11
11
12
12
from . import declaration
13
+ from . import location as pygccxml_location
13
14
14
15
15
16
class comment_t (declaration .declaration_t ):
@@ -22,31 +23,110 @@ def __init__(self, name='', declarations=None):
22
23
23
24
"""
24
25
declaration .declaration_t .__init__ (self , name )
25
- self .location = {}
26
- self ._start_line = 0
26
+ self ._location = {}
27
+ self ._begin_line = 0
28
+ self ._begin_column = 0
29
+ self ._begin_offset = 0
27
30
self ._end_line = 0
31
+ self ._end_column = 0
32
+ self ._end_offset = 0
28
33
self ._text = ""
29
34
30
35
@property
31
- def start_line (self ):
32
- return self ._start_line
36
+ def location (self ):
37
+ """An instance of the location_t class
38
+ which contains the file where the
39
+ comment can be found.
40
+ @type: location_t """
41
+ return self ._location
33
42
34
- @start_line .setter
35
- def start_line (self , start_line ):
36
- self ._start_line = int (start_line )
43
+ @location .setter
44
+ def location (self , location ):
45
+ if not isinstance (location , pygccxml_location .location_t ):
46
+ raise ValueError (
47
+ "'location' must be a location_t (got a %s instead)" %
48
+ type (location ).__name__ )
49
+ self ._location = location
50
+
51
+ @property
52
+ def begin_line (self ):
53
+ """An integer value which corresponds to the
54
+ line of the file where the comment begins
55
+ @type: int """
56
+ return self ._begin_line
57
+
58
+ @begin_line .setter
59
+ def begin_line (self , begin_line ):
60
+ self ._begin_line = int (begin_line )
61
+
62
+ @property
63
+ def begin_offset (self ):
64
+ """An integer value which corresponds to the
65
+ line of the file where the comment begins
66
+ @type: int """
67
+ return self ._begin_offset
68
+
69
+ @begin_offset .setter
70
+ def begin_offset (self , begin_offset ):
71
+ self ._begin_offset = int (begin_offset )
72
+
73
+ @property
74
+ def begin_column (self ):
75
+ """An integer value which corresponds to the
76
+ line of the file where the comment begins
77
+ @type: int """
78
+ return self ._begin_column
79
+
80
+ @begin_column .setter
81
+ def begin_column (self , begin_column ):
82
+ self ._begin_column = int (begin_column )
37
83
38
84
@property
39
85
def end_line (self ):
86
+ """An integer value which corresponds to the
87
+ line of the file where the comment ends
88
+ @type: int """
40
89
return self ._end_line
41
90
42
91
@end_line .setter
43
92
def end_line (self , end_line ):
44
93
self ._end_line = int (end_line )
45
94
95
+ @property
96
+ def end_offset (self ):
97
+ """An integer value which corresponds to the
98
+ line of the file where the comment ends
99
+ @type: int """
100
+ return self ._end_offset
101
+
102
+ @end_offset .setter
103
+ def end_offset (self , end_offset ):
104
+ self ._end_offset = int (end_offset )
105
+
106
+ @property
107
+ def end_column (self ):
108
+ """An integer value which corresponds to the
109
+ coloumn of character in a line of the file
110
+ where the comment ends
111
+ @type: int """
112
+ return self ._end_column
113
+
114
+ @end_column .setter
115
+ def end_column (self , end_column ):
116
+ self ._end_column = int (end_column )
117
+
46
118
@property
47
119
def text (self ):
120
+ """An list of strings where each entry in the list
121
+ is one line of the comment. These comments will not
122
+ end in a newline
123
+ @type: list """
48
124
return self ._text
49
125
50
126
@text .setter
51
127
def text (self , text ):
128
+ if not isinstance (text , list ):
129
+ raise ValueError (
130
+ "'text' must be a list (got a %s instead)" %
131
+ type (text ).__name__ )
52
132
self ._text = text
0 commit comments