mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:52:43 +00:00 
			
		
		
		
	 14b2656107
			
		
	
	
		14b2656107
		
	
	
	
	
		
			
			LexicalPath is a 'heavier' object than a String that is mainly used for path parsing and validation, we don't actually need any of that in GitRepo and its related files, so let's move to String :^) I've also done some east-const conversion in the files that I was editing for the string change.
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			810 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			810 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include "GitFilesModel.h"
 | |
| 
 | |
| namespace HackStudio {
 | |
| 
 | |
| NonnullRefPtr<GitFilesModel> GitFilesModel::create(Vector<String>&& files)
 | |
| {
 | |
|     return adopt_ref(*new GitFilesModel(move(files)));
 | |
| }
 | |
| 
 | |
| GitFilesModel::GitFilesModel(Vector<String>&& files)
 | |
|     : m_files(move(files))
 | |
| {
 | |
| }
 | |
| 
 | |
| GUI::Variant GitFilesModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
 | |
| {
 | |
|     if (role == GUI::ModelRole::Display) {
 | |
|         return m_files.at(index.row());
 | |
|     }
 | |
|     return {};
 | |
| }
 | |
| 
 | |
| GUI::ModelIndex GitFilesModel::index(int row, int column, const GUI::ModelIndex&) const
 | |
| {
 | |
|     if (row < 0 || row >= static_cast<int>(m_files.size()))
 | |
|         return {};
 | |
|     return create_index(row, column, &m_files.at(row));
 | |
| }
 | |
| 
 | |
| };
 |