当前位置: 首页>>代码示例>>C++>>正文


C++ ACE_CString::c_str方法代码示例

本文整理汇总了C++中ACE_CString::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_CString::c_str方法的具体用法?C++ ACE_CString::c_str怎么用?C++ ACE_CString::c_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ACE_CString的用法示例。


在下文中一共展示了ACE_CString::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: read

    bool Response::read(istream& str)
      {
        ACE_CString version;
        ACE_CString status;
        ACE_CString reason;

        int ch =  str.peek ();
        if (ch == eof_)
          {
            str.get (); // skip to eof
            return false;
          }
        // skip whitespace
        while (ACE_OS::ace_isspace (str.peek ()))
          {
            str.get ();
          }
        // get version
        ch = this->read_ws_field (str, version, MAX_VERSION_LENGTH);
        if (ch == eof_  || !ACE_OS::ace_isspace (ch))
          return false; // invalid HTTP version string
        // skip whitespace
        while (ACE_OS::ace_isspace (str.peek ()))
          {
            str.get ();
          }
        // get status
        ch = this->read_ws_field (str, status, MAX_STATUS_LENGTH);
        if (ch == eof_ || !ACE_OS::ace_isspace (ch))
          return false; // invalid HTTP status code
        // skip whitespace
        while (ACE_OS::ace_isspace (str.peek ()))
          {
            str.get ();
          }
        // get reason
        ch = this->read_field (str, reason, MAX_REASON_LENGTH, '\r');
        if (ch == '\r')
          ch = str.get (); // get lf
        if (ch != '\n')
          return false; // HTTP reason string too long

        INET_DEBUG (6, (LM_DEBUG, DLINFO
                        ACE_TEXT ("ACE_INet_HTTP: <-- %C %C %C\n"),
                        version.c_str (),
                        status.c_str (),
                        reason.c_str()));

        // get header lines
        if (!Header::read (str))
          return false;
        // skip empty line
        ch = str.get ();
        while (ch != '\n' && ch != eof_)
          ch = str.get ();
        this->set_version(version);
        this->status_.set_status (status);
        this->status_.set_reason (reason);
        return true;
      }
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:60,代码来源:HTTP_Response.cpp

示例2: return

int
TAO::SSLIOP::Protocol_Factory::match_prefix (const ACE_CString &prefix)
{
  // Check for the proper prefix for this protocol.
  return (ACE_OS::strcasecmp (prefix.c_str (), ::the_prefix[0]) == 0)
     || (ACE_OS::strcasecmp (prefix.c_str (), ::the_prefix[1]) == 0);
}
开发者ID:asdlei00,项目名称:ACE,代码行数:7,代码来源:SSLIOP_Factory.cpp

示例3:

//
// handle_activate
//
int IOR_File_Trait::
handle_activate (::CORBA::Object_ptr obj, const ACE_CString & value)
{
  OASIS_TAO_TRACE ("int IOR_File_Trait::handle_activate (::CORBA::Object_ptr, const ACE_CString &)");

  // Get the ORB for this object.
  ::CORBA::ORB_var orb = obj->_get_orb ();

  if (::CORBA::is_nil (orb.in ()))
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("%T (%t) - %M - failed to resolve ORB\n")),
                       1);

  // Convert the object to a string.
  ::CORBA::String_var str = orb->object_to_string (obj);

  // Write the string to the specified file.
  std::ofstream file;
  file.open (value.c_str ());

  if (!file.is_open ())
    ACE_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT ("%T (%t) - %M - failed to open %s for writing\n"),
                       value.c_str ()),
                       1);

  file << str.in ();
  file.close ();

  return 0;
}
开发者ID:EnasAlikhashashashneh,项目名称:OASIS,代码行数:34,代码来源:IOR_File_Trait.cpp

示例4: if

