mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:22:43 +00:00 
			
		
		
		
	 6e19ab2bbc
			
		
	
	
		6e19ab2bbc
		
	
	
	
	
		
			
			We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
		
			
				
	
	
		
			50 lines
		
	
	
	
		
			899 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			899 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2020, the SerenityOS developers.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/DeprecatedString.h>
 | |
| #include <AK/Types.h>
 | |
| #include <AK/URL.h>
 | |
| 
 | |
| namespace Spreadsheet {
 | |
| 
 | |
| class Sheet;
 | |
| 
 | |
| struct Position {
 | |
|     Position() = default;
 | |
| 
 | |
|     Position(size_t column, size_t row)
 | |
|         : column(column)
 | |
|         , row(row)
 | |
|         , m_hash(pair_int_hash(column, row))
 | |
|     {
 | |
|     }
 | |
| 
 | |
|     ALWAYS_INLINE u32 hash() const
 | |
|     {
 | |
|         if (m_hash == 0)
 | |
|             return m_hash = int_hash(column * 65537 + row);
 | |
| 
 | |
|         return m_hash;
 | |
|     }
 | |
| 
 | |
|     bool operator==(Position const& other) const
 | |
|     {
 | |
|         return row == other.row && column == other.column;
 | |
|     }
 | |
| 
 | |
|     DeprecatedString to_cell_identifier(Sheet const& sheet) const;
 | |
|     URL to_url(Sheet const& sheet) const;
 | |
| 
 | |
|     size_t column { 0 };
 | |
|     size_t row { 0 };
 | |
| 
 | |
| private:
 | |
|     mutable u32 m_hash { 0 };
 | |
| };
 | |
| 
 | |
| }
 |