| 
									
										
										
										
											2019-02-28 01:43:50 +01:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-29 04:58:15 +01:00
										 |  |  | class GModel; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-28 01:43:50 +01:00
										 |  |  | class GModelIndex { | 
					
						
							| 
									
										
										
										
											2019-03-29 04:58:15 +01:00
										 |  |  |     friend class GModel; | 
					
						
							| 
									
										
										
										
											2019-02-28 01:43:50 +01:00
										 |  |  | public: | 
					
						
							|  |  |  |     GModelIndex() { } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool is_valid() const { return m_row != -1 && m_column != -1; } | 
					
						
							|  |  |  |     int row() const { return m_row; } | 
					
						
							|  |  |  |     int column() const { return m_column; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-29 04:58:15 +01:00
										 |  |  |     void* internal_data() const { return m_internal_data; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-29 14:46:53 +01:00
										 |  |  |     GModelIndex parent() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-15 16:25:30 +01:00
										 |  |  |     bool operator==(const GModelIndex& other) const { return m_row == other.m_row && m_column == other.m_column; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-28 01:43:50 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2019-03-29 04:58:15 +01:00
										 |  |  |     GModelIndex(const GModel& model, int row, int column, void* internal_data) | 
					
						
							|  |  |  |         : m_model(&model) | 
					
						
							|  |  |  |         , m_row(row) | 
					
						
							|  |  |  |         , m_column(column) | 
					
						
							|  |  |  |         , m_internal_data(internal_data) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const GModel* m_model { nullptr }; | 
					
						
							| 
									
										
										
										
											2019-02-28 01:43:50 +01:00
										 |  |  |     int m_row { -1 }; | 
					
						
							|  |  |  |     int m_column { -1 }; | 
					
						
							| 
									
										
										
										
											2019-03-29 04:58:15 +01:00
										 |  |  |     void* m_internal_data { nullptr }; | 
					
						
							| 
									
										
										
										
											2019-02-28 01:43:50 +01:00
										 |  |  | }; |