本文整理汇总了C++中PString::GetPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ PString::GetPointer方法的具体用法?C++ PString::GetPointer怎么用?C++ PString::GetPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PString
的用法示例。
在下文中一共展示了PString::GetPointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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")) {
//.........这里部分代码省略.........
示例2: Open
bool Resources::Open(PString & argv0, PString & application) {
if(!PHYSFS_init(argv0.GetPointer())) {
PError << "failure while initialising physfs: " << PHYSFS_getLastError() << endl;
return PFalse;
} else {
PTRACE(5, "successful initialize physfs");
}
const char* basedir = PHYSFS_getBaseDir();
const char* userdir = PHYSFS_getUserDir();
const char* dirsep = PHYSFS_getDirSeparator();
char* writedir = new char[strlen(userdir) + application.GetLength() + 2];
sprintf(writedir, "%s.%s", userdir, application.GetPointer());
PTRACE(5, "physfs base directory: " << basedir);
PTRACE(5, "physfs user directory: " << userdir);
PTRACE(5, "physfs write directory: " << writedir);
if(!PHYSFS_setWriteDir(writedir)) {
// try to create the directory...
char* mkdir = new char[application.GetLength()+2];
sprintf(mkdir, ".%s", application.GetPointer());
if(!PHYSFS_setWriteDir(userdir) || ! PHYSFS_mkdir(mkdir)) {
delete[] writedir;
delete[] mkdir;
PError << "failed creating configuration directory: '" << writedir << "': " << PHYSFS_getLastError() << endl;
return PFalse;
}
delete[] mkdir;
if (!PHYSFS_setWriteDir(writedir)) {
PError << "couldn't set configuration directory to '" << writedir << "': " << PHYSFS_getLastError() << endl;
return PFalse;
}
}
PHYSFS_addToSearchPath(writedir, 0);
PHYSFS_addToSearchPath(basedir, 1);
delete[] writedir;
/* Root out archives, and add them to search path... */
if (resourceExt != NULL) {
char **rc = PHYSFS_enumerateFiles("/");
char **i;
size_t extlen = strlen(resourceExt);
char *ext;
for (i = rc; *i != NULL; i++) {
size_t l = strlen(*i);
if ((l > extlen) && ((*i)[l - extlen - 1] == '.')) {
ext = (*i) + (l - extlen);
if (strcasecmp(ext, resourceExt) == 0) {
PTRACE(5, "Add resource '" << *i << "' to search path");
const char *d = PHYSFS_getRealDir(*i);
char* str = new char[strlen(d) + strlen(dirsep) + l + 1];
sprintf(str, "%s%s%s", d, dirsep, *i);
addToSearchPath(str, 1);
delete[] str;
};
};
};
PHYSFS_freeList(rc);
}
return PTrue;
}