예제 #1
0
RexxObject *RexxHashTableCollection::makeProxy(RexxEnvelope *envelope)
/******************************************************************************/
/* Function:  Create a proxy object for a standard collection                 */
/******************************************************************************/
{
    /* Determine which special object    */
    /* this is and compute code for it.  */
    if (this == TheEnvironment)          /* the environment directory         */
    {
        return new_proxy(CHAR_ENVIRONMENT);
    }
    else if (this == TheKernel)          /* the kernel directory              */
    {
        return new_proxy(CHAR_KERNEL);
    }
    else if (this == TheSystem)          /* the system directory              */
    {
        return new_proxy(CHAR_SYSTEM);
    }
    else
    {
        Interpreter::logicError("Don't know how to generate a proxy object for an object");
    }
    return OREF_NULL;
}
/**
 * Make a proxy object for one of the special directories (e.g.,
 * the environment directory)
 *
 * @param envelope The envelope we're flattening into.
 *
 * @return A string proxy name for this object.
 */
RexxObject *DirectoryClass::makeProxy(Envelope *envelope)
{
    // the environment directory is the only one that needs this treatment
    if (this == TheEnvironment)
    {
        return new_proxy("ENVIRONMENT");
    }
    else
    {
        Interpreter::logicError("Don't know how to generate a proxy object for an object");
    }
    return OREF_NULL;
}
예제 #3
0
파일: main.c 프로젝트: libin89/GOF
int main(void)
{
	struct _school_girl* mm;
	struct _proxy* proxy;

	mm = new_school_girl("xixi");
	//printf("mm's name is %s\n",mm->name);
	proxy = new_proxy(mm);
	proxy->GiveDolls(mm);
	proxy->GiveFlowers(mm);
	proxy->GiveChocolate(mm);
	delete_school_girl(mm);
	delete_proxy(proxy);

	return 0;
}
// Called when the user clicked "OK" button of the settings dialog. Return
// true if the proxy settings has been changed by the user.
bool SettingsDialog::updateProxySettings()
{
    SettingsManager *mgr = seafApplet->settingsManager();
    SettingsManager::SeafileProxy old_proxy = mgr->getProxy();

    SettingsManager::ProxyType proxy_type = static_cast<SettingsManager::ProxyType>(mProxyMethodComboBox->currentIndex());
    QString proxy_host = mProxyHost->text().trimmed();
    QString proxy_username = mProxyUsername->text().trimmed();
    QString proxy_password = mProxyPassword->text().trimmed();
    int proxy_port = mProxyPort->value();

    SettingsManager::SeafileProxy new_proxy(proxy_type);

    switch(proxy_type) {
        case SettingsManager::HttpProxy:
            new_proxy.host = proxy_host;
            new_proxy.port = proxy_port;
            if (mProxyRequirePassword->checkState() == Qt::Checked) {
                new_proxy.username = proxy_username;
                new_proxy.password = proxy_password;
                break;
            }
            break;
        case SettingsManager::SocksProxy:
            new_proxy.host = proxy_host;
            new_proxy.port = proxy_port;
            break;
        case SettingsManager::NoProxy:
        case SettingsManager::SystemProxy:
        default:
            break;
    }

    if (new_proxy != old_proxy) {
        mgr->setProxy(new_proxy);
        return true;
    }

    return false;
}