本文整理汇总了C++中PString::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ PString::GetSize方法的具体用法?C++ PString::GetSize怎么用?C++ PString::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PString
的用法示例。
在下文中一共展示了PString::GetSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendDTMF
bool Manager::SendDTMF(const PString &dtmf)
{
PSafePtr<OpalCall> call = FindCallWithLock(currentCallToken);
if (!call) {
std::cerr << "no call found with token="
<< currentCallToken << std::endl;
return false;
}
bool ok = false;
PSafePtr<OpalConnection> connection = call->GetConnection(
listenmode ? 0 : 1);
if (connection) {
size_t i = 0;
for (; i < dtmf.GetSize() - 1; i++) {
if (!connection->SendUserInputTone(dtmf[i], 0))
break;
else {
// sleep a while
std::cout << "sent DTMF: [" << dtmf[i] << "]" << std::endl;
struct timespec tp;
tp.tv_sec = 0;
tp.tv_nsec = 500 * 1000 * 1000; // half a second
nanosleep (&tp, 0);
}
}
ok = (i == dtmf.GetSize() - 1 ? true : false);
}
if (!ok)
std::cerr << "dtmf sending failed\n" << std::endl;
return ok;
}
示例2:
bool
ScriptablePluginObject::Invoke(NPIdentifier name, const NPVariant *args,
uint32_t argCount, NPVariant *result)
{
if (name == sendCmd_id)
{
if ( argCount < 1 )
{
return false;
}
PString strParam = "";
NPString npStr = NPVARIANT_TO_STRING( args[0] );
for (unsigned int i=0; i<npStr.utf8length; i++)
{
strParam += npStr.utf8characters[ i ];
}
PString strResult = g_NativeLogic.InvokeFunction( strParam );
char* pszName = (char*)NPN_MemAlloc( strResult.GetSize() + 1 );
strcpy( pszName, strResult );
STRINGZ_TO_NPVARIANT(pszName, *result);
return PR_TRUE;
}
return PR_FALSE;
}
示例3: Init
bool Manager::Init(PArgList &args)
{
std::cout << __func__ << std::endl;
// Parse various command line arguments
args.Parse(
"u-user:"
"c-password:"
"l-localaddress:"
"o-opallog:"
"p-listenport:"
"P-protocol:"
"R-register:"
"x-execute:"
"f-file:"
"g-gatekeeper:"
"w-gateway:"
"h-help:"
);
if (args.HasOption('h')) {
print_help();
return false;
}
// enable opal logging if requested.
if (args.HasOption('o'))
PTrace::Initialise(5, args.GetOptionString('o'));
if (!args.HasOption('P')) {
std::cerr << "please define a protocol to use!" << std::endl;
return false;
}
if (args.HasOption('p')) {
TPState::Instance().SetListenPort(
args.GetOptionString('p').AsInteger());
}
if (args.HasOption('l')) {
TPState::Instance().SetLocalAddress(args.GetOptionString('l'));
}
string protocol = stringify(args.GetOptionString('P'));
if (!protocol.compare("sip")) {
cout << "initialising SIP endpoint..." << endl;
sipep = new SIPEndPoint(*this);
sipep->SetRetryTimeouts(10000, 30000);
sipep->SetSendUserInputMode(OpalConnection::SendUserInputAsRFC2833);
// AddRouteEntry("pc:.* = sip:<da>");
// AddRouteEntry("sip:.* = pc:<db>");
AddRouteEntry("local:.* = sip:<da>");
AddRouteEntry("sip:.* = local:<db>");
if (args.HasOption('u')) {
sipep->SetDefaultLocalPartyName(args.GetOptionString('u'));
}
if (args.HasOption('c')) {
SIPRegister::Params param;
param.m_registrarAddress = args.GetOptionString('w');
param.m_addressOfRecord = args.GetOptionString('u');
param.m_password = args.GetOptionString('c');
param.m_realm = args.GetOptionString('g');
PString *aor = new PString("");
//sipep->SetProxy(args.GetOptionString('w'));
if (!StartListener()) {
return false;
}
if (!sipep->Register(param, *aor)) {
cout
<< "Could not register to "
<< param.m_registrarAddress << endl;
return false;
}
else {
cout
<< "registered as "
<< aor->GetPointer(aor->GetSize()) << endl;
}
}
TPState::Instance().SetProtocol(TPState::SIP);
} else if (!protocol.compare("h323")) {
cout << "initialising H.323 endpoint..." << endl;
h323ep = new H323EndPoint(*this);
AddRouteEntry("pc:.* = h323:<da>");
AddRouteEntry("h323:.* = pc:<da>");
if (args.HasOption('u')) {
h323ep->SetDefaultLocalPartyName(args.GetOptionString('u'));
}
TPState::Instance().SetProtocol(TPState::H323);
} else if (!protocol.compare("rtp")) {
//.........这里部分代码省略.........