这篇教程C++ symbols函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中symbols函数的典型用法代码示例。如果您正苦于以下问题:C++ symbols函数的具体用法?C++ symbols怎么用?C++ symbols使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了symbols函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: extract_controltemplate <typename R> bool extract_control(R& result,tokenizer& tokenizer){ result.clear(); //controls dictionary<string,id<string>> controls= { "/r",symbols()._cr, "/n",symbols()._lf }; //buffer array<ascii> buffer; //any if(!tokenizer.any(buffer,controls.keys())) return false; //commit result=buffer; update(controls[buffer.join("")],buffer); return true;}
开发者ID:vmorgulys,项目名称:sandbox,代码行数:29,
示例2: extract_wordtemplate <typename R> bool extract_word(R& result,tokenizer& tokenizer){ result.clear(); //buffer array<ascii> buffer; //word if(!tokenizer.word(buffer)) return false; //delimited if(!tokenizer.is_delimited()) return false; //commit result=buffer; update(symbols()._word,buffer); return true;}
开发者ID:vmorgulys,项目名称:sandbox,代码行数:26,
示例3: extract_identifiertemplate <typename R> bool extract_identifier(R& result,tokenizer& tokenizer){ result.clear(); //buffer array<ascii> buffer; array<ascii> current; //identifier if(!tokenizer.identifier(current)) return false; buffer.append(current); //word if(tokenizer.word(current)) buffer.append(current); //delimited if(!tokenizer.is_delimited()) return false; //commit result=buffer; update(symbols()._identifier,buffer); return true;}
开发者ID:vmorgulys,项目名称:sandbox,代码行数:34,
示例4: counts void ArithmeticUtilDecoder::decode(std::vector<byte>& data) { long p = in->pos; uint64 length = in->read48bits(); bits_left = in->read48bits()*8; // std::cout<<"Current position: "<<in->pos<<" - "<<" bits to read: "<<bits_left<<"/n"; data.resize(length); std::vector<uint64> counts(256); std::vector<SYMBOL> symbols(256); utils::gammaDecode(counts,in); in->flushBuffer(); uint64 cumul=0; for(int i=0;i<256;i++) { symbols[i].low_count=cumul; symbols[i].high_count = cumul = cumul + counts[i]; } byte aa = in->readByte(); byte bb = in->readByte(); byte cc = in->readByte(); byte dd = in->readByte(); bits_left-=32; code = (aa<<24)|(bb<<16)|(cc<<8)|dd; for(int i=0;i<length;i++) { uint64 v = get_value(); byte b = get_byte(symbols,v); if(i+1<length) del_symbol(symbols[b]); data[i]=b; } in->flushBuffer(); }
开发者ID:jkokkala,项目名称:bwtc,代码行数:30,
示例5: extract_unittemplate <typename R> bool extract_unit(R& result,reducer<T>& parser){ result.clear(); //buffer array<T> buffer; //empty if(parser.is_empty()) return false; //shift buffer.push(parser.shift()); //commit result=buffer; update(symbols()._unit,buffer); return true;}
开发者ID:vmorgulys,项目名称:sandbox,代码行数:25,
示例6: writes_globalsvoidShaderInstance::evaluate_writes_globals_and_userdata_params (){ writes_globals (false); userdata_params (false); BOOST_FOREACH (Symbol &s, symbols()) { if (s.symtype() == SymTypeGlobal && s.everwritten()) writes_globals (true); if ((s.symtype() == SymTypeParam || s.symtype() == SymTypeOutputParam) && ! s.lockgeom() && ! s.connected()) userdata_params (true); if (s.symtype() == SymTypeTemp) // Once we hit a temp, we'll never break; // see another global or param. } // In case this method is called before the Symbol vector is copied // (i.e. before copy_code_from_master is called), try to set // userdata_params as accurately as we can based on what we know from // the symbol overrides. This is very important to get instance merging // working correctly. int p = 0; BOOST_FOREACH (SymOverrideInfo &s, m_instoverrides) { if (! s.lockgeom()) userdata_params (true); ++p; }}
开发者ID:UbisoftMotionPictures,项目名称:OpenShadingLanguage,代码行数:27,
示例7: unum_setSymbolU_CAPI void U_EXPORT2unum_setSymbol(UNumberFormat *fmt, UNumberFormatSymbol symbol, const UChar *value, int32_t length, UErrorCode *status){ if(status==NULL || U_FAILURE(*status)) { return; } if(fmt==NULL || symbol< 0 || symbol>=UNUM_FORMAT_SYMBOL_COUNT || value==NULL || length<-1) { *status=U_ILLEGAL_ARGUMENT_ERROR; return; } NumberFormat *nf = reinterpret_cast<NumberFormat *>(fmt); DecimalFormat *dcf = dynamic_cast<DecimalFormat *>(nf); if (dcf == NULL) { *status = U_UNSUPPORTED_ERROR; return; } DecimalFormatSymbols symbols(*dcf->getDecimalFormatSymbols()); symbols.setSymbol((DecimalFormatSymbols::ENumberFormatSymbol)symbol, UnicodeString(value, length)); /* UnicodeString can handle the case when length = -1. */ dcf->setDecimalFormatSymbols(symbols);}
开发者ID:119120119,项目名称:node,代码行数:26,
示例8: QStringbool Cocos2dExporter::Export(QByteArray& out) { QString res = "info "; res += QString("face=/"") + fontConfig()->family() + QString("/" "); res += QString("size=") + QString().number(fontConfig()->size()) + QString(" bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2/n"); res += QString("common lineHeight=") + QString().number(metrics().height) + QString(" base=29 scaleW=") + QString().number(texWidth()) + QString(" scaleH=") + QString().number(texWidth()) + QString(" pages=1 packed=0/n"); res += QString("page id=0 file=/"") + texFilename() + QString("/"/n"); res += QString("chars count=") + QString().number(symbols().size()) + QString("/n"); foreach(const Symbol& c , symbols()) { res += QString("char id=") + QString().number(c.id) + QString(" x=") + QString().number(c.placeX) + QString(" y=") + QString().number(c.placeY); res += QString(" width=") + QString().number(c.placeW) + QString(" height=") + QString().number(c.placeH); res += QString(" xoffset=") + QString().number(c.offsetX) + QString(" yoffset=") + QString().number(fontConfig()->size() - c.offsetY); res += QString(" xadvance=") + QString().number(c.advance) + QString(" page=0 chnl=0 "); if(c.id==32) { res += QString("letter=/"space/""); } else { res += QString("letter=/"" + QString().append(c.id) + "/""); } res += QString("/n"); }
开发者ID:jempe,项目名称:fontbuilder,代码行数:26,
示例9: showCRFvoid CyclRatFunct::showCoprimeCRF(){// shows *this also with coprime numerator and denominator// makes only sense if only x[0] appears in the numerator (not checked) if(!verbose_INT) return; cout << "--------------------------------------------" << endl << endl; cout << "Given form" << endl << endl; showCRF(); cout << endl; SparsePolyRing R=owner(num); SparsePolyRing P=NewPolyRing_DMPI(RingQQ(),symbols("t")); vector<RingElem> Im(NumIndets(R),zero(P)); Im[0]=indets(P)[0]; RingHom phi=PolyAlgebraHom(R,P,Im); RingElem f(phi(num)); RingElem g(denom2poly(P,denom)); RingElem h=CoCoA::gcd(f,g); f/=h; g/=h; cout << "Coprime numerator (for denom with remaining factor 1)" << endl <<endl; factorization<RingElem> gf=factor(g); cout << f/gf.myRemainingFactor() << endl << endl << "Factorization of denominator" << endl << endl; size_t nf=gf.myFactors().size(); for(size_t i=0;i<nf;++i) cout << gf.myFactors()[i] << " mult " << gf.myMultiplicities()[i] << endl; cout << "--------------------------------------------" << endl;}
开发者ID:fingolfin,项目名称:Normaliz,代码行数:30,
示例10: symbolsvoid DecimalFormatTest::execFormatTest(int32_t lineNum, const UnicodeString &pattern, // Pattern const UnicodeString &round, // rounding mode const UnicodeString &input, // input decimal number const UnicodeString &expected, // expected formatted result UErrorCode &status) { if (U_FAILURE(status)) { return; } DecimalFormatSymbols symbols(Locale::getUS(), status); // printf("Pattern = %s/n", UnicodeStringPiece(pattern).data()); DecimalFormat fmtr(pattern, symbols, status); if (U_FAILURE(status)) { errln("file dcfmtest.txt, line %d: %s error creating the formatter.", lineNum, u_errorName(status)); return; } if (round=="ceiling") { fmtr.setRoundingMode(DecimalFormat::kRoundCeiling); } else if (round=="floor") { fmtr.setRoundingMode(DecimalFormat::kRoundFloor); } else if (round=="down") { fmtr.setRoundingMode(DecimalFormat::kRoundDown); } else if (round=="up") { fmtr.setRoundingMode(DecimalFormat::kRoundUp); } else if (round=="halfeven") { fmtr.setRoundingMode(DecimalFormat::kRoundHalfEven); } else if (round=="halfdown") { fmtr.setRoundingMode(DecimalFormat::kRoundHalfDown); } else if (round=="halfup") { fmtr.setRoundingMode(DecimalFormat::kRoundHalfUp); } else if (round=="default") { // don't set any value. } else { fmtr.setRoundingMode(DecimalFormat::kRoundFloor); errln("file dcfmtest.txt, line %d: Bad rounding mode /"%s/"", lineNum, UnicodeStringPiece(round).data()); } UnicodeString result; UnicodeStringPiece spInput(input); //fmtr.format(spInput, result, NULL, status); Formattable fmtbl; fmtbl.setDecimalNumber(spInput, status); //NumberFormat &nfmtr = fmtr; fmtr.format(fmtbl, result, NULL, status); if (U_FAILURE(status)) { errln("file dcfmtest.txt, line %d: format() returned %s.", lineNum, u_errorName(status)); return; } if (result != expected) { errln("file dcfmtest.txt, line %d: expected /"%s/", got /"%s/"", lineNum, UnicodeStringPiece(expected).data(), UnicodeStringPiece(result).data()); }}
开发者ID:ACSOP,项目名称:android_external_icu4c,代码行数:60,
示例11: get_entry bool get_entry( Elf_Xword index, Elf64_Addr &offset, Elf64_Addr &symbolValue, std::string &symbolName, Elf_Word &type, Elf_Sxword &addend, Elf_Sxword &calcValue ) const { // Do regular job Elf_Word symbol; bool ret = get_entry( index, offset, symbol, type, addend ); // Find the symbol Elf_Xword size; unsigned char bind; unsigned char symbolType; Elf_Half section; unsigned char other; symbol_section_accessor symbols( elf_file, elf_file.sections[get_symbol_table_index()] ); ret = symbols.get_symbol( symbol, symbolName, symbolValue, size, bind, symbolType, section, other ); if ( ret ) { // Was it successful? switch ( type ) { case R_386_NONE: // none calcValue = 0; break; case R_386_32: // S + A calcValue = symbolValue + addend; break; case R_386_PC32: // S + A - P calcValue = symbolValue + addend - offset; break; case R_386_GOT32: // G + A - P calcValue = 0; break; case R_386_PLT32: // L + A - P calcValue = 0; break; case R_386_COPY: // none calcValue = 0; break; case R_386_GLOB_DAT: // S case R_386_JMP_SLOT: // S calcValue = symbolValue; break; case R_386_RELATIVE: // B + A calcValue = addend; break; case R_386_GOTOFF: // S + A - GOT calcValue = 0; break; case R_386_GOTPC: // GOT + A - P calcValue = 0; break; default: // Not recognized symbol! calcValue = 0; break; } } return ret; }
开发者ID:kungfooman,项目名称:easyelf,代码行数:60,
|