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/filesystem.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);
ifstream& read( char* buf, size_t len );
ifstream& seekg( size_t p, seekdir d = beg );
using istream::get;
void get( char& c ) { read( &c, 1 ); }
void close();
bool eof()const;
@ -45,5 +46,5 @@ namespace fc {
class impl;
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
* will block 'cooperatively' instead of hard blocking.
*/
class istream
class istream
{
public:
virtual ~istream(){};
@ -28,8 +28,8 @@ namespace fc {
*
* @throws fc::eof_exception if len bytes cannot be read
**/
istream& read( char* buf, size_t len );
istream& read( const std::shared_ptr<char>& buf, size_t len, size_t offset = 0 );
istream& read( char* buf, size_t len );
istream& read( const std::shared_ptr<char>& buf, size_t len, size_t offset = 0 );
virtual char get();
};
typedef std::shared_ptr<istream> istream_ptr;
@ -38,7 +38,7 @@ namespace fc {
* Provides a fc::thread friendly cooperatively multi-tasked stream that
* will block 'cooperatively' instead of hard blocking.
*/
class ostream
class ostream
{
public:
virtual ~ostream(){};
@ -48,9 +48,9 @@ namespace fc {
virtual void flush() = 0;
void put( char c ) { write(&c,1); }
/** 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 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' );
template<size_t N>
ostream& operator<<( ostream& o, char (&array)[N] )
{
return o.write( array, N );
ostream& operator<<( ostream& o, char (&array)[N] )
{
return o.write( array, N );
}
ostream& operator<<( ostream& o, char );

View file

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

View file

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