示例#1
0
  Mapping& Dispatcher::addUrlMapEntry(const std::string& vhost,
    const std::string& url, const std::string& method, int ssl, const Maptarget& ci)
  {
    cxxtools::WriteLock lock(_mutex);

    log_debug("map vhost <" << vhost << "> url <" << url << "> method <" << method << "> ssl <" << ssl << "> to <" << ci << '>');
    _urlmap.push_back(Mapping(vhost, url, method, ssl, ci));
    return _urlmap.back();
  }
示例#2
0
文件: xcb.c 项目: FLYKingdom/vlc
/*****************************************************************************
 * Open:
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    intf_thread_t *p_intf = (intf_thread_t *)p_this;
    intf_sys_t *p_sys;

    p_intf->p_sys = p_sys = calloc( 1, sizeof(*p_sys) );
    if( !p_sys )
        return VLC_ENOMEM;

    char *psz_display = var_CreateGetNonEmptyString( p_intf, "x11-display" );

    int i_screen_default;
    p_sys->p_connection = xcb_connect( psz_display, &i_screen_default );
    free( psz_display );

    if( !p_sys->p_connection )
        goto error;

    /* Get the root windows of the default screen */
    const xcb_setup_t* xcbsetup = xcb_get_setup( p_sys->p_connection );
    if( !xcbsetup )
        goto error;
    xcb_screen_iterator_t iter = xcb_setup_roots_iterator( xcbsetup );
    for( int i = 0; i < i_screen_default; i++ )
    {
        if( !iter.rem )
            break;
        xcb_screen_next( &iter );
    }
    if( !iter.rem )
        goto error;
    p_sys->root = iter.data->root;

    /* */
    p_sys->p_symbols = xcb_key_symbols_alloc( p_sys->p_connection ); // FIXME
    if( !p_sys->p_symbols )
        goto error;

    Mapping( p_intf );
    Register( p_intf );

    if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
    {
        Unregister( p_intf );
        free( p_sys->p_map );
        goto error;
    }
    return VLC_SUCCESS;

error:
    if( p_sys->p_symbols )
        xcb_key_symbols_free( p_sys->p_symbols );
    if( p_sys->p_connection )
        xcb_disconnect( p_sys->p_connection );
    free( p_sys );
    return VLC_EGENERIC;
}
示例#3
0
文件: idstring.cpp 项目: vasi/kdelibs
void IDTableBase::addHiddenMapping(unsigned id, const DOMString& name)
{
    DOMStringImpl* nameImpl = name.implementation();
    if (nameImpl) nameImpl->ref();

    if (id >= m_mappings.size())
        m_mappings.resize(id + 1);
    m_mappings[id] = Mapping(nameImpl);
    m_mappings[id].refCount = 1; // Pin it.
}
示例#4
0
 void Gateway::new_request ( uint16_t request )
 {
     ::fcgi_owire_new_request(&myOWire, request, 1);
       // lookup the response object for the request ID.
     mySelection = myResponses.find(request);
       // might be the first use of this request ID.
     if ( mySelection == myResponses.end() )
     {
         mySelection = myResponses.insert
             (Mapping(request, Response(request))).first;
     }
 }
示例#5
0
PathSelector::PathSelector(QString const &caption,
                           QString const &settingskey,
                           Mapping const &default1,
                           Mapping const &default2,
                           QWidget *widgetParent)
: comboBox_(new QComboBox(widgetParent))
, caption_(caption)
, key_(settingskey)
, value_(QSettings().value(key_, default1.second).toString())
{
	comboBox_->addItem(default1.first, default1.second);
	if (default2 != Mapping())
		comboBox_->addItem(default2.first, default2.second);

	comboBox_->addItem(tr("Other..."));

	reject();
	connect(comboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(indexChanged(int)));
}
示例#6
0
 void Gateway::accept_record
     ( ::fcgi_iwire * stream, int version, int request, int content )
 {
     Gateway& gateway = *static_cast<Gateway*>(stream->object);
     if ( version != 1 )
     {
         // ...
     }
       // don't create a request object for management records.
     if ( request == 0 ) {
         return;
     }
       // lookup the response object for the request ID.
     gateway.mySelection = gateway.myResponses.find(request);
       // might be the first use of this request ID.
     if ( gateway.mySelection == gateway.myResponses.end() )
     {
         gateway.mySelection = gateway.myResponses.insert
             (Mapping(request, Response(request))).first;
     }
     // TODO: forward content length.
 }
示例#7
0
void TestRunner::addTest(const std::string& name, Test* test)
{
	_mappings.push_back(Mapping(name, test));
}
示例#8
0
//#####################################################################
// Function Name
//#####################################################################
const std::string& SYMBOL::
Name() const
{
    return Mapping().key_to_name.Get(key);
}
示例#9
0
SYMBOL::
SYMBOL(const std::string& name)
    :key(Mapping().Name_To_Key(name))
{}
示例#10
0
//#####################################################################
// Constructor
//#####################################################################
SYMBOL::
SYMBOL(const char* name)
    :key(Mapping().Name_To_Key(name))
{}
示例#11
0
文件: xcb.c 项目: 371816210/vlc_vlc
/*****************************************************************************
 * Open:
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    intf_thread_t *p_intf = (intf_thread_t *)p_this;
    intf_sys_t *p_sys;
    int ret = VLC_EGENERIC;

    p_intf->p_sys = p_sys = calloc( 1, sizeof(*p_sys) );
    if( !p_sys )
        return VLC_ENOMEM;

    int i_screen_default;
    p_sys->p_connection = xcb_connect( NULL, &i_screen_default );

    if( xcb_connection_has_error( p_sys->p_connection ) )
        goto error;

    /* Get the root windows of the default screen */
    const xcb_setup_t* xcbsetup = xcb_get_setup( p_sys->p_connection );
    if( !xcbsetup )
        goto error;
    xcb_screen_iterator_t iter = xcb_setup_roots_iterator( xcbsetup );
    for( int i = 0; i < i_screen_default; i++ )
    {
        if( !iter.rem )
            break;
        xcb_screen_next( &iter );
    }
    if( !iter.rem )
        goto error;
    p_sys->root = iter.data->root;

    /* */
    p_sys->p_symbols = xcb_key_symbols_alloc( p_sys->p_connection ); // FIXME
    if( !p_sys->p_symbols )
        goto error;

    if( !Mapping( p_intf ) )
    {
        ret = VLC_SUCCESS;
        p_intf->p_sys = NULL; /* for Close() */
        goto error;
    }
    Register( p_intf );

    if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
    {
        if( p_sys->p_map )
        {
            free( p_sys->p_map->p_keys );
            free( p_sys->p_map );
        }
        goto error;
    }
    return VLC_SUCCESS;

error:
    if( p_sys->p_symbols )
        xcb_key_symbols_free( p_sys->p_symbols );
    xcb_disconnect( p_sys->p_connection );
    free( p_sys );
    return ret;
}
示例#12
0
 void SourceMap::add_close_mapping(AST_Node* node)
 {
   mappings.push_back(Mapping(node->pstate() + node->pstate().offset, current_position));
 }
示例#13
0
 void SourceMap::add_open_mapping(AST_Node* node)
 {
   mappings.push_back(Mapping(node->pstate(), current_position));
 }
示例#14
0
文件: idstring.cpp 项目: vasi/kdelibs
unsigned short IDTableBase::grabId(DOMStringImpl* origName, CaseNormalizeMode cnm)
{
    unsigned short newId;

    // Check for existing one, ignoring case if needed
    IDTableBase::MappingKey::caseNormalizationMode = cnm;
    QHash<MappingKey, unsigned short>::const_iterator i = m_mappingLookup.constFind(origName);
    if (i != m_mappingLookup.constEnd()) {
        newId = *i;
        refId(newId);
        return newId;
    }

    // Nope. Allocate new ID. If there is normalization going on, we may now have to 
    // update our case so the canonical mapping is of the expected case. We
    // may also have to deep-copy 
    DOMStringImpl* name;
    switch (cnm) {
    case IDS_CaseSensitive:
        if (origName->m_shallowCopy) {
            // Create a new copy of the data since we may be extending its
            // lifetime indefinitely
            name = new DOMStringImpl(origName->s, origName->l);
            name->m_hash = origName->m_hash;
        } else {
            name = origName;
        }
        break;
    case IDS_NormalizeUpper:
        name = origName->upper();
        break;
    case IDS_NormalizeLower:
        name = origName->lower();
        break;
    }
    
    name->ref();

    if (!m_idFreeList.isEmpty()) {
        // Grab from freelist..
        newId = m_idFreeList.last();
        m_idFreeList.removeLast();
        m_mappings[newId].name = name;
    } else {
        // Make a new one --- if we can (we keep one spot for "last resort" mapping)
        if (m_mappings.size() < 0xFFFE) {
            m_mappings.append(Mapping(name));
            newId = m_mappings.size() - 1;
        } else {
            // We ran out of resources. Did we add a fallback mapping yet?
            // We use the same one for everything; and don't even keep track
            // of what it may go to, as we will have no way of freeing
            // the aliases. In particular, this means we no longer need the name..
            name->deref();
            
            if (m_mappings.size() == 0xFFFE) {
                // Need a new mapping..
                name = new DOMStringImpl("_khtml_fallback");
                m_mappings.append(Mapping(name));
                m_mappings[0xFFFF].refCount = 1; // pin it.
                name->ref();
            } else {
                name = m_mappings[0xFFFF].name; // No need to ref the name
                                                // here as the entry is eternal anyway
            }
            newId = 0xFFFF;
        }
    }

    m_mappingLookup[name] = newId;

    refId(newId);
    return newId;
}