De-C++11-ification

pull/835/head
Craig Tiller 10 years ago
parent 61691f92c3
commit 1a43f87134
  1. 9
      src/cpp/client/insecure_credentials.cc
  2. 11
      src/cpp/client/secure_credentials.cc

@ -37,18 +37,21 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc++/channel_arguments.h> #include <grpc++/channel_arguments.h>
#include <grpc++/config.h>
#include <grpc++/credentials.h> #include <grpc++/credentials.h>
#include "src/cpp/client/channel.h" #include "src/cpp/client/channel.h"
namespace grpc { namespace grpc {
namespace { namespace {
class InsecureCredentialsImpl final : public Credentials { class InsecureCredentialsImpl GRPC_FINAL : public Credentials {
public: public:
std::shared_ptr<grpc::ChannelInterface> CreateChannel(const string& target, const grpc::ChannelArguments& args) override { std::shared_ptr<grpc::ChannelInterface> CreateChannel(
const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE {
grpc_channel_args channel_args; grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args); args.SetChannelArgs(&channel_args);
return std::shared_ptr<ChannelInterface>(new Channel(target, grpc_channel_create(target.c_str(), &channel_args))); return std::shared_ptr<ChannelInterface>(new Channel(
target, grpc_channel_create(target.c_str(), &channel_args)));
} }
SecureCredentials* AsSecureCredentials() { return nullptr; } SecureCredentials* AsSecureCredentials() { return nullptr; }

@ -37,19 +37,20 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc++/channel_arguments.h> #include <grpc++/channel_arguments.h>
#include <grpc++/config.h>
#include <grpc++/credentials.h> #include <grpc++/credentials.h>
#include "src/cpp/client/channel.h" #include "src/cpp/client/channel.h"
namespace grpc { namespace grpc {
class SecureCredentials final : public Credentials { class SecureCredentials GRPC_FINAL : public Credentials {
public: public:
explicit SecureCredentials(grpc_credentials* c_creds) : c_creds_(c_creds) {} explicit SecureCredentials(grpc_credentials* c_creds) : c_creds_(c_creds) {}
~SecureCredentials() override { grpc_credentials_release(c_creds_); } ~SecureCredentials() GRPC_OVERRIDE { grpc_credentials_release(c_creds_); }
grpc_credentials* GetRawCreds() { return c_creds_; } grpc_credentials* GetRawCreds() { return c_creds_; }
std::shared_ptr<grpc::ChannelInterface> CreateChannel( std::shared_ptr<grpc::ChannelInterface> CreateChannel(
const string& target, const grpc::ChannelArguments& args) override { const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE {
grpc_channel_args channel_args; grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args); args.SetChannelArgs(&channel_args);
return std::shared_ptr<ChannelInterface>(new Channel( return std::shared_ptr<ChannelInterface>(new Channel(
@ -57,9 +58,7 @@ class SecureCredentials final : public Credentials {
grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args))); grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args)));
} }
SecureCredentials* AsSecureCredentials() { SecureCredentials* AsSecureCredentials() { return this; }
return this;
}
private: private:
grpc_credentials* const c_creds_; grpc_credentials* const c_creds_;

Loading…
Cancel
Save