.TH "FBB::Tty" "3bobcat" "2005\-2023" "libbobcat\-dev_6\&.04\&.00" "Controls echoing of characters" .PP .SH "NAME" FBB::Tty \- Controls echoing of characters entered at the terminal .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat\fP .PP .SH "DESCRIPTION" \fBTty\fP(3bobcat) objects can be used to control the echoing of characters entered at the terminal (usually at \fI/dev/tty\fP)\&. Directly reading from \fI/dev/tty\fP allows programs to read information (e\&.g\&., passwords or pass phrases) even if the standard input stream is redirected to a file\&. Unless redirected, \fIstd::cin\fP is connected to \fI/dev/tty\fP\&. .PP \fBTty\fP(3bobcat) objects may be used as stand\-alone objects or (usually anonymous) \fBTty\fP(3bobcat) objects may be inserted into or extracted from streams\&. When inserting or extracting objects the involved streams are not affected; only the echoing of characters entered at \fI/dev/tty\fP is manipulated\&. .PP \fBTty\fP(3bobcat)\(cq\&s destructor does not reset the echo\-state of \fI/dev/tty\fP to its original value\&. If that is required a \fBTty\fP(3bobcat) object must be created first, calling its \fBecho(Tty::RESET)\fP member at the appropriate time\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" \- .PP .SH "ENUM" .PP The \fIenum EchoType\fP requests the type of echo\-handling: .IP o \fBRESET\fP is used to reset \fI/dev/tty\fP\(cq\&s state to the actual state when a \fBTty\fP(3bobcat) object was constructed .IP o \fBON\fP is used to activate echoing of characters entered at \fI/dev/tty\fP\&. .IP o \fBOFF\fP is used to suppress echoing of characters entered at \fI/dev/tty\fP\&. .PP .SH "CONSTRUCTORS" .IP o \fBTty()\fP: .br The current state of \fI/dev/tty\fP is saved\&. .IP .IP o \fBTty(EchoType type)\fP: .br The current state of \fI/dev/tty\fP is saved, and the object\(cq\&s member \fIecho(type)\fP is called\&. .PP Copy and move constructors (and assignment operators) are available\&. .PP .SH "OVERLOADED OPERATORS" .IP o \fBstd::istream &operator>>(std::istream &in, Tty const &tty)\fP: .br The extraction operator does not affect \fIin\fP, but \fI/dev/tty\fP\(cq\&s state is set according to the way the \fItty\fP object was constructed\&. .IP .IP o \fBstd::ostream &operator<<(std::ostream &out, Tty const &tty)\fP: .br The insertion operator does not affect \fIout\fP, but \fI/dev/tty\fP\(cq\&s state is set according to the way the \fItty\fP object was constructed\&. .PP .SH "MEMBER FUNCTION" .PP .IP o \fBecho(EchoType type)\fP: .br \fI/Dev/tty\fP\(cq\&s state is set according to the \fIEchoType\fP value that is passed to this member\&. .PP .SH "EXAMPLE" .PP .nf #include #include #include using namespace std; using namespace FBB; int main() { cout << \(dq\&Enter some text (not echoed): \(dq\& << Tty(Tty::OFF); string line; getline(cin, line); cout << \(dq\&\en\(dq\& \(dq\&You entered: `\(dq\& << line << \(dq\&\(cq\&\en\(dq\&; cout << \(dq\&Enter some text (echoed): \(dq\&; getline(cin >> Tty(Tty::ON), line); cout << \(dq\&You entered: `\(dq\& << line << \(dq\&\(cq\&\en\(dq\&; } .fi .PP .SH "FILES" \fIbobcat/tty\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBonekey\fP(3bobcat) .PP .SH "BUGS" None Reported\&. .PP .SH "BOBCAT PROJECT FILES" .PP .IP o \fIhttps://fbb\-git\&.gitlab\&.io/bobcat/\fP: gitlab project page; .IP o \fIbobcat_6\&.04\&.00\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_6\&.04\&.00\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_6\&.04\&.00\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_6\&.04\&.00\-x_*\&.deb\fP: debian package containing the libraries, headers and manual pages; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP