This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
553c0aa
commit 27058e2
Showing
6 changed files
with
106 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/************************************************************************************************/ | ||
|
||
pub struct Verbose { | ||
enabled: bool, | ||
indent: usize, | ||
} | ||
|
||
/************************************************************************************************/ | ||
|
||
impl Verbose { | ||
/*------------------------------------------------------------------------------------------*/ | ||
|
||
pub fn new() -> Verbose { | ||
Verbose { | ||
enabled: false, | ||
indent: 0, | ||
} | ||
} | ||
|
||
/*------------------------------------------------------------------------------------------*/ | ||
|
||
pub fn enable(&mut self) { | ||
self.enabled = true; | ||
} | ||
|
||
/*------------------------------------------------------------------------------------------*/ | ||
|
||
pub fn _disable(&mut self) { | ||
self.enabled = false; | ||
} | ||
|
||
/*------------------------------------------------------------------------------------------*/ | ||
|
||
pub fn _is_enabled(&self) -> bool { | ||
return self.enabled; | ||
} | ||
|
||
/*------------------------------------------------------------------------------------------*/ | ||
|
||
pub fn increate_indent(&mut self) { | ||
self.indent = self.indent + 1; | ||
} | ||
|
||
/*------------------------------------------------------------------------------------------*/ | ||
|
||
pub fn decrease_indent(&mut self) { | ||
if self.indent > 0 { | ||
self.indent = self.indent - 1; | ||
} | ||
} | ||
|
||
/*------------------------------------------------------------------------------------------*/ | ||
|
||
pub fn println(&self, line: &str) { | ||
if self.enabled { | ||
let indent = " ".repeat(self.indent); | ||
println!("{}{}", indent, line); | ||
} | ||
} | ||
|
||
/*------------------------------------------------------------------------------------------*/ | ||
} | ||
|
||
/************************************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters