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


C++ AttributeList::push_back方法代码示例

本文整理汇总了C++中AttributeList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeList::push_back方法的具体用法?C++ AttributeList::push_back怎么用?C++ AttributeList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AttributeList的用法示例。


在下文中一共展示了AttributeList::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: en

/* ****************************************************************************
*
* mongoGetContextElementResponses_fail -
*/
TEST(mongoOntimeintervalOperations, mongoGetContextElementResponses_fail)
{
    HttpStatusCode ms;

    /* Forge the parameters */
    EntityIdVector enV;
    EntityId en("E5", "T", "false");
    enV.push_back(&en);
    AttributeList attrL;
    attrL.push_back("A1");
    attrL.push_back("A2");
    attrL.push_back("A3");
    attrL.push_back("A4");
    ContextElementResponseVector cerV;
    std::string err;

    /* Prepare database */
    prepareDatabase();

    /* Do operation */
    ms = mongoGetContextElementResponses(enV, attrL, &cerV, &err);

    /* Check results */
    EXPECT_EQ(SccOk, ms);
    ASSERT_EQ(0, cerV.size());
}
开发者ID:PascaleBorscia,项目名称:fiware-orion,代码行数:30,代码来源:mongoOntimeintervalOperations_test.cpp

示例2: Attribute

AttributeList
SunPyInstance::build_preedit_attribs (const IPreeditString* ppd)
{
    AttributeList attrs;
    const int sz = ppd->charTypeSize();
    for (int i = 0; i < sz; ) {
        const int ct = ppd->charTypeAt(i);
        if (ct & IPreeditString::ILLEGAL) {
            const int start = i;
            for (++i; (i<sz) && (ppd->charTypeAt(i) & IPreeditString::ILLEGAL); ++i) ;
            attrs.push_back( Attribute(start, i-start,
                                       SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_REVERSE));
        } else if (ct & IPreeditString::NORMAL_CHAR) {
            if (ct & IPreeditString::USER_CHOICE) {
                const int start = i;
                for (++i; (i<sz) && (ppd->charTypeAt(i) & IPreeditString::USER_CHOICE); ++i) ;
                attrs.push_back( Attribute(start, i-start,
                                           SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_UNDERLINE));
            } else {
                ++i;
            }
        } else {
            ++i;
        }
    }
    return attrs;
}
开发者ID:Abioy,项目名称:sunpinyin,代码行数:27,代码来源:sunpinyin_imengine.cpp

示例3: getActiveAttributes

AttributeList Program::getActiveAttributes() const {
   AttributeList al;

   // Get the number of active attributes
   GLint num_attributes;
   getProgram(Program::ActiveAttributes, &num_attributes);

   // The the maximum size of the attribe names
   GLsizei max_name_length;
   getProgram(Program::ActiveAttributeMaxLength, &max_name_length);

   GLsizei length;
   std::vector<GLchar> name(max_name_length);

   for(int index = 0; index < num_attributes; index++) {
      AttributeInfo ai;

      // Retrive atribute data and store it in the info struct
      ai.index = index;
      glGetActiveAttrib(getProgramId(),
         index,
         name.size(),
         &length,
         &ai.size,
         &ai.type,
         &name[0]);
      ai.name = std::string(&name[0], length);

      al.push_back(ai);
   }
   return al;
}
开发者ID:dcbishop,项目名称:dglw,代码行数:32,代码来源:Program.cpp

示例4:

AttributeList
OGR_Feature::getAttributes() const
{
    AttributeTable attrs;

    if ( !store_attrs_loaded )
    {
        const_cast<OGR_Feature*>(this)->loadAttributes();
    }

    // accumulate the attrs from the store:
    for( AttributeTable::const_iterator i = store_attrs.begin(); i != store_attrs.end(); i++ )
    {
        attrs[ (*i).first ] = (*i).second;
    }

    // finally add in the user attrs (overwriting the store attrs if necessary)
    for( AttributeTable::const_iterator i = getUserAttrs().begin(); i != getUserAttrs().end() ; i++ )
        attrs[ (*i).first ] = (*i).second;

    // shove it all into a list
    AttributeList result;
    for( AttributeTable::const_iterator i = attrs.begin(); i != attrs.end(); i++ )
        result.push_back( (*i).second );

    return result;
}
开发者ID:aarnchng,项目名称:osggis,代码行数:27,代码来源:OGR_Feature.cpp

示例5:

void
HangulInstance::hangul_update_preedit_string ()
{
    WideString wstr = get_preedit_string ();

    if (wstr.length ()) {
        AttributeList attrs;
        attrs.push_back(Attribute(0, m_preedit.length(), SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_UNDERLINE));
        attrs.push_back(Attribute(m_preedit.length(), wstr.length() - m_preedit.length(), SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_REVERSE));
        show_preedit_string ();
        update_preedit_string (wstr, attrs);
        update_preedit_caret (wstr.length());
    } else {
        hide_preedit_string ();
    }
}
开发者ID:tzhuan,项目名称:scim-hangul,代码行数:16,代码来源:scim_hangul_imengine.cpp

示例6: table_exists

bool Connection::table_exists( const string &table_name ) {
  AttributeList parameters;
  parameters.push_back( table_name );
  RowSet rows = select_all( "SELECT name FROM sqlite_master WHERE type='table' AND name = ?;",
                            parameters );
  return ( rows.size() ? true : false );
}
开发者ID:tomferreira,项目名称:cpp-active-record,代码行数:7,代码来源:connection.cpp

示例7: DBException

/* ****************************************************************************
*
* mongoGetContextElementResponses_dbfail -
*
* FIXME: not sure if this test should exist... it should be include in unit testing
* for entitiesQuery()
*/
TEST(mongoOntimeintervalOperations, mongoGetContextElementResponses_dbfail)
{
    HttpStatusCode ms;

    /* Prepare mock */
    const DBException e = DBException("boom!!", 33);
    DBClientConnectionMock* connectionMock = new DBClientConnectionMock();
    ON_CALL(*connectionMock,_query("utest.entities",_,_,_,_,_,_))
            .WillByDefault(Throw(e));

    /* Forge the parameters */
    EntityIdVector enV;
    EntityId en1("E1", "T", "false");
    EntityId en2("E2", "T", "false");
    enV.push_back(&en1);
    enV.push_back(&en2);
    AttributeList attrL;
    attrL.push_back("A1");
    attrL.push_back("A2");
    attrL.push_back("A3");
    attrL.push_back("A4");
    ContextElementResponseVector cerV;
    std::string err;

    /* Set MongoDB connection (prepare database first with the "actual" connection object) */
    prepareDatabase();
    DBClientBase* connectionDb = getMongoConnection();
    setMongoConnectionForUnitTest(connectionMock);

    /* Do operation */
    ms = mongoGetContextElementResponses(enV, attrL, &cerV, &err);    

    /* Check results */
    EXPECT_EQ(SccOk, ms);
    EXPECT_EQ("Database Error (collection: utest.entities - "
              "query(): { query: { $or: [ { _id.id: \"E1\", _id.type: \"T\" }, { _id.id: \"E2\", _id.type: \"T\" } ], _id.servicePath: { $in: [ /^/.*/, null ] }, "
              "attrNames: { $in: [ \"A1\", \"A2\", \"A3\", \"A4\" ] } }, orderby: { creDate: 1 } } - "
              "exception: boom!!)", err);

    /* Restore real DB connection */
    setMongoConnectionForUnitTest(connectionDb);

    /* Release mocks */
    delete connectionMock;
}
开发者ID:PascaleBorscia,项目名称:fiware-orion,代码行数:52,代码来源:mongoOntimeintervalOperations_test.cpp

示例8: select_values

AttributeList Connection::select_values( const string &query,
					 const AttributeList &parameters ) {
  sqlite3_stmt *ppStmt = prepare( query, parameters );
  AttributeList results;
  while( sqlite3_step( ppStmt ) == SQLITE_ROW ) {
    results.push_back( Attribute::from_field( ppStmt, 0 ) );
  }
  sqlite3_finalize( ppStmt );
  return results;
}
开发者ID:SevostianovIvanSIS,项目名称:cpp-active-record,代码行数:10,代码来源:connection.cpp

示例9:

AttributeList
NativeLookupTable::get_attributes (int index) const
{
    AttributeList attrs;

#if 0
    if (index >= 0 && index < (int) m_strings.size ())
        attrs.push_back (Attribute (0, m_strings [index].length (), SCIM_ATTR_FOREGROUND, SCIM_RGB_COLOR(32, 32, 255)));
#endif

    return attrs;
}
开发者ID:scim-im,项目名称:scim-pinyin,代码行数:12,代码来源:scim_native_lookup_table.cpp

示例10: utInit

/* ****************************************************************************
*
* ok - 
*/
TEST(AttributeList, ok)
{
  AttributeList  al;
  std::string    out;
  const char*    outfile1 = "ngsi.attributeList.ok.middle.json";
  
  utInit();

  out = al.render("");
  EXPECT_STREQ("", out.c_str());

  al.push_back("a1");
  al.push_back("a2");
  
  out = al.render("");
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  al.push_back("");
  out = al.check(RegisterContext, "", "", 0);
  EXPECT_STREQ("empty attribute name", out.c_str());

  utExit();
}
开发者ID:Findeton,项目名称:fiware-orion,代码行数:28,代码来源:AttributeList_test.cpp

示例11:

void
StandardIMInstance::imm_update_candidates_list (const IME_InputContext   *ic,
                                                const IME_CandidatesList *candidates)
{
    if (ic && ic->id >= 0 && candidates) {
        StandardIMInstance *inst = __global->find_instance (ic->id);
        if (inst) {
            inst->m_lookup_table.clear ();
            if (candidates->nr_candidates > 0 && candidates->candidates) {

                std::vector <WideString> labels;
                AttributeList attrs;
                WideString wstr;

                if ((candidates->page_state & IME_FIRST_PAGE) == 0)
                    inst->m_lookup_table.append_candidate ((ucs4_t) 0x20);

                for (int i = 0; i < candidates->nr_candidates; ++i) {
                    labels.push_back (inst->m_factory->convert_string (String (candidates->candidates [i].label)));

                    attrs.clear ();

                    for (int j = 0; j < candidates->candidates [i].content.nr_attributes; ++j)
                        attrs.push_back (convert_attribute (candidates->candidates [i].content.attributes [j]));

                    wstr = inst->m_factory->convert_string (String (candidates->candidates [i].content.string));
                    inst->m_lookup_table.append_candidate (wstr, attrs);
                }

                if ((candidates->page_state & IME_LAST_PAGE) == 0)
                    inst->m_lookup_table.append_candidate ((ucs4_t) 0x20);

                if ((candidates->page_state & IME_FIRST_PAGE) == 0) {
                    inst->m_lookup_table.set_page_size (1);
                    inst->m_lookup_table.page_down ();
                }

                inst->m_lookup_table.set_page_size (candidates->nr_candidates);
                inst->m_lookup_table.set_candidate_labels (labels);

                if (candidates->focused_candidate >= 0 && candidates->focused_candidate < candidates->nr_candidates)
                    inst->m_lookup_table.set_cursor_pos_in_current_page (candidates->focused_candidate);
            }

            inst->update_lookup_table (inst->m_lookup_table);
        }
    }
}
开发者ID:Linuxese,项目名称:clsi,代码行数:48,代码来源:standard_im_imengine.cpp

示例12:

AttributeList
SKKCandList::get_attributes (int index) const
{
    AttributeList al = CommonLookupTable::get_attributes(index);
    if (annot_view && annot_pos &&
        (annot_target || get_cursor_pos() == index)) {
        WideString annot = get_annot(index);
        WideString cand = get_cand(index);
        if (annot_highlight && !annot.empty()) {
            al.push_back(Attribute(cand.length(), annot.length(),
                                   SCIM_ATTR_BACKGROUND,
                                   annot_bgcolor));
        }
    }
    return al;
}
开发者ID:tzhuan,项目名称:scim-skk,代码行数:16,代码来源:scim_skk_lookup_table.cpp

示例13: attr

unsigned int
CannaJRKanji::convert_string (WideString &dest,
                              AttributeList &attr_list,
                              const char *str,
                              unsigned int len,
                              unsigned int cur_pos,
                              unsigned int cur_len)
{
    // cut the string
    char left_str[cur_pos + 1];
    char cur_str[cur_len + 1];
    char right_str[len - cur_pos - cur_len + 1];
    strncpy (left_str, str, cur_pos);
    left_str[cur_pos] = '\0';
    strncpy (cur_str, (const char *) (str + cur_pos), cur_len);
    cur_str[cur_len] = '\0';
    strncpy (right_str, (const char *) (str + cur_pos + cur_len),
             len - cur_pos - cur_len);
    right_str[len - cur_pos - cur_len] = '\0';

    // convert
    WideString left, cur, right;
    m_iconv.convert (left,  left_str);
    m_iconv.convert (cur,   cur_str);
    m_iconv.convert (right, right_str);

    // join all string
    dest = left + cur + right;

    // set attributes
    Attribute attr (left.length (), cur.length (), SCIM_ATTR_DECORATE);
    attr.set_value (SCIM_ATTR_DECORATE_REVERSE);
    attr_list.push_back (attr);

    return left.length ();
}
开发者ID:tzhuan,项目名称:scim-canna-debian,代码行数:36,代码来源:canna_jrkanji.cpp

示例14: XOpenDisplay


//.........这里部分代码省略.........
    }

    // get any shared GLX contexts
    GraphicsHandleX11* graphicsHandleX11 = dynamic_cast<GraphicsHandleX11*>(_traits->sharedContext.get());
    Context sharedContext = graphicsHandleX11 ? graphicsHandleX11->getContext() : 0;

    _context = glXCreateContext( _display, _visualInfo, sharedContext, True );

    if (!_context)
    {
        OSG_NOTICE<<"Error: Unable to create OpenGL graphics context."<<std::endl;
        XCloseDisplay( _display );
        _display = 0;
        _valid = false;
        return;
    }

#ifdef GLX_VERSION_1_3
    // First try the regular glx extension if we have a new enough version available.
    if (haveGLX1_3)
    {
        int nelements;
        GLXFBConfig *fbconfigs = glXGetFBConfigs( _display, screen, &nelements );
        for ( int i = 0; i < nelements; ++i )
        {
            int visual_id;
            if ( glXGetFBConfigAttrib( _display, fbconfigs[i], GLX_VISUAL_ID, &visual_id ) == 0 )
            {
                if ( !_pbuffer && (unsigned int)visual_id == _visualInfo->visualid )
                {
                    typedef std::vector <int> AttributeList;

                    AttributeList attributes;
                    attributes.push_back( GLX_PBUFFER_WIDTH );
                    attributes.push_back( _traits->width );
                    attributes.push_back( GLX_PBUFFER_HEIGHT );
                    attributes.push_back( _traits->height );
                    attributes.push_back( GLX_LARGEST_PBUFFER );
                    attributes.push_back( GL_TRUE );
                    attributes.push_back( 0L );

                    _pbuffer = glXCreatePbuffer(_display, fbconfigs[i], &attributes.front() );
                    _useGLX1_3 = true;
                }
            }
        }
        if (_pbuffer)
        {
            int iWidth = 0;
            int iHeight = 0;
            glXQueryDrawable(_display, _pbuffer, GLX_WIDTH  , (unsigned int *)&iWidth);
            glXQueryDrawable(_display, _pbuffer, GLX_HEIGHT , (unsigned int *)&iHeight);

            if (_traits->width != iWidth || _traits->height != iHeight)
            {
                OSG_NOTICE << "PixelBufferX11::init(), pbuffer created with different size then requsted" << std::endl;
                OSG_NOTICE << "\tRequested size (" << _traits->width << "," << _traits->height << ")" << std::endl;
                OSG_NOTICE << "\tPbuffer size (" << iWidth << "," << iHeight << ")" << std::endl;
                _traits->width  = iWidth;
                _traits->height = iHeight;
            }
        }
        XFree( fbconfigs );
    }
#endif
开发者ID:151706061,项目名称:OpenSceneGraph,代码行数:66,代码来源:PixelBufferX11.cpp

示例15: Input

/* ****************************************************************************
*
* associationsDiscoverContextAvailability -
*/
static HttpStatusCode associationsDiscoverContextAvailability
(
  DiscoverContextAvailabilityRequest*   requestP,
  DiscoverContextAvailabilityResponse*  responseP,
  const std::string&                    scope,
  const std::string&                    tenant,
  int                                   offset,
  int                                   limit,
  bool                                  details,
  const std::vector<std::string>&       servicePathV
)
{
    if (scope == SCOPE_VALUE_ASSOC_ALL)
    {
        LM_W(("Bad Input (%s scope not supported)", SCOPE_VALUE_ASSOC_ALL));
        responseP->errorCode.fill(SccNotImplemented, std::string("Not supported scope: '") + SCOPE_VALUE_ASSOC_ALL + "'");
        return SccOk;
    }

    MetadataVector mdV;
    std::string err;
    if (!associationsQuery(&requestP->entityIdVector, &requestP->attributeList, scope, &mdV, &err, tenant, offset, limit, details, servicePathV))
    {
        mdV.release();
        responseP->errorCode.fill(SccReceiverInternalError, std::string("Database error: ") + err);
        return SccOk;
    }

    LM_T(LmtPagination, ("Offset: %d, Limit: %d, Details: %s", offset, limit, (details == true)? "true" : "false"));

    /* Query for associated entities */
    for (unsigned int ix = 0; ix < mdV.size(); ++ix) {
        /* Each association involves a registrationsQuery() operation, accumulating the answer in
         * responseP->responseVector */
        Metadata* md = mdV.get(ix);
        EntityIdVector enV;
        AttributeList attrL;

        EntityId en;
        if (scope == SCOPE_VALUE_ASSOC_SOURCE) {
            en = EntityId(md->association.entityAssociation.source.id, md->association.entityAssociation.source.type);
        }
        else {  // SCOPE_VALUE_ASSOC_TARGET
            en = EntityId(md->association.entityAssociation.target.id, md->association.entityAssociation.target.type);
        }
        enV.push_back(&en);

        for (unsigned int jx = 0; jx < md->association.attributeAssociationList.size(); ++jx) {
            if (scope == SCOPE_VALUE_ASSOC_SOURCE) {
                attrL.push_back(md->association.attributeAssociationList.get(jx)->source);
            }
            else {
                attrL.push_back(md->association.attributeAssociationList.get(jx)->target);
            }
        }

        ContextRegistrationResponseVector crrV;
        if (!registrationsQuery(enV, attrL, &crrV, &err, tenant, servicePathV))
        {
            responseP->errorCode.fill(SccReceiverInternalError, err);
            mdV.release();
            return SccOk;
        }

        /* Accumulate in responseP */
        for (unsigned int jx = 0; jx < crrV.size(); ++jx) {
            responseP->responseVector.push_back(crrV.get(jx));
        }
    }

    if (responseP->responseVector.size() == 0)
    {
      mdV.release();
      responseP->errorCode.fill(SccContextElementNotFound, "Could not query association with combination of entity/attribute");
      LM_RE(SccOk, (responseP->errorCode.details.c_str()));
    }

    /* Set association metadata as final ContextRegistrationResponse */
    ContextRegistrationResponse* crrMd = new ContextRegistrationResponse();
    crrMd->contextRegistration.providingApplication.set("http://www.fi-ware.eu/NGSI/association");
    crrMd->contextRegistration.registrationMetadataVector = mdV;
    responseP->responseVector.push_back(crrMd);

    return SccOk;
}
开发者ID:d0ugal,项目名称:fiware-orion,代码行数:89,代码来源:mongoDiscoverContextAvailability.cpp


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