yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::GitignoreParser Class Reference

Simple .gitignore pattern matcher. More...

#include <file_browser.h>

Classes

struct  Pattern
 

Public Member Functions

void LoadFromFile (const std::string &gitignore_path)
 
void AddPattern (const std::string &pattern)
 
bool IsIgnored (const std::string &path, bool is_directory) const
 
void Clear ()
 

Private Member Functions

bool MatchPattern (const std::string &path, const Pattern &pattern) const
 
bool MatchGlob (const std::string &text, const std::string &pattern) const
 

Private Attributes

std::vector< Patternpatterns_
 

Detailed Description

Simple .gitignore pattern matcher.

Supports basic gitignore patterns:

  • Simple file/folder names: "node_modules"
  • Wildcards: "*.log"
  • Directory-only: "build/"
  • Comments: "# comment"
  • Negation: "!important.txt"

Definition at line 51 of file file_browser.h.

Member Function Documentation

◆ LoadFromFile()

void yaze::editor::GitignoreParser::LoadFromFile ( const std::string & gitignore_path)

Definition at line 23 of file file_browser.cc.

References AddPattern().

Referenced by yaze::editor::FileBrowser::SetRootPath().

Here is the call graph for this function:

◆ AddPattern()

◆ IsIgnored()

bool yaze::editor::GitignoreParser::IsIgnored ( const std::string & path,
bool is_directory ) const

Definition at line 74 of file file_browser.cc.

References MatchPattern(), and patterns_.

Referenced by yaze::editor::FileBrowser::ScanDirectory().

Here is the call graph for this function:

◆ Clear()

void yaze::editor::GitignoreParser::Clear ( )

Definition at line 96 of file file_browser.cc.

References patterns_.

Referenced by yaze::editor::FileBrowser::SetRootPath().

◆ MatchPattern()

bool yaze::editor::GitignoreParser::MatchPattern ( const std::string & path,
const Pattern & pattern ) const
private

Definition at line 98 of file file_browser.cc.

References MatchGlob(), and yaze::editor::GitignoreParser::Pattern::pattern.

Referenced by IsIgnored().

Here is the call graph for this function:

◆ MatchGlob()

bool yaze::editor::GitignoreParser::MatchGlob ( const std::string & text,
const std::string & pattern ) const
private

Definition at line 103 of file file_browser.cc.

Referenced by MatchPattern().

Member Data Documentation

◆ patterns_

std::vector<Pattern> yaze::editor::GitignoreParser::patterns_
private

Definition at line 65 of file file_browser.h.

Referenced by AddPattern(), Clear(), and IsIgnored().


The documentation for this class was generated from the following files: