Remove using-declarations for std:: types

This commit is contained in:
Alex Chernyakhovsky
2023-07-30 17:46:02 -04:00
committed by Alex Chernyakhovsky
parent 8469db91db
commit 19ad493dcb
21 changed files with 173 additions and 189 deletions
+9 -11
View File
@@ -46,13 +46,11 @@ long int myatoi( const char *str );
class PRNG;
namespace Crypto {
using std::string;
class CryptoException : public std::exception {
public:
string text;
std::string text;
bool fatal;
CryptoException( string s_text, bool s_fatal = false )
CryptoException( std::string s_text, bool s_fatal = false )
: text( s_text ), fatal( s_fatal ) {};
const char *what() const throw () { return text.c_str(); }
~CryptoException() throw () {}
@@ -95,8 +93,8 @@ namespace Crypto {
public:
Base64Key(); /* random key */
Base64Key(PRNG &prng);
Base64Key( string printable_key );
string printable_key( void ) const;
Base64Key( std::string printable_key );
std::string printable_key( void ) const;
unsigned char *data( void ) { return key; }
};
@@ -111,7 +109,7 @@ namespace Crypto {
Nonce( uint64_t val );
Nonce( const char *s_bytes, size_t len );
string cc_str( void ) const { return string( bytes + 4, 8 ); }
std::string cc_str( void ) const { return std::string( bytes + 4, 8 ); }
const char *data( void ) const { return bytes; }
uint64_t val( void ) const;
};
@@ -119,14 +117,14 @@ namespace Crypto {
class Message {
public:
const Nonce nonce;
const string text;
const std::string text;
Message( const char *nonce_bytes, size_t nonce_len,
const char *text_bytes, size_t text_len )
: nonce( nonce_bytes, nonce_len ),
text( text_bytes, text_len ) {}
Message( const Nonce & s_nonce, const string & s_text )
Message( const Nonce & s_nonce, const std::string & s_text )
: nonce( s_nonce ),
text( s_text ) {}
};
@@ -150,9 +148,9 @@ namespace Crypto {
Session( Base64Key s_key );
~Session();
const string encrypt( const Message & plaintext );
const std::string encrypt( const Message & plaintext );
const Message decrypt( const char *str, size_t len );
const Message decrypt( const string & ciphertext ) {
const Message decrypt( const std::string & ciphertext ) {
return decrypt( ciphertext.data(), ciphertext.size() );
}