1010
1111
1212from . import declaration
13+ from . import location as pygccxml_location
1314
1415
1516class comment_t (declaration .declaration_t ):
@@ -22,31 +23,110 @@ def __init__(self, name='', declarations=None):
2223
2324 """
2425 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
2730 self ._end_line = 0
31+ self ._end_column = 0
32+ self ._end_offset = 0
2833 self ._text = ""
2934
3035 @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
3342
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 )
3783
3884 @property
3985 def end_line (self ):
86+ """An integer value which corresponds to the
87+ line of the file where the comment ends
88+ @type: int """
4089 return self ._end_line
4190
4291 @end_line .setter
4392 def end_line (self , end_line ):
4493 self ._end_line = int (end_line )
4594
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+
46118 @property
47119 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 """
48124 return self ._text
49125
50126 @text .setter
51127 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__ )
52132 self ._text = text
0 commit comments