mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:22:43 +00:00 
			
		
		
		
	 5e1499d104
			
		
	
	
		5e1499d104
		
	
	
	
	
		
			
			This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).
This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
		
	
			
		
			
				
	
	
		
			45 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/URL.h>
 | |
| #include <AK/Vector.h>
 | |
| 
 | |
| namespace WebView {
 | |
| 
 | |
| class History {
 | |
| public:
 | |
|     struct URLTitlePair {
 | |
|         URL url;
 | |
|         ByteString title;
 | |
|     };
 | |
|     void dump() const;
 | |
|     Vector<URLTitlePair> get_all_history_entries();
 | |
| 
 | |
|     void push(const URL& url, ByteString const& title);
 | |
|     void replace_current(const URL& url, ByteString const& title);
 | |
|     void update_title(ByteString const& title);
 | |
|     URLTitlePair current() const;
 | |
| 
 | |
|     Vector<StringView> const get_back_title_history();
 | |
|     Vector<StringView> const get_forward_title_history();
 | |
| 
 | |
|     void go_back(int steps = 1);
 | |
|     void go_forward(int steps = 1);
 | |
| 
 | |
|     bool can_go_back(int steps = 1) { return (m_current - steps) >= 0; }
 | |
|     bool can_go_forward(int steps = 1) { return (m_current + steps) < static_cast<int>(m_items.size()); }
 | |
|     void clear();
 | |
| 
 | |
|     bool is_empty() const { return m_items.is_empty(); }
 | |
| 
 | |
| private:
 | |
|     Vector<URLTitlePair> m_items;
 | |
|     int m_current { -1 };
 | |
| };
 | |
| 
 | |
| }
 |