int
TAO::SSLIOP::Acceptor::parse_options_i (int &argc, ACE_CString ** argv)
{
  //first, do the base class parser, then parse the leftovers.
  int result = this->IIOP_SSL_Acceptor::parse_options_i(argc,argv);
  if (result == -1)
    return result;

  // then parse out our own options.
  int i = 0;
  while (i < argc)
    {
      // since the base class has already iterated over the list once,
      // it has vound any ill-formed options. Therefore we don't need
      // to do that again here.
      int slot = argv[i]->find ("=");
      ACE_CString name = argv[i]->substring (0, slot);
      ACE_CString value = argv[i]->substring (slot + 1);

      if (name == "priority")
        {
          ORBSVCS_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("TAO (%P|%t) Invalid SSLIOP endpoint format: ")
                             ACE_TEXT ("endpoint priorities no longer supported.\n"),
                             value.c_str ()),
                            -1);
        }
      else if (ACE_OS::strcmp (name.c_str (), "ssl_port") == 0)
        {
          int ssl_port = ACE_OS::atoi (value.c_str ());

          if (ssl_port >= 0 && ssl_port < 65536)
            this->ssl_component_.port = ssl_port;
          else
            ORBSVCS_ERROR_RETURN ((LM_ERROR,
                               ACE_TEXT ("TAO (%P|%t) Invalid ")
                               ACE_TEXT ("IIOP/SSL endpoint ")
                               ACE_TEXT ("port: <%s>\n"),
                               value.c_str ()),
                              -1);
        }
      else
        {
          // the name is not known, skip to the next option
          i++;
          continue;
        }
      // at the end, we've consumed this argument. Shift the list and
      // put this one on the end. This technique has the effect of
      // putting them in reverse order, but that doesn't matter, since
      // these arguments are only whole strings.
      argc--;
      ACE_CString *temp = argv[i];
      for (int j = i; j <= argc-1; j++)
        argv[j] = argv[j+1];
      argv[argc] = temp;

    }
  return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:60,代码来源:SSLIOP_Acceptor.cpp

示例5:

int
Fill_ACE_QoS::fill_duplex_qos (ACE_QoS &ace_qos,
                               const ACE_CString &recv_flow_name,
                               const ACE_CString &send_flow_name)
{
  ACE_Flow_Spec *send_flow_spec = 0;
  ACE_Flow_Spec *recv_flow_spec = 0;

  if (this->map ().find (recv_flow_name, recv_flow_spec) != 0)
    ACE_ERROR_RETURN ((LM_DEBUG,
                       "Unable to find a FlowSpec with name %s",
                       recv_flow_name.c_str ()),
                      -1);

  if (this->map ().find (send_flow_name, send_flow_spec) != 0)
    ACE_ERROR_RETURN ((LM_DEBUG,
                       "Unable to find a FlowSpec with name %s",
                       send_flow_name.c_str ()),
                      -1);

  ace_qos.receiving_flowspec (recv_flow_spec);
  ace_qos.sending_flowspec (send_flow_spec);
  ace_qos.provider_specific (Fill_ACE_QoS::iov_);

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:26,代码来源:Fill_ACE_QoS.cpp

示例6: fname

void
MPC_Generator::write_prolog (const ACE_CString& path)
{
  ACE_CString fname (path + "/" + mpcfilename_);
  ACE_DEBUG ((LM_DEBUG, "writing file %s\n",fname.c_str()));
  mpcfile_.open(fname.c_str());
  if (!mpcfile_)
    ACE_DEBUG ((LM_DEBUG,"mpc file open failed\n"));

  mpcfile_
    << "// Generated mpc file for producing a subset of the "
    << libname_ << " library " << endl << endl
    << "project(" << libname_ << "_subset)";

  this->write_baseprojects ();

  mpcfile_
    << " {" << endl
    << "  sharedname   = " << libname_ << "_subset" << endl
    << "  pch_header   = " << endl
    << "  pch_source   = " << endl;

  this->write_projectinfo ();

  mpcfile_ << endl
           << "  Source_Files {" << endl;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:27,代码来源:Library.cpp

示例7:

 void
 Sender_exec_i::tick ()
 {
   // Start writing after DataWriter find first DataReader that matched the
   // Topic It is still possible that other Readers aren't yet ready to
   // receive data, for that case in the profile the durability is set to
   // TRANSIENT_DURABILITY_QOS, so each Reader should receive each message.
   if(this->ready_to_start_.value())
     {
       if (this->iteration_ < this->iterations_)
         {
           Hello::Writer_var writer =
             this->ciao_context_->get_connection_info_in_data ();
           if (! ::CORBA::is_nil (writer.in ()))
             {
               DDSHello new_msg;
               ACE_CString msg = create_message (this->msg_);
               new_msg.hello = msg.c_str ();
               new_msg.iterator = ++this->iteration_;
               writer->write_one (new_msg, ::DDS::HANDLE_NIL);
               ACE_DEBUG ((LM_DEBUG, "Sender_exec_i::tick - "
                                     "Written sample: <%C> - <%u>\n",
                                     msg.c_str (),
                                     new_msg.iterator));
             }
         }
       else
         {
           // We are done
           this->stop ();
         }
      }
 }
开发者ID:Yijtx,项目名称:ACE,代码行数:33,代码来源:Hello_Sender_exec.cpp

示例8: TestReceiveRemoteException

void ClientErrorComponent::TestReceiveRemoteException() 
{
    ACS_TRACE("ClientErrorComponent::TestReceiveRemoteException");

    if (CORBA::is_nil(foo_m.in()) == true)
	{
	throw ACSErrTypeCommon::CouldntAccessComponentExImpl(
				   __FILE__, __LINE__,
				   "ClientErrorComponent::TestReceiveRemoteException");
	}
    ACS_SHORT_LOG((LM_INFO, "Example 1: Calls a method that throws an exception."));
    try
	{
	foo_m->badMethod(5);
        ACS_SHORT_LOG((LM_INFO, "UNEXPECTED: should have thrown an exception"));
	}
    catch(ACSErrTypeCommon::GenericErrorEx &ex)
	{
	ACSErrTypeCommon::GenericErrorExImpl badMethodEx(ex,
				   __FILE__, __LINE__,
				   "ClientErrorComponent::TestReceiveRemoteException");
	badMethodEx.setErrorDesc("badMethod has thrown the expected exception");
	badMethodEx.log();

	ACS::Time timeStamp = badMethodEx.getTimeStamp();
	ACE_CString tString = getStringifiedUTC(timeStamp);
	ACS_DEBUG_PARAM("ClientErrorComponent::TestReceiveRemoteException", 
			"Time of the exception: %s\n", tString.c_str());
	}
    catch(CORBA::SystemException &ex)
	{
	ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(
				   __FILE__, __LINE__,
				   "ClientErrorComponent::TestReceiveRemoteException");
	corbaProblemEx.setMinor(ex.minor());
	corbaProblemEx.setCompletionStatus(ex.completed());
	corbaProblemEx.setInfo(ex._info().c_str());
	corbaProblemEx.log();

	//Is this really necessary? The exceptions already have a timeStamp
	ACS::Time timeStamp = corbaProblemEx.getTimeStamp();
	ACE_CString tString = getStringifiedUTC(timeStamp);
	ACS_DEBUG_PARAM("ClientErrorComponent::TestReceiveRemoteException", 
			"Time of the CORBA exception: %s\n", tString.c_str());
	}
    catch(...)
	{
	ACSErrTypeCommon::GenericErrorExImpl badMethodEx(__FILE__, __LINE__,
		      				 "ClientErrorComponent::TestReceiveRemoteException");
	badMethodEx.setErrorDesc("badMethod has thrown an UNEXPECTED exception");
	badMethodEx.log();

	ACS::Time timeStamp = badMethodEx.getTimeStamp();
	ACE_CString tString = getStringifiedUTC(timeStamp);
	ACS_DEBUG_PARAM("ClientErrorComponent::TestReceiveRemoteException", 
			"Time of the unexpected exception: %s\n", tString.c_str());
	}

}
开发者ID:ACS-Community,项目名称:ACS,代码行数:59,代码来源:acsexmplClientErrorComponent.cpp

示例9: jo_key

Server_Info_Ptr
Locator_Repository::get_active_server (const ACE_CString& name, int pid)
{
  sync_load ();
  ACE_CString key;
  Server_Info_Ptr si;
  if (name.length() == 0)
    {
      return si;
    }
  Server_Info::fqname_to_key (name.c_str(), key);
  servers ().find (key, si);
  if (si.null())
    {
      if (this->opts_.debug() > 5)
        {
          ORBSVCS_DEBUG ((LM_DEBUG,
                          ACE_TEXT ("(%P|%t) get_active_server could not find %C\n"),
                          name.c_str()));
        }
      si = find_by_poa (key);
      if (si.null())
        {
          if (name.find ("JACORB:") == ACE_CString::npos)
            {
              ACE_CString jo_key ("JACORB:");
              ACE_CString::size_type pos = name.find (':');
              if (pos == ACE_CString::npos)
                {
                  jo_key += name;
                }
              else
                {
                  jo_key += name.substring (0, pos);
                  jo_key += '/';
                  jo_key += name.substring (pos+1);
                }
              return this->get_active_server (jo_key, pid);
            }
          else
            {
              return si;
            }
        }
    }

  if (pid != 0 && si->pid != 0 && si->pid != pid)
    {
      if (this->opts_.debug() > 5)
        {
          ORBSVCS_DEBUG ((LM_DEBUG,
                          ACE_TEXT ("(%P|%t) get_active_server could not")
                          ACE_TEXT (" find %C, %d != %d\n"),
                          name.c_str(), pid, si->pid));
        }
      si.reset ();
    }
  return si;
}
开发者ID:newle,项目名称:ATCD,代码行数:59,代码来源:Locator_Repository.cpp

示例10:

void
TAO_Notify_Tests_Command_Builder::_register (ACE_CString command_factory_name, TAO_Notify_Tests_Command_Factory* command_factory)
{
  if (this->factory_map_.bind (command_factory_name, command_factory) == -1)
    ACE_DEBUG ((LM_DEBUG, "Failed to register command factory for %s\n", command_factory_name.c_str ()));
  else
    ACE_DEBUG ((LM_DEBUG, "Registered command factory for %s\n", command_factory_name.c_str ()));
}
开发者ID:CCJY,项目名称:ATCD,代码行数:8,代码来源:Command_Builder.cpp

示例11: read

    bool HeaderBase::read(std::istream& str)
      {

        ACE_CString name (64, '\0');
        ACE_CString value (128, '\0');
        int ch = str.peek ();
        while (ch != eof_ && ch != '\r' && ch != '\n')
          {
            name.fast_clear ();
            value.fast_clear ();
            // parse name
            ch = this->read_field (str, name, MAX_NAME_LENGTH, ':');
            if (ch == '\n')
              {
                ch = str.get ();
                continue; // ignore invalid headers
              }
            if (ch != ':')
              {
                return false; // name too long/missing colon; cannot continue
              }

            // skip leading whitespace before next field
            while (ACE_OS::ace_isspace (str.peek ()))
              {
                ch = str.get ();
              }

            // parse value
            ch = this->read_field (str, value, MAX_VALUE_LENGTH, '\r');
            if (ch == '\r')
              ch = str.get (); // get lf
            if (ch != '\n')
              return false; // value too long/no crlf found; cannot continue

            // followup lines starting with ws are continuations of the value
            // and must be appended
            ch = str.peek ();
            while (ch == ' ' || ch == '\t')
            {
              ch = this->read_field (str, value, MAX_VALUE_LENGTH, '\r');
              if (ch == '\r')
                ch = str.get (); // get lf
              if (ch != '\n')
                return false; // multiline value too long/no crlf; cannot continue

              ch = str.peek ();
            }

            this->add (name, value);

            INET_DEBUG (9, (LM_DEBUG, DLINFO
                            ACE_TEXT ("ACE_INet_HTTP: <-+ %C: %C\n"),
                            name.c_str (),
                            value.c_str ()));
          }
        return true;
      }
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:58,代码来源:HeaderBase.cpp

示例12: satc

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  if (parse_args (argc,
                  argv) == -1)
    return -1;

  try
    {
      ACE_Argv_Type_Converter satc (argc, argv);
      CORBA::ORB_var sorb =
        CORBA::ORB_init (satc.get_argc (),
                         satc.get_TCHAR_argv (),
                         server_orb.c_str ());

      ACE_Manual_Event me;
      Server_Task server_task (output,
                               sorb.in (),
                               me,
                               ACE_Thread_Manager::instance ());

      if (server_task.activate (THR_NEW_LWP | THR_JOINABLE,
                                1,
                                1) == -1)
        {
          ACE_ERROR ((LM_ERROR, "Error activating server task\n"));
        }

      // Wait for the server thread to do some processing
      me.wait ();

      ACE_Argv_Type_Converter catc (argc, argv);
      CORBA::ORB_var corb =
        CORBA::ORB_init (catc.get_argc (),
                         catc.get_TCHAR_argv (),
                         client_orb.c_str ());

      Client_Task client_task (input,
                               corb.in (),
                               syncMode,
                               ACE_Thread_Manager::instance ());

      if (client_task.activate (THR_NEW_LWP | THR_JOINABLE,
                                1,
                                1) == -1)
        {
          ACE_ERROR ((LM_ERROR, "Error activating client task\n"));
        }

      ACE_Thread_Manager::instance ()->wait ();
    }
  catch (const CORBA::Exception&)
    {
      // Ignore exceptions..
    }
  return 0;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:57,代码来源:Collocated_Test.cpp

示例13: INTERNAL

CORBA::Boolean
CORBA::ValueBase::_tao_write_repository_id (TAO_OutputCDR &strm,
                                            ACE_CString& id)
{
#ifdef TAO_HAS_VALUETYPE_OUT_INDIRECTION

  VERIFY_MAP (TAO_OutputCDR, repo_id_map, Repo_Id_Map);
  char* pos = 0;
  if (strm.get_repo_id_map ()->get()->find (id, pos) == 0)
  {
    if (!strm.write_long (TAO_OBV_GIOP_Flags::Indirection_tag))
      {
        return false;
      }
    CORBA::Long offset= -strm.offset (pos);
    if (TAO_debug_level)
      {
        TAOLIB_DEBUG ((LM_DEBUG,
          ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_write_repository_id,  id %C indirection %d\n"),
          id.c_str(), offset));
      }
    if (!strm.write_long (offset))
      {
        return false;
      }
  }
  else
  {
    if (strm.align_write_ptr (ACE_CDR::LONG_SIZE) != 0)
      {
        throw CORBA::INTERNAL ();
      }
    if (strm.get_repo_id_map ()->get ()->bind (id, strm.current()->wr_ptr ()) != 0)
      {
        throw CORBA::INTERNAL ();
      }
    if (TAO_debug_level)
      {
        TAOLIB_DEBUG ((LM_DEBUG,
          ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_write_repository_id, bound %C - %x\n"),
          id.c_str (), strm.current()->wr_ptr ()));
      }
    if (! strm.write_string (id.c_str ()))
      {
        return false;
      }
  }
#else
  if (! strm.write_string (id.c_str ()))
    {
      return 0;
    }
#endif

  return 1;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:56,代码来源:ValueBase.cpp

示例14: sizeof

bool
FE_Utils::validate_orb_include (UTL_String * idl_file_name)
{
  char foundpath[MAXPATHLEN] = "";

  {
    // Check in the current folder.
    char abspath[MAXPATHLEN] = "";
    ACE_CString cwd_path = ACE_OS::getcwd (abspath,
                                           sizeof (abspath) / sizeof (char));
    if (FE_Utils::is_include_file_found (cwd_path, idl_file_name))
      {
        ACE_OS::strcpy (foundpath, cwd_path.c_str ());
      }
  }

  for (IDL_GlobalData::Unbounded_Paths_Queue_Iterator iter (
         idl_global->include_paths ());
       !iter.done ();
       iter.advance ())
    {
      IDL_GlobalData::Include_Path_Info *path_info = 0;
      iter.next (path_info);

      ACE_CString partial = path_info->path_;

      // We don't need to check anything if the file is already
      // found and the folder where are currently checking is
      // provided by user.
      if (foundpath[0] != 0 && !path_info->is_system_)
        {
          continue;
        }

      if (FE_Utils::is_include_file_found (partial, idl_file_name))
        {
          if (path_info->is_system_)
            {
              if (foundpath[0] == 0 ||
                  ACE_OS::strcmp (foundpath, partial.c_str ()) == 0)
                {
                  return true;
                }
            }
          else
            {
              // We can fill in foundpath here since we are sure
              // that it was not set before. Check above ensures that.
              ACE_OS::strcpy (foundpath, partial.c_str ());
              continue;
            }
        }
    }

  return false;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:56,代码来源:fe_utils.cpp

示例15: fromString

bool BACIValue::fromString(const ACE_CString value, bool specifyType)
{

  ACE_CString strType;
  ACE_CString strContent;
  const char *szType;
  const char *szContent;
  unsigned long ulBound = 0;

  if (specifyType)
    {
      ACE_CString::size_type nPos0 = value.find('<');
      ACE_CString::size_type nPos1 = value.find(':');
      ACE_CString::size_type nPos2 = value.find('>');

      if((nPos1 != ACE_CString::npos) && (nPos1 < (nPos2-1)))
		ulBound = atoi(value.substr(nPos1+1, nPos2-nPos1-1).c_str());
      else
		nPos1 = nPos2;

      strType = value.substr(nPos0+1, nPos1-nPos0-1);
      strContent = value.substr(nPos2+1);
      szType = strType.c_str();
      szContent = strContent.c_str();

    }
  else
    {
      strType = typeName[type_m];
      strContent = value;
      szType = strType.c_str();
      szContent = strContent.c_str();
    }

/// User defined

  // special threathment for string (no conversion needed)
  if(strType.compare(BACIValue::typeName[type_string]) == 0)
    {
      if ((ulBound != 0) && (strContent.length() > ulBound))
	return false;
      if(!setType(type_string, ulBound))
	return 0;
      return stringValue(szContent);
    }

   PROCESS_INLINE_TYPE(double, BACIdouble)
   PROCESS_INLINE_TYPE(float, BACIfloat)
   PROCESS_INLINE_TYPE(long, BACIlong)
   PROCESS_INLINE_TYPE(longLong, BACIlongLong)
   PROCESS_INLINE_TYPE(uLongLong, BACIuLongLong)
//TBDeleted   PROCESS_INLINE_TYPE(pattern, BACIpattern)

  return false;

}
开发者ID:,项目名称:,代码行数:56,代码来源:


注:本文中的ACE_CString::c_str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。