Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
a8c25f91
Commit
a8c25f91
authored
Sep 08, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new colouring of output
parent
cb82ec9b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
76 deletions
+12
-76
include/cif++/utilities.hpp
+0
-70
src/pdb/pdb2cif_remark_3.cpp
+10
-2
src/pdb/tls.cpp
+2
-4
No files found.
include/cif++/utilities.hpp
View file @
a8c25f91
...
@@ -174,76 +174,6 @@ namespace colour
...
@@ -174,76 +174,6 @@ namespace colour
constexpr
auto
reset
=
cif
::
coloured
(
none
,
none
,
regular
);
constexpr
auto
reset
=
cif
::
coloured
(
none
,
none
,
regular
);
}
}
template
<
typename
String
,
typename
CharT
>
struct
ColouredString
{
static_assert
(
std
::
is_reference
<
String
>::
value
or
std
::
is_pointer
<
String
>::
value
,
"String type must be pointer or reference"
);
ColouredString
(
String
s
,
StringColour
fore
,
StringColour
back
,
bool
bold
=
true
)
:
m_s
(
s
)
,
m_fore
(
30
+
static_cast
<
int
>
(
fore
))
,
m_back
(
40
+
static_cast
<
int
>
(
back
))
,
m_bold
(
bold
)
{
}
ColouredString
&
operator
=
(
const
ColouredString
&
)
=
delete
;
String
m_s
;
int
m_fore
,
m_back
;
bool
m_bold
;
};
template
<
typename
CharT
,
typename
Traits
>
std
::
basic_ostream
<
CharT
,
Traits
>
&
operator
<<
(
std
::
basic_ostream
<
CharT
,
Traits
>
&
os
,
const
ColouredString
<
const
CharT
*
,
CharT
>
&
s
)
{
if
(
isatty
(
STDOUT_FILENO
))
{
std
::
basic_ostringstream
<
CharT
,
Traits
>
ostr
;
ostr
<<
"
\033
["
<<
s
.
m_fore
<<
';'
<<
(
s
.
m_bold
?
"1"
:
"22"
)
<<
';'
<<
s
.
m_back
<<
'm'
<<
s
.
m_s
<<
"
\033
[0m"
;
return
os
<<
ostr
.
str
();
}
else
return
os
<<
s
.
m_s
;
}
template
<
typename
CharT
,
typename
Traits
,
typename
String
>
std
::
basic_ostream
<
CharT
,
Traits
>
&
operator
<<
(
std
::
basic_ostream
<
CharT
,
Traits
>
&
os
,
const
ColouredString
<
String
,
CharT
>
&
s
)
{
if
(
isatty
(
STDOUT_FILENO
))
{
std
::
basic_ostringstream
<
CharT
,
Traits
>
ostr
;
ostr
<<
"
\033
["
<<
s
.
m_fore
<<
';'
<<
(
s
.
m_bold
?
"1"
:
"22"
)
<<
';'
<<
s
.
m_back
<<
'm'
<<
s
.
m_s
<<
"
\033
[0m"
;
return
os
<<
ostr
.
str
();
}
else
return
os
<<
s
.
m_s
;
}
template
<
typename
CharT
>
inline
auto
coloured
(
const
CharT
*
s
,
StringColour
fore
=
StringColour
::
WHITE
,
StringColour
back
=
StringColour
::
RED
,
bool
bold
=
true
)
{
return
ColouredString
<
const
CharT
*
,
CharT
>
(
s
,
fore
,
back
,
bold
);
}
template
<
typename
CharT
,
typename
Traits
,
typename
Alloc
>
inline
auto
coloured
(
const
std
::
basic_string
<
CharT
,
Traits
,
Alloc
>
&
s
,
StringColour
fore
=
StringColour
::
WHITE
,
StringColour
back
=
StringColour
::
RED
,
bool
bold
=
true
)
{
return
ColouredString
<
const
std
::
basic_string
<
CharT
,
Traits
,
Alloc
>
,
CharT
>
(
s
,
fore
,
back
,
bold
);
}
template
<
typename
CharT
,
typename
Traits
,
typename
Alloc
>
inline
auto
coloured
(
std
::
basic_string
<
CharT
,
Traits
,
Alloc
>
&
s
,
StringColour
fore
=
StringColour
::
WHITE
,
StringColour
back
=
StringColour
::
RED
,
bool
bold
=
true
)
{
return
ColouredString
<
std
::
basic_string
<
CharT
,
Traits
,
Alloc
>
,
CharT
>
(
s
,
fore
,
back
,
bold
);
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// A progress bar
// A progress bar
...
...
src/pdb/pdb2cif_remark_3.cpp
View file @
a8c25f91
...
@@ -1056,7 +1056,11 @@ bool Remark3Parser::match(const char *expr, int nextState)
...
@@ -1056,7 +1056,11 @@ bool Remark3Parser::match(const char *expr, int nextState)
if
(
result
)
if
(
result
)
mState
=
nextState
;
mState
=
nextState
;
else
if
(
cif
::
VERBOSE
>=
3
)
else
if
(
cif
::
VERBOSE
>=
3
)
std
::
cerr
<<
cif
::
coloured
(
"No match:"
,
cif
::
StringColour
::
WHITE
,
cif
::
StringColour
::
RED
)
<<
" '"
<<
expr
<<
'\''
<<
std
::
endl
;
{
using
namespace
colour
;
std
::
cerr
<<
coloured
(
white
,
red
,
bold
)
<<
"No match:"
<<
reset
<<
" '"
<<
expr
<<
'\''
<<
std
::
endl
;
}
return
result
;
return
result
;
}
}
...
@@ -1116,7 +1120,11 @@ float Remark3Parser::parse()
...
@@ -1116,7 +1120,11 @@ float Remark3Parser::parse()
}
}
if
(
cif
::
VERBOSE
>=
2
)
if
(
cif
::
VERBOSE
>=
2
)
std
::
cerr
<<
cif
::
coloured
(
"Dropping line:"
,
cif
::
StringColour
::
WHITE
,
cif
::
StringColour
::
RED
)
<<
" '"
<<
mLine
<<
'\''
<<
std
::
endl
;
{
using
namespace
colour
;
std
::
cerr
<<
coloured
(
white
,
red
,
bold
)
<<
"Dropping line:"
<<
reset
<<
" '"
<<
mLine
<<
'\''
<<
std
::
endl
;
}
++
dropped
;
++
dropped
;
}
}
...
...
src/pdb/tls.cpp
View file @
a8c25f91
...
@@ -136,10 +136,8 @@ void dump_selection(const std::vector<tls_residue> &selected, size_t indentLevel
...
@@ -136,10 +136,8 @@ void dump_selection(const std::vector<tls_residue> &selected, size_t indentLevel
if
(
first
)
if
(
first
)
{
{
if
(
isatty
(
STDOUT_FILENO
))
using
namespace
colour
;
std
::
cout
<<
indent
<<
cif
::
coloured
(
"Empty selection"
)
<<
std
::
endl
;
std
::
cout
<<
indent
<<
coloured
(
white
,
red
,
bold
)
<<
"Empty selection"
<<
reset
<<
std
::
endl
;
else
std
::
cout
<<
indent
<<
"Empty selection"
<<
std
::
endl
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment