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


C++ PString::GetPointer方法代码示例

本文整理汇总了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")) {
//.........这里部分代码省略.........
开发者ID:edholland,项目名称:sipcmd,代码行数:101,代码来源:main.cpp

示例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;
}
开发者ID:ezh,项目名称:ENikiBENiki,代码行数:64,代码来源:Resources.cpp


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