Fix overloaded virtual function warnings

This commit is contained in:
Vikram Rajkumar 2014-12-23 15:45:57 -05:00
parent 5a91c4f118
commit 874f103b8d
4 changed files with 30 additions and 27 deletions

View file

@ -1,4 +1,4 @@
#pragma once #pragma once
#include <fc/shared_ptr.hpp> #include <fc/shared_ptr.hpp>
#include <fc/filesystem.hpp> #include <fc/filesystem.hpp>
#include <fc/io/iostream.hpp> #include <fc/io/iostream.hpp>
@ -38,6 +38,7 @@ namespace fc {
size_t readsome(const std::shared_ptr<char>& buffer, size_t max, size_t offset); size_t readsome(const std::shared_ptr<char>& buffer, size_t max, size_t offset);
ifstream& read( char* buf, size_t len ); ifstream& read( char* buf, size_t len );
ifstream& seekg( size_t p, seekdir d = beg ); ifstream& seekg( size_t p, seekdir d = beg );
using istream::get;
void get( char& c ) { read( &c, 1 ); } void get( char& c ) { read( &c, 1 ); }
void close(); void close();
bool eof()const; bool eof()const;
@ -45,5 +46,5 @@ namespace fc {
class impl; class impl;
fc::shared_ptr<impl> my; fc::shared_ptr<impl> my;
}; };
} // namespace fc } // namespace fc

View file

@ -9,7 +9,7 @@ namespace fc {
* Provides a fc::thread friendly cooperatively multi-tasked stream that * Provides a fc::thread friendly cooperatively multi-tasked stream that
* will block 'cooperatively' instead of hard blocking. * will block 'cooperatively' instead of hard blocking.
*/ */
class istream class istream
{ {
public: public:
virtual ~istream(){}; virtual ~istream(){};
@ -28,8 +28,8 @@ namespace fc {
* *
* @throws fc::eof_exception if len bytes cannot be read * @throws fc::eof_exception if len bytes cannot be read
**/ **/
istream& read( char* buf, size_t len ); istream& read( char* buf, size_t len );
istream& read( const std::shared_ptr<char>& buf, size_t len, size_t offset = 0 ); istream& read( const std::shared_ptr<char>& buf, size_t len, size_t offset = 0 );
virtual char get(); virtual char get();
}; };
typedef std::shared_ptr<istream> istream_ptr; typedef std::shared_ptr<istream> istream_ptr;
@ -38,7 +38,7 @@ namespace fc {
* Provides a fc::thread friendly cooperatively multi-tasked stream that * Provides a fc::thread friendly cooperatively multi-tasked stream that
* will block 'cooperatively' instead of hard blocking. * will block 'cooperatively' instead of hard blocking.
*/ */
class ostream class ostream
{ {
public: public:
virtual ~ostream(){}; virtual ~ostream(){};
@ -48,9 +48,9 @@ namespace fc {
virtual void flush() = 0; virtual void flush() = 0;
void put( char c ) { write(&c,1); } void put( char c ) { write(&c,1); }
/** implemented in terms of writesome, guarantees len bytes are sent /** implemented in terms of writesome, guarantees len bytes are sent
* but not flushed. * but not flushed.
**/ **/
ostream& write( const char* buf, size_t len ); ostream& write( const char* buf, size_t len );
ostream& write( const std::shared_ptr<const char>& buf, size_t len, size_t offset = 0 ); ostream& write( const std::shared_ptr<const char>& buf, size_t len, size_t offset = 0 );
@ -63,9 +63,9 @@ namespace fc {
fc::istream& getline( fc::istream&, fc::string&, char delim = '\n' ); fc::istream& getline( fc::istream&, fc::string&, char delim = '\n' );
template<size_t N> template<size_t N>
ostream& operator<<( ostream& o, char (&array)[N] ) ostream& operator<<( ostream& o, char (&array)[N] )
{ {
return o.write( array, N ); return o.write( array, N );
} }
ostream& operator<<( ostream& o, char ); ostream& operator<<( ostream& o, char );

View file

@ -5,11 +5,11 @@
#include <fc/time.hpp> #include <fc/time.hpp>
namespace fc { namespace fc {
namespace ip { class endpoint; } namespace ip { class endpoint; }
class tcp_socket_io_hooks; class tcp_socket_io_hooks;
class tcp_socket : public virtual iostream class tcp_socket : public virtual iostream
{ {
public: public:
tcp_socket(); tcp_socket();
@ -23,6 +23,7 @@ namespace fc {
fc::ip::endpoint remote_endpoint() const; fc::ip::endpoint remote_endpoint() const;
fc::ip::endpoint local_endpoint() const; fc::ip::endpoint local_endpoint() const;
using istream::get;
void get( char& c ) void get( char& c )
{ {
read( &c, 1 ); read( &c, 1 );
@ -58,8 +59,8 @@ namespace fc {
}; };
typedef std::shared_ptr<tcp_socket> tcp_socket_ptr; typedef std::shared_ptr<tcp_socket> tcp_socket_ptr;
class tcp_server class tcp_server
{ {
public: public:
tcp_server(); tcp_server();
@ -74,7 +75,7 @@ namespace fc {
uint16_t get_port()const; uint16_t get_port()const;
private: private:
// non copyable // non copyable
tcp_server( const tcp_server& ); tcp_server( const tcp_server& );
tcp_server& operator=(const tcp_server& s ); tcp_server& operator=(const tcp_server& s );
class impl; class impl;

View file

@ -13,26 +13,27 @@ namespace fc {
public: public:
udt_socket(); udt_socket();
~udt_socket(); ~udt_socket();
void bind( const fc::ip::endpoint& local_endpoint ); void bind( const fc::ip::endpoint& local_endpoint );
void connect_to( const fc::ip::endpoint& remote_endpoint ); void connect_to( const fc::ip::endpoint& remote_endpoint );
fc::ip::endpoint remote_endpoint() const; fc::ip::endpoint remote_endpoint() const;
fc::ip::endpoint local_endpoint() const; fc::ip::endpoint local_endpoint() const;
using istream::get;
void get( char& c ) void get( char& c )
{ {
read( &c, 1 ); read( &c, 1 );
} }
/// istream interface /// istream interface
/// @{ /// @{
virtual size_t readsome( char* buffer, size_t max ); virtual size_t readsome( char* buffer, size_t max );
virtual size_t readsome( const std::shared_ptr<char>& buf, size_t len, size_t offset ); virtual size_t readsome( const std::shared_ptr<char>& buf, size_t len, size_t offset );
virtual bool eof()const; virtual bool eof()const;
/// @} /// @}
/// ostream interface /// ostream interface
/// @{ /// @{
virtual size_t writesome( const char* buffer, size_t len ); virtual size_t writesome( const char* buffer, size_t len );
@ -40,10 +41,10 @@ namespace fc {
virtual void flush(); virtual void flush();
virtual void close(); virtual void close();
/// @} /// @}
void open(); void open();
bool is_open()const; bool is_open()const;
private: private:
friend class udt_server; friend class udt_server;
int _udt_socket_id; int _udt_socket_id;
@ -55,13 +56,13 @@ namespace fc {
public: public:
udt_server(); udt_server();
~udt_server(); ~udt_server();
void close(); void close();
void accept( udt_socket& s ); void accept( udt_socket& s );
void listen( const fc::ip::endpoint& ep ); void listen( const fc::ip::endpoint& ep );
fc::ip::endpoint local_endpoint() const; fc::ip::endpoint local_endpoint() const;
private: private:
int _udt_socket_id; int _udt_socket_id;
}; };