Remove unused + cosnt and so on
This commit is contained in:
		
							
								
								
									
										13
									
								
								src/Page.cpp
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/Page.cpp
									
									
									
									
									
								
							@@ -19,8 +19,8 @@
 | 
				
			|||||||
#include "libxml/xpath.h"
 | 
					#include "libxml/xpath.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool is_number(std::string_view s){
 | 
					bool is_number(const std::string_view s) {
 | 
				
			||||||
    return std::all_of(s.begin(), s.end(), [](unsigned char c ){
 | 
					    return std::ranges::all_of(s, [](const unsigned char c) {
 | 
				
			||||||
        return std::isdigit(c);
 | 
					        return std::isdigit(c);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -30,9 +30,9 @@ void italize_numbers(std::string &content, size_t leave_chars = 0) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Process backwards, word by word
 | 
					    // Process backwards, word by word
 | 
				
			||||||
    for (;;) {
 | 
					    for (;;) {
 | 
				
			||||||
        size_t space = content.rfind(' ', end - 1);
 | 
					        const size_t space = content.rfind(' ', end - 1);
 | 
				
			||||||
        size_t begin = (space == std::string::npos) ? 0 : space + 1;
 | 
					        const size_t begin = (space == std::string::npos) ? 0 : space + 1;
 | 
				
			||||||
        size_t word_length = end - begin;
 | 
					        const size_t word_length = end - begin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (is_number(content.substr(begin, word_length))) {
 | 
					        if (is_number(content.substr(begin, word_length))) {
 | 
				
			||||||
            content.insert(end, ansi::CLEAR);
 | 
					            content.insert(end, ansi::CLEAR);
 | 
				
			||||||
@@ -50,14 +50,13 @@ void italize_numbers(std::string &content, size_t leave_chars = 0) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void pretty_format_page(std::string &content) {
 | 
					void pretty_format_page(std::string &content) {
 | 
				
			||||||
    content.insert(0, ansi::BOLD);
 | 
					    content.insert(0, ansi::BOLD);
 | 
				
			||||||
    size_t line_end = content.find("\n");
 | 
					    const size_t line_end = content.find("\n");
 | 
				
			||||||
    content.insert(line_end, ansi::CLEAR);
 | 
					    content.insert(line_end, ansi::CLEAR);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    italize_numbers(content, line_end + ansi::CLEAR.size());
 | 
					    italize_numbers(content, line_end + ansi::CLEAR.size());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
Page::Page(const uint_fast8_t number): m_number(number), m_subpage(fetchSubpage()) {
 | 
					Page::Page(const uint_fast8_t number): m_number(number), m_subpage(fetchSubpage()) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,7 @@ static constexpr uint_fast8_t MAX_WHITESPACE = 2;
 | 
				
			|||||||
class Page
 | 
					class Page
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    uint_fast8_t m_number{};
 | 
					    uint_fast8_t m_number;
 | 
				
			||||||
    std::string m_subpage;
 | 
					    std::string m_subpage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
@@ -32,7 +32,7 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    Page &operator-=(int);
 | 
					    Page &operator-=(int);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::string str() const;
 | 
					    [[nodiscard]] std::string str() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool refresh();
 | 
					    bool refresh();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -40,6 +40,4 @@ private:
 | 
				
			|||||||
    [[nodiscard]] std::string url() const;
 | 
					    [[nodiscard]] std::string url() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [[nodiscard]] std::string fetchSubpage() const;
 | 
					    [[nodiscard]] std::string fetchSubpage() const;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    [[nodiscard]] bool contentEquals(const std::vector<std::string> &subpagesOther) const;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user