-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added initial metadata item documentation. Refs: #280
- Loading branch information
Showing
45 changed files
with
1,045 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ struct StreamOutput; | |
namespace stream { | ||
|
||
class TimedOut; | ||
class Text; | ||
|
||
struct SendResult | ||
{ | ||
|
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,57 @@ | ||
#ifndef ARKI_STREAM_TEXT_H | ||
#define ARKI_STREAM_TEXT_H | ||
|
||
#include <arki/stream.h> | ||
#include <string> | ||
|
||
namespace arki { | ||
namespace stream { | ||
|
||
struct Text | ||
{ | ||
StreamOutput& out; | ||
SendResult result; | ||
|
||
Text(StreamOutput& out) : out(out) {} | ||
|
||
void print(const std::string& str) | ||
{ | ||
if (result.flags & SendResult::SEND_PIPE_EOF_DEST) | ||
return; | ||
|
||
result += out.send_line(str.data(), str.size()); | ||
} | ||
|
||
/** | ||
* Print a reStructuredText title. | ||
* | ||
* Level represents the heading level (1 being the outermost one), and | ||
* rendering is done according to | ||
* https://devguide.python.org/documenting/#sections | ||
*/ | ||
void rst_header(const std::string& str, unsigned level=1) | ||
{ | ||
bool over = false; | ||
char c = '"'; | ||
|
||
switch (level) | ||
{ | ||
case 1: over = true, c = '#'; break; | ||
case 2: over = true, c = '*'; break; | ||
case 3: c = '='; break; | ||
case 4: c = '-'; break; | ||
case 5: c = '^'; break; | ||
} | ||
|
||
std::string bar(str.size(), c); | ||
if (over) print(bar); | ||
print(str); | ||
print(bar); | ||
|
||
} | ||
}; | ||
|
||
} | ||
} | ||
|
||
#endif |
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
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
Oops, something went wrong.