⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htbp_environment.cpp

📁 ACE自适配通信环境(ADAPTIVE Communication Environment)是可以自由使用、开放源码的面向对象(OO)框架(Framework)
💻 CPP
字号:
// HTBP_Environment.cpp,v 1.2 2005/11/27 12:11:35 ossama Exp#include "HTBP_Environment.h"ACE_RCSID (HTBP,       	   ACE_HTBP_Environment,	   "HTBP_Environment.cpp,v 1.2 2005/11/27 12:11:35 ossama Exp")ACE_BEGIN_VERSIONED_NAMESPACE_DECLACE::HTBP::Environment::Environment (ACE_Configuration *config,                                     int using_registry,                                     const ACE_TCHAR *persistent_file)  : config_ (config),    imp_exp_ (0),    own_config_ (config != 0){  initialize (using_registry,              persistent_file);}ACE::HTBP::Environment::~Environment (){  if (!own_config_)    this->clear();  else    delete this->config_;  delete this->imp_exp_;}voidACE::HTBP::Environment::clear (){  if (this->config_)    this->config_->remove_section (config_->root_section (),                                   ACE_TEXT("htbp"),                                   1);}intACE::HTBP::Environment::initialize (int use_registry,                                    const ACE_TCHAR *persistent_file){  if (this->config_ == 0)    {      int result = -1;      if (use_registry)        result = this->open_registry_config();      if (result == -1)        result = this->open_persistent_config (persistent_file);      if (result != 0)        {          ACE_ERROR_RETURN ((LM_ERROR,                             ACE_TEXT("ACE::HTBP::Environment::initialize (): ")                             ACE_TEXT("Open Config failed")),                            -1);        }    }  ACE_NEW_RETURN (this->imp_exp_,                  ACE_Ini_ImpExp (*this->config_),                  -1);  if (this->config_->open_section (config_->root_section (),				   ACE_TEXT("htbp"), 1,                                   this->htbp_key_) != 0)    ACE_ERROR_RETURN ((LM_ERROR,                       ACE_TEXT("ACE::HTBP::Environment::initialize (). ")                       ACE_TEXT("Open HTBP Section failed")),                      -1);  return 0;}intACE::HTBP::Environment::open_registry_config (){#if defined (ACE_WIN32)  HKEY root =    ACE_Configuration_Win32Registry::resolve_key    (HKEY_LOCAL_MACHINE,ACE_TEXT("Software\\HTBP\\Environment"));  ACE_NEW_RETURN (this->config_,                  ACE_Configuration_Win32Registry (root),                  -1);  return 0;#else  errno = ENOTSUP;  return -1;#endif /* ACE_WIN32 */}intACE::HTBP::Environment::open_persistent_config (const ACE_TCHAR *persistent_file){  ACE_Configuration_Heap *heap;  ACE_NEW_RETURN (heap,                  ACE_Configuration_Heap,                  -1);  // do this before trying to open so it isn't leaked if the open fails.  this->config_ = heap;  if (persistent_file == 0)    heap->open();  else    if (heap->open (persistent_file) != 0)      ACE_ERROR_RETURN (( LM_ERROR,                          ACE_TEXT ("ACE::HTBP::Environment::open_config: %p\n"),                          persistent_file),                        -1 );  return 0;}intACE::HTBP::Environment::get_htid_url (ACE_TString &htid_url) const{  return this->config_->get_string_value (this->htbp_key_,                                          ACE_TEXT("htid_url"),                                          htid_url);}intACE::HTBP::Environment::set_htid_url (const ACE_TCHAR *htid_generator_url){  return this->config_->set_string_value (this->htbp_key_,                                          ACE_TEXT("htid_url"),                                          htid_generator_url);}intACE::HTBP::Environment::get_htid_via_proxy (int &via_proxy) const{  return this->config_->get_integer_value (this->htbp_key_,                                           ACE_TEXT("htid_via_proxy"),                                           (u_int &)via_proxy);}intACE::HTBP::Environment::set_htid_via_proxy (int via_proxy){  return this->config_->set_integer_value (this->htbp_key_,                                           ACE_TEXT("htid_via_proxy"),                                           (u_int)via_proxy);}intACE::HTBP::Environment::get_proxy_host (ACE_TString &proxy_host) const{  return this->config_->get_string_value (this->htbp_key_,                                          ACE_TEXT("proxy_host"),                                          proxy_host);}intACE::HTBP::Environment::set_proxy_host (const ACE_TCHAR *proxy_host){  return this->config_->set_string_value (this->htbp_key_,                                          ACE_TEXT("proxy_host"),                                          proxy_host);}intACE::HTBP::Environment::get_proxy_port (unsigned int &proxy_port) const{  int result = this->config_->get_integer_value (this->htbp_key_,                                                 ACE_TEXT("proxy_port"),                                                 proxy_port);  if (result != 0)    {      ACE_TString port_str;      result = this->config_->get_string_value (this->htbp_key_,                                                ACE_TEXT("proxy_port"),                                                port_str);      if (result == 0)        proxy_port = ACE_OS::strtol(port_str.c_str(),0,10);    }  return result;}intACE::HTBP::Environment::set_proxy_port (unsigned int proxy_port){  return this->config_->set_integer_value (this->htbp_key_,                                           ACE_TEXT("proxy_port"),                                           proxy_port);}intACE::HTBP::Environment::import_config (const ACE_TCHAR *filename){  return this->imp_exp_->import_config (filename);}intACE::HTBP::Environment::export_config (const ACE_TCHAR *filename){  return this->imp_exp_->export_config (filename);}ACE_END_VERSIONED_NAMESPACE_DECL

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -