本文整理汇总了C++中ACE_CString::length方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_CString::length方法的具体用法?C++ ACE_CString::length怎么用?C++ ACE_CString::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_CString
的用法示例。
在下文中一共展示了ACE_CString::length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: str
Identifier::Identifier (const char *s)
: pv_string (0),
escaped_ (false)
{
bool shift = false;
if (*s == '_')
{
// Only one leading underscore is allowed.
if (s[1] == '_')
{
idl_global->err ()->error0 (UTL_Error::EIDL_UNDERSCORE);
}
shift = true;
this->escaped_ = true;
ACE_CString str (s);
const char *c_prefix = "_cxx_";
if (str.find ("_tc_") == 0
|| str.find ("_tao_") == 0)
{
shift = false;
}
else if (str.find (c_prefix) == 0)
{
str = str.substr (ACE_OS::strlen (c_prefix));
const char *eh_suffix = "_excep";
ACE_CString::size_type pos =
str.length () - ACE_OS::strlen (eh_suffix);
// If we have an AMI exception holder suffix, strip it off.
if (str.find (eh_suffix) == pos)
{
str = str.substr (0, pos);
}
TAO_IDL_CPP_Keyword_Table cpp_key_tbl;
unsigned int len =
static_cast<unsigned int> (str.length ());
const TAO_IDL_CPP_Keyword_Entry *entry =
cpp_key_tbl.lookup (str.c_str (), len);
if (entry != 0)
{
shift = false;
}
}
}
if (shift)
{
this->pv_string = ACE::strnew (s + 1);
}
else
{
this->pv_string = ACE::strnew (s);
}
}
示例2: read
bool Request::read(std::istream& str)
{
ACE_CString cmd (4, '\0');
ACE_CString args (128, '\0');
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 method
ch = str.get ();
while (!ACE_OS::ace_isspace (ch) && ch != eof_ && cmd.length () < MAX_CMD_LENGTH)
{
cmd += ch;
ch = str.get ();
}
if (!ACE_OS::ace_isspace (ch))
return false; // invalid FTP command string
if (ch != '\r' && ch != '\n')
{
// skip whitespace
while (ACE_OS::ace_isspace (str.peek ()))
{
str.get ();
}
// get arguments
ch = str.get ();
while (ch != eof_ && ch != '\r' && ch != '\n' && args.length () < MAX_ARG_LENGTH)
{
args += ch;
ch = str.get ();
}
if (ch != eof_ && ch != '\r' && ch != '\n')
{
return false; // args too long
}
}
if (ch == '\r')
{
str.get ();
}
this->command (cmd);
this->args_ = args;
return true;
}
示例3: catch
void
TAO_Notify_StructuredProxyPushConsumer::load_attrs (const TAO_Notify::NVPList& attrs)
{
SuperClass::load_attrs(attrs);
ACE_CString ior;
if (attrs.load("PeerIOR", ior))
{
CORBA::ORB_var orb = TAO_Notify_PROPERTIES::instance()->orb();
try
{
CosNotifyComm::StructuredPushSupplier_var ps = CosNotifyComm::StructuredPushSupplier::_nil();
if ( ior.length() > 0 )
{
CORBA::Object_var obj = orb->string_to_object(ior.c_str());
ps = CosNotifyComm::StructuredPushSupplier::_unchecked_narrow(obj.in());
}
// minor hack: suppress generating subscription updates during reload.
bool save_updates = this->updates_off_;
this->updates_off_ = true;
this->connect_structured_push_supplier(ps.in());
this->updates_off_ = save_updates;
}
catch (const CORBA::Exception&)
{
// if we can't reconnect to peer, tough...
}
}
}
示例4:
Boolean
StreamSize::write_string(const ACE_CString &x) {
// @@ Leave this method in here, not the `.i' file so that we don't
// have to unnecessarily pull in the `ace/SString.h' header.
return this->write_string(static_cast<ULong> (x.length()),
x.c_str());
}
示例5: 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;
}
示例6: testConstIterator
int testConstIterator()
{
const ACE_CString s1 ("Hello, World");
// Use the advance () method to count number of characters.
size_t count = 0;
for (ACE_CString::CONST_ITERATOR iter (s1); !iter.done (); iter.advance ())
++ count;
if (count != s1.length ())
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("advance () failed")),
1);
// Use the prefix operator to count number of characters.
count = 0;
for (ACE_CString::CONST_ITERATOR iter (s1); !iter.done (); ++ iter)
++ count;
if (count != s1.length ())
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("++ operator failed")),
1);
count = 0;
for (ACE_CString::const_iterator iter = s1.begin (), iter_end = s1.end ();
iter != iter_end; iter ++)
{
++ count;
}
if (count != s1.length ())
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("end () failed")),
1);
ACE_CString::const_iterator iter1 (s1);
if (*iter1 != s1[0])
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("dereference operator failed")),
1);
return 0;
}
示例7: cleanup
void cleanup(PersistenceUpdater::ALLOCATOR* allocator)
{
if (name.length() > 0)
{
char* strMemory = const_cast<char*>(name.fast_rep());
name.fast_clear();
allocator->free(strMemory);
}
if (dataType.length() > 0)
{
char* strMemory = const_cast<char*>(dataType.fast_rep());
dataType.fast_clear();
allocator->free(strMemory);
}
allocator->free(topicQos.second.second);
}
示例8: 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;
}
示例9:
ssize_t
ACE::HTBP::Inside_Squid_Filter::recv_data_header (ACE::HTBP::Channel *ch)
{
if (this->http_code() != 200 && this->http_code() != 0)
{
if (ACE::debug())
ACE_ERROR ((LM_ERROR,
ACE_TEXT("HTBP::Inside_Squid_Filter::recv_data_header, ")
ACE_TEXT("non-OK result code %d recvd\n"),
this->http_code()));
errno = ch->consume_error () ? EINVAL : EWOULDBLOCK;
return 0;
}
char *header_end = this->header_complete(ch);
if (header_end == 0)
{
if (ch->state() != ACE::HTBP::Channel::Closed)
{
ch->state (ACE::HTBP::Channel::Header_Pending);
errno = EWOULDBLOCK;
}
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT("HTBP::Inside_Squid_Filter::")
ACE_TEXT("recv_data_header, ")
ACE_TEXT("header not complete\n")),
0);
}
char *start = ch->leftovers().rd_ptr();
ACE_CString token = "Content-Length: ";
char *tpos = ACE_OS::strstr(start,token.c_str());
char *nl = ACE_OS::strchr (start,'\n');
if (tpos != 0)
{
tpos += token.length();
*nl = 0;
ch->data_len (ACE_OS::strtol(tpos,0,10));
start = nl+1;
}
ch->leftovers().rd_ptr(header_end);
if (this->http_code() != 200)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT("HTBP::Inside_Squid_Filter::recv_data_header, ")
ACE_TEXT("non-OK result code %d recvd\n"),
this->http_code()));
errno = ch->consume_error () ? EINVAL : EWOULDBLOCK;
return 0;
}
ch->state(ACE::HTBP::Channel::Data_Queued);
return 1;
}
示例10: mde
int
Locator_Repository::setup_multicast (ACE_Reactor* reactor, const char* ior)
{
ACE_ASSERT (reactor != 0);
#if defined (ACE_HAS_IP_MULTICAST)
TAO_ORB_Core* core = TAO_ORB_Core_instance ();
// See if the -ORBMulticastDiscoveryEndpoint option was specified.
ACE_CString mde (core->orb_params ()->mcast_discovery_endpoint ());
if (mde.length () != 0)
{
if (this->ior_multicast_.init (ior,
mde.c_str (), TAO_SERVICEID_IMPLREPOSERVICE) == -1)
{
return -1;
}
}
else
{
// Port can be specified as param, env var, or default
CORBA::UShort port =
core->orb_params ()->service_port (TAO::MCAST_IMPLREPOSERVICE);
if (port == 0)
{
// Check environment var. for multicast port.
const char* port_number = ACE_OS::getenv ("ImplRepoServicePort");
if (port_number != 0)
port = static_cast<CORBA::UShort> (ACE_OS::atoi (port_number));
}
if (port == 0)
port = TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT;
if (this->ior_multicast_.init (ior, port,
ACE_DEFAULT_MULTICAST_ADDR, TAO_SERVICEID_IMPLREPOSERVICE) == -1)
{
return -1;
}
}
// Register event handler for the ior multicast.
if (reactor->register_handler (&this->ior_multicast_,
ACE_Event_Handler::READ_MASK) == -1)
{
if (this->opts_.debug() > 0)
ORBSVCS_DEBUG ((LM_DEBUG, "ImR: cannot register Event handler\n"));
return -1;
}
#else /* ACE_HAS_IP_MULTICAST*/
ACE_UNUSED_ARG (reactor);
ACE_UNUSED_ARG (ior);
#endif /* ACE_HAS_IP_MULTICAST*/
return 0;
}
示例11: GetCmd
bool GetCmd(const ACE_CString& input, ACE_CString& cmd)
{
size_t nEndCommand = 0;
while(nEndCommand < input.length() &&
input[nEndCommand] != ' '
&& input[nEndCommand] != '\r' &&
input[nEndCommand] != '\n')nEndCommand++;
if(nEndCommand)
cmd = input.substr(0,nEndCommand);
return nEndCommand>0;
}
示例12: passwd_callback
int SSL_CallbackManager::passwd_callback (char* buf, int size, int /*rwflag*/, void* user_data)
{
if (user_data == 0)
return 0;
SSL_CallbackManager* cbmngr = reinterpret_cast<SSL_CallbackManager*> (user_data);
ACE_CString pwd;
cbmngr->passwd_callback (pwd);
if (!pwd.empty ())
{
ACE_OS::strncpy (buf, pwd.c_str (), size);
buf[size - 1] = '\0';
if (size > ACE_Utils::truncate_cast<int> (pwd.length ()))
size = ACE_Utils::truncate_cast<int> (pwd.length ());
return size;
}
else
return 0;
}
示例13: GetCmdLine
bool GetCmdLine(const ACE_CString& input, ACE_CString& cmd, ACE_CString& remain_input)
{
if(input.find('\n') != ACE_TString::npos)
{
size_t pos = input.find('\n');
cmd = input.substr(0, pos+1);
size_t len = input.length();
remain_input = input.substr(pos+1, len-pos+1);
return true;
}
return false;
}
示例14:
void
ImR_DSI_ResponseHandler::send_ior (const char *pior)
{
ACE_CString ior = pior;
// Check that the returned ior is the expected partial ior with
// missing ObjectKey.
if (ior.find ("corbaloc:") == 0 && ior[ior.length () -1] == '/')
{
ior += this->key_str_.in();
CORBA::Object_var forward_obj = this->orb_->string_to_object (ior.c_str ());
if (!CORBA::is_nil (forward_obj.in ()))
{
this->resp_->invoke_location_forward(forward_obj.in(), false);
delete this;
return;
}
else
{
if (ImR_Locator_i::debug () > 1)
{
ORBSVCS_ERROR ((LM_ERROR,
ACE_TEXT ("(%P|%t) ImR_DSI_ResponseHandler::send_ior (): Forward_to ")
ACE_TEXT ("reference is nil for key <%C> server_name <%C>\n"),
key_str_.in (), server_name_.in ()));
}
}
}
else
{
if (ImR_Locator_i::debug () > 1)
{
ORBSVCS_ERROR ((LM_ERROR,
ACE_TEXT ("(%P|%t) ImR_DSI_ResponseHandler::send_ior (): Invalid corbaloc ior for key <%C> server_name <%C> IOR <%C>\n"),
key_str_.in (), server_name_.in (), pior));
}
}
this->invoke_excep_i (new CORBA::OBJECT_NOT_EXIST
(CORBA::SystemException::_tao_minor_code
( TAO_IMPLREPO_MINOR_CODE, 0),
CORBA::COMPLETED_NO));
}
示例15:
bool
FE_Utils::is_include_file_found (ACE_CString & inc_file,
UTL_String * idl_file_name)
{
char abspath[MAXPATHLEN] = "";
char *full_path = 0;
// If the include path has literal "s (because of an include
// of a Windows path with spaces), we must remove them here.
const char *tmp_inc_file = inc_file.c_str ();
if (tmp_inc_file
&& FE_Utils::hasspace (tmp_inc_file)
&& tmp_inc_file[0] == '\"')
{
inc_file =
inc_file.substr (1, inc_file.length () - 2);
}
inc_file += ACE_DIRECTORY_SEPARATOR_STR_A;
inc_file += idl_file_name->get_string ();
full_path =
ACE_OS::realpath (inc_file.c_str (), abspath);
if (full_path != 0)
{
FILE *test = ACE_OS::fopen (abspath, "r");
if (test == 0)
{
return false;
}
else
{
// Overwrite inc_file with abspath since the later
// is normalized to the native OS representation.
inc_file = abspath;
ACE_OS::fclose (test);
return true;
}
}
return false;
}