• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ch函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ch函数的典型用法代码示例。如果您正苦于以下问题:C++ ch函数的具体用法?C++ ch怎么用?C++ ch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: ParseBoxFileStr

// Parses the given box file string into a page_number, utf8_str, and
// bounding_box. Returns true on a successful parse.
// The box file is assumed to contain box definitions, one per line, of the
// following format for blob-level boxes:
//   <UTF8 str> <left> <bottom> <right> <top> <page id>
// and for word/line-level boxes:
//   WordStr <left> <bottom> <right> <top> <page id> #<space-delimited word str>
// See applyybox.cpp for more information.
bool ParseBoxFileStr(const char* boxfile_str, int* page_number,
                     STRING* utf8_str, TBOX* bounding_box) {
  *bounding_box = TBOX();       // Initialize it to empty.
  *utf8_str = "";
  char uch[kBoxReadBufSize];
  const char *buffptr = boxfile_str;
  // Read the unichar without messing up on Tibetan.
  // According to issue 253 the utf-8 surrogates 85 and A0 are treated
  // as whitespace by sscanf, so it is more reliable to just find
  // ascii space and tab.
  int uch_len = 0;
  // Skip unicode file designation, if present.
  const unsigned char *ubuf = reinterpret_cast<const unsigned char*>(buffptr);
  if (ubuf[0] == 0xef && ubuf[1] == 0xbb && ubuf[2] == 0xbf)
      buffptr += 3;
  // Allow a single blank as the UTF-8 string. Check for empty string and
  // then blindly eat the first character.
  if (*buffptr == '\0') return false;
  do {
    uch[uch_len++] = *buffptr++;
  } while (*buffptr != '\0' && *buffptr != ' ' && *buffptr != '\t' &&
           uch_len < kBoxReadBufSize - 1);
  uch[uch_len] = '\0';
  if (*buffptr != '\0') ++buffptr;
  int x_min, y_min, x_max, y_max;
  *page_number = 0;
  int count = sscanf(buffptr, "%d %d %d %d %d",
                 &x_min, &y_min, &x_max, &y_max, page_number);
  if (count != 5 && count != 4) {
    tprintf("Bad box coordinates in boxfile string! %s\n", ubuf);
    return false;
  }
  // Test for long space-delimited string label.
  if (strcmp(uch, kMultiBlobLabelCode) == 0 &&
      (buffptr = strchr(buffptr, '#')) != NULL) {
    strncpy(uch, buffptr + 1, kBoxReadBufSize - 1);
    uch[kBoxReadBufSize - 1] = '\0';  // Prevent buffer overrun.
    chomp_string(uch);
    uch_len = strlen(uch);
  }
  // Validate UTF8 by making unichars with it.
  int used = 0;
  while (used < uch_len) {
    UNICHAR ch(uch + used, uch_len - used);
    int new_used = ch.utf8_len();
    if (new_used == 0) {
      tprintf("Bad UTF-8 str %s starts with 0x%02x at col %d\n",
              uch + used, uch[used], used + 1);
      return false;
    }
    used += new_used;
  }
  *utf8_str = uch;
  if (x_min > x_max) Swap(&x_min, &x_max);
  if (y_min > y_max) Swap(&y_min, &y_max);
  bounding_box->set_to_given_coords(x_min, y_min, x_max, y_max);
  return true;  // Successfully read a box.
}
开发者ID:MaTriXy,项目名称:tess-two,代码行数:66,代码来源:boxread.cpp


示例2: ch

void InventoryDAOMySQL::deleteInventory(Inventory &inventory)
{
    MySQLManager::ConnectionHolder ch(MySQLManager::getInstance());
    std::unique_ptr<sql::PreparedStatement> ps(ch.conn->prepareStatement(DELETE_INVENTORY));

    ps->setInt(1, inventory.getId());

    ps->execute();
}
开发者ID:filipkofron,项目名称:Thesis,代码行数:9,代码来源:InventoryDAOMySQL.cpp


示例3: ch

// 0 if success , 1 if multi the same id
JCode JLoginHash::add(JID userid,const QByteArray& extra)
{
    if(s_data.contains(userid)) return 1;
    QCryptographicHash ch(QCryptographicHash::Md5);
    ch.addData(extra);
    ch.addData(QTime::currentTime().toString().toAscii());
    s_data.insert(userid,ch.result().left(8));
    return 0;
}
开发者ID:stareven,项目名称:Dlut-Game-Platform,代码行数:10,代码来源:jloginhash.cpp


示例4: throw

size_t CFileUtils::file_copy(const char* src_filename, int dst_fd) throw (CSyscallException)
{
    int src_fd = open(src_filename, O_RDONLY);
    if (-1 == src_fd)
        THROW_SYSCALL_EXCEPTION(NULL, errno, "open");

    sys::CloseHelper<int> ch(src_fd);
    return file_copy(src_fd, dst_fd);
}
开发者ID:ly20119,项目名称:mooon,代码行数:9,代码来源:file_utils.cpp


示例5: getIoPoller

//------------------------------------------------------------------------
// Admin Listener
bool AdminListener::eventAccept(const accept_type& param)
{
	pw::chif_create_type cparam;
	cparam.fd = param.fd;
	cparam.poller = getIoPoller();
	cparam.ssl = param.ssl;
	AdminChannel* ch(new AdminChannel(cparam));
	return nullptr not_eq ch;
}
开发者ID:ArtisticCoding,项目名称:libpw,代码行数:11,代码来源:mylistener.cpp


示例6: inbyte

int inbyte (void )
{
	while (ch () == 0) {
		if (feof (input))
			return (0);
		preprocess ();
	}
	return (gch ());
}
开发者ID:BouKiCHi,项目名称:husic_git,代码行数:9,代码来源:io.c


示例7: ch

void VendorDAOMySQL::deleteVendor(Vendor &vendor)
{
    MySQLManager::ConnectionHolder ch(MySQLManager::getInstance());
    std::unique_ptr<sql::PreparedStatement> ps(ch.conn->prepareStatement(DELETE_VENDOR));

    ps->setInt(1, vendor.getId());

    ps->execute();
}
开发者ID:filipkofron,项目名称:Thesis,代码行数:9,代码来源:VendorDAOMySQL.cpp


示例8: Significance

void Significance(TString tag=""){
  // Loading files
  TChain ch("ntp1");
  ch.Add("AWG82/ntuples/SP-1235-BSemiExcl-Run2-R22d-v06/*");
  ch.Add("AWG82/ntuples/SP-1235-BSemiExcl-Run4-R22d-v06/*");
  ch.Add("AWG82/ntuples/SP-1237-BSemiExcl-Run2-R22d-v06/*");
  ch.Add("AWG82/ntuples/SP-1237-BSemiExcl-Run4-R22d-v06/*");

  int entries = ch.GetEntries();
  TCut MMiss = "candPMiss>.2";
  TCut Q2 = "candQ2>4";
  TCut ee1 = "candType<3&&candEExtra<.2";
  TCut ee2 = "candType==3&&candEExtra<.15";
  TCut ee3 = "candType==4&&candEExtra<.3";
  TCut ee = (ee1||ee2||ee3);
  TCut basic = ee+MMiss+Q2;

  TString D0names[]={"K^- \\pi^+","K^-\\pi^+\\pi^0","K^-\\pi^+\\pi^+\\pi^-",
		     "K_S^0\\,\\pi^+\\pi^-","K_S^0\\,\\pi^+\\pi^-\\pi^0",
		     "K_S^0\\,K_S^0","K_S^0\\,\\pi^0","\\pi^+\\pi^-","K^+K^-"};
  TString Dplusnames[]={"K^-\\pi^+\\pi^+","K^-\\pi^+\\pi^+\\pi^0","K_S^0\\,\\pi^+",
			"K_S^0\\,\\pi^+\\pi^0","K_S^0\\,\\pi^+\\pi^+\\pi^-",
			"K^+K^-\\pi^+","K_S^0\\,K^+"};
  fstream tex;
  tex.open("mycode/tables/Significance"+tag+".txt",fstream::out);
  tex<<"\\begin{tabular}{|l|ccc||l|ccc|}"<<endl<<"\\hline"<<endl;
  tex<<"$\\mathbf{D^{(*)0}}$ & $S$ & B & $\\frac{S}{S+B}$(\\%) & ";
  tex<<"$\\mathbf{D^{(*)+}}$ & $S$ & B & $\\frac{S}{S+B}$(\\%)\\\\"<<endl;
  tex<<"\\hline \\hline"<<endl;

  double S=0,B=0;
  for(int i=1; i<10;i++){
    TString tS = "(MCType==5||MCType==6)&&candType<3&&candDType=="; tS+=i;
    TString tB = "(MCType==0||MCType>6)&&candType<3&&candDType==";tB+=i;
    TCut cutS(tS), cutB(tB);
    S = ch.GetEntries(basic+cutS);
    B = ch.GetEntries(basic+cutB);
    int puri = S/(S+B)*100;
    tex<<D0names[i-1]<<" & "<<S<<" & "<<B<<" & "<<puri<<" & ";
    if(i<8){
      tS = "(MCType==11||MCType==12)&&(candType==3||(candType==4&&candDstarType==5))&&candDType=="; 
      tB = "(MCType<7||MCType>12)&&(candType==3||(candType==4&&candDstarType==5))&&candDType==";
      tS+=i; tB+=i;
      TCut cutS(tS), cutB(tB);
      S = ch.GetEntries(basic+cutS);
      B = ch.GetEntries(basic+cutB);
      puri = S/(S+B)*100;
      tex<<Dplusnames[i-1]<<" & "<<S<<" & "<<B<<" & "<<puri<<" \\\\"<<endl;  
    } else {
      tex<<" & & & \\\\"<<endl;
    }
    cout<<"DMode "<<i<<" has S "<<S<<", S/sqrt(S+B) "<<round(S/sqrt(S+B));
    cout<<" and S/(S+B) "<<round(S/(S+B))<<endl;
  }
  tex<<"\\hline \\end{tabular}"<<endl<<endl;
}
开发者ID:manuelfs,项目名称:babar_code,代码行数:56,代码来源:Significance.C


示例9: Q_ASSERT

void OAuth::output(QNetworkRequest *req, const QString& cmd, const HSTREntry& addBody) const {
	Q_ASSERT(!_cs_key.isEmpty() && !_cs_secret.isEmpty());
	// OAuthヘッダを生成
	HSTREntry ent;
	ent[OAUTH::ENT::TIMESTAMP] = _geneTimeStamp();
	ent[OAUTH::ENT::NONCE] = _geneNonce();
	ent[OAUTH::ENT::VERSION] = OAUTH::_1_0;
	ent[OAUTH::ENT::SIG_METHOD] = OAUTH::HMAC_SHA1;
	ent[OAUTH::ENT::CS_KEY] = _cs_key;
	if(!_token.isEmpty())
		ent[OAUTH::ENT::TOKEN] = _token;
	else
		ent[OAUTH::ENT::CALLBACK] = "oob";
	if(!_veliID.isEmpty())
		ent[OAUTH::ENT::VERIFIER] = _veliID;
	// ソートの為に配列へ書き出し
	HSTRMapV sv;
	for(auto itr=ent.cbegin() ; itr!=ent.cend() ; itr++)
		sv.push_back(qMakePair(itr.key(), itr.value()));

	// add query items (for GET)
	if(cmd == "GET") {
		QUrlQuery q(req->url());
		auto qil = q.queryItems();
		for(auto qi : qil)
			sv.push_back(HSTRPair(qi.first, qi.second));
	} else if(cmd == "POST") {
		// 本体ノードがあればそれも加味
		// add body items (for POST)
		for(auto itr=addBody.cbegin() ; itr!=addBody.cend() ; itr++)
			sv.push_back(HSTRPair(itr.key(), itr.value()));
	} else {
		Q_ASSERT(false);
	}

	// 署名を計算
	SHA1DG dg;
	_calcSHA1(dg, sv, req->url(), cmd);

	// :base64変換
	QByteArray dg64 = QByteArray((const char*)dg, 20).toBase64();
	// :url(OAuth)変換
	char tc[64];
	UrlEncode_OAUTH(tc, sizeof(tc), dg64.data(), dg64.size());
	// 署名を付加
	ent.insert(OAUTH::ENT::SIGNATURE, tc);

	// Requestへ追加
	QString ss(OAUTH::OAUTH);
	QChar ch(' ');
	for(auto itr=ent.cbegin() ; itr!=ent.cend() ; itr++) {
		ss += QString("%1%2=\"%3\"").arg(ch).arg(itr.key()).arg(itr.value());
		ch = ',';
	}
	req->setRawHeader(ToBA(OAUTH::AUTHZ), ToBA(ss));
}
开发者ID:degarashi,项目名称:TwilveQt,代码行数:56,代码来源:oauth.cpp


示例10: acornDecrypt32

/**
 * \brief Decrypts a 32-bit word using Acorn128.
 *
 * \param state The state for the Acorn128 cipher.
 * \param ciphertext The ciphertext word.
 *
 * \return The plaintext word.
 */
static inline uint32_t acornDecrypt32(Acorn128State *state, uint32_t ciphertext)
{
    // Extract out various sub-parts of the state as 32-bit words.
    #define s_extract_32(name, shift) \
        ((state->name##_l >> (shift)) | \
         (((uint32_t)(state->name##_h)) << (32 - (shift))))
    uint32_t s244 = s_extract_32(s6, 14);
    uint32_t s235 = s_extract_32(s6, 5);
    uint32_t s196 = s_extract_32(s5, 3);
    uint32_t s160 = s_extract_32(s4, 6);
    uint32_t s111 = s_extract_32(s3, 4);
    uint32_t s66  = s_extract_32(s2, 5);
    uint32_t s23  = s_extract_32(s1, 23);
    uint32_t s12  = s_extract_32(s1, 12);

    // Update the LFSR's.
    uint32_t s7_l = state->s7 ^ s235 ^ state->s6_l;
    state->s6_l ^= s196 ^ state->s5_l;
    state->s5_l ^= s160 ^ state->s4_l;
    state->s4_l ^= s111 ^ state->s3_l;
    state->s3_l ^= s66  ^ state->s2_l;
    state->s2_l ^= s23  ^ state->s1_l;

    // Generate the next 32 keystream bits and decrypt the ciphertext.
    // k = S[12] ^ S[154] ^ maj(S[235], S[61], S[193])
    //                    ^  ch(S[230], S[111], S[66])
    uint32_t ks = s12 ^ state->s4_l ^
                  maj(s235, state->s2_l, state->s5_l) ^
                  ch(state->s6_l, s111, s66);
    uint32_t plaintext = ciphertext ^ ks;

    // Generate the next 32 non-linear feedback bits.
    // f = S[0] ^ ~S[107] ^ maj(S[244], S[23], S[160])
    //                    ^ (ca & S[196]) ^ (cb & ks)
    // f ^= plaintext
    // Note: ca will always be 1 and cb will always be 0.
    uint32_t f = state->s1_l ^ (~state->s3_l) ^ maj(s244, s23, s160) ^ s196;
    f ^= plaintext;

    // Shift the state downwards by 32 bits.
    #define s_shift_32(name1, name2, shift) \
        (state->name1##_l = state->name1##_h | (state->name2##_l << (shift)), \
         state->name1##_h = (state->name2##_l >> (32 - (shift))))
    s7_l ^= (f << 4);
    state->s7 = (uint8_t)(f >> 28);
    s_shift_32(s1, s2, 29);
    s_shift_32(s2, s3, 14);
    s_shift_32(s3, s4, 15);
    s_shift_32(s4, s5, 7);
    s_shift_32(s5, s6, 5);
    state->s6_l = state->s6_h | (s7_l << 27);
    state->s6_h = s7_l >> 5;

    // Return the plaintext word to the caller.
    return plaintext;
}
开发者ID:rweather,项目名称:arduinolibs,代码行数:64,代码来源:Acorn128.cpp


示例11: ch

const vmime::charset posixHandler::getLocaleCharset() const
{
	const PLockHelper lock;

	const char* prevLocale = ::setlocale(LC_ALL, "");
	vmime::charset ch(::nl_langinfo(CODESET));
	::setlocale(LC_ALL, prevLocale);

	return (ch);
}
开发者ID:burner,项目名称:vmime,代码行数:10,代码来源:posixHandler.cpp


示例12: create_cluster

 void create_cluster() {
   Attribute::register_class_names(get_column_names());
   Record * r = make_quuxalot_record();
   ClusterHead ch(r, 0.9953);
   RecordPList rl = get_record_list();
   cBlocking_Operation_By_Coauthors  blocker_coauthor = get_blocker_coathor();
   Cluster::set_reference_patent_tree_pointer( blocker_coauthor.get_patent_tree());
   Cluster * c = new Cluster(ch, rl);
   delete c;
 }
开发者ID:Grace,项目名称:disambiguator,代码行数:10,代码来源:test_cluster.cpp


示例13: cls

void cls(void)
{
	register unsigned short cr, newcr;

	cr = getcr();
	newcr = cr % 80;
	crtmv(0, cr - newcr, newcr);
	crtset(newcr, ch(' '), 80 * 25 - newcr);
	mvcr(newcr);
}
开发者ID:sng7ca,项目名称:ygg,代码行数:10,代码来源:crt1.c


示例14: ch

QString Task::classClass()
{
    XClassHint hint;
    if(XGetClassHint(qt_xdisplay(), _win, &hint)) {
  QString ch( hint.res_class );
  XFree( hint.res_name );
  XFree( hint.res_class );
  return ch;
    }
    return QString::null;
}
开发者ID:serghei,项目名称:kde3-kdeutils,代码行数:11,代码来源:taskmanager.cpp


示例15: main

main()
{
    int t;
    scanf("%d\n",&t);
    while(t--)
    {
        gets(s);
        printf("%c\n",ch());
    }
    return 0;
}
开发者ID:Rohithyeravothula,项目名称:codechef,代码行数:11,代码来源:nologic.c


示例16: uniphier_ld4_bcu_init

void uniphier_ld4_bcu_init(const struct uniphier_board_data *bd)
{
	int shift;

	writel(0x44444444, BCSCR0); /* 0x20000000-0x3fffffff: ASM bus */
	writel(0x11111111, BCSCR2); /* 0x80000000-0x9fffffff: IPPC/IPPD-bus */
	writel(0x11111111, BCSCR3); /* 0xa0000000-0xbfffffff: IPPC/IPPD-bus */
	writel(0x11111111, BCSCR4); /* 0xc0000000-0xdfffffff: IPPC/IPPD-bus */
	writel(0x11111111, BCSCR5); /* 0xe0000000-0Xffffffff: IPPC/IPPD-bus */

	/* Specify DDR channel */
	shift = bd->dram_ch[0].size / 0x04000000 * 4;
	writel(ch(shift), BCIPPCCHR2); /* 0x80000000-0x9fffffff */

	shift -= 32;
	writel(ch(shift), BCIPPCCHR3); /* 0xa0000000-0xbfffffff */

	shift -= 32;
	writel(ch(shift), BCIPPCCHR4); /* 0xc0000000-0xdfffffff */
}
开发者ID:OpenNoah,项目名称:u-boot,代码行数:20,代码来源:bcu-ld4.c


示例17: makeRandomPolygon

void makeRandomPolygon() {
  int n = 3 + rand() % 100; // between 3 and 12 points

  Polygon poly;
  for(int i = 0; i < n; ++i) {
    int XX = rand() % 100;
    int YY = rand() % 100;
    poly.push_back(Point(XX, YY));
  }
  ConvexHull ch(poly);
}
开发者ID:LasseD,项目名称:uva,代码行数:11,代码来源:Pgen137.cpp


示例18: ch

long long ch(long long a,long long b){
	if (a==1)return b;
	long long g,i;
	i=ceill(b/(double)a);
	a=a*i-b;
	b*=i;
	g=gcd(a,b);
	a/=g;
	b/=g;
	return ch(a,b);
}
开发者ID:KimSuHeon,项目名称:BOJ,代码行数:11,代码来源:10253.c


示例19: ch

bool Scheduler::handle_schedule(schedules::target_object item) {
	try {
		std::string response;
		nscapi::core_helper ch(get_core(), get_id());
		if (!ch.simple_query(item->command.c_str(), item->arguments, response)) {
			NSC_LOG_ERROR("Failed to execute: " + item->command);
			if (item->channel.empty()) {
				NSC_LOG_ERROR_WA("No channel specified for ", item->get_alias());
				return true;
			}
			nscapi::protobuf::functions::create_simple_submit_request(item->channel, item->command, NSCAPI::query_return_codes::returnUNKNOWN, "Command was not found: " + item->command, "", response);
			std::string result;
			get_core()->submit_message(item->channel, response, result);
			return true;
		}
		Plugin::QueryResponseMessage resp_msg;
		resp_msg.ParseFromString(response);
		Plugin::QueryResponseMessage resp_msg_send;
		resp_msg_send.mutable_header()->CopyFrom(resp_msg.header());
		BOOST_FOREACH(const Plugin::QueryResponseMessage::Response &p, resp_msg.payload()) {
			if (nscapi::report::matches(item->report, nscapi::protobuf::functions::gbp_to_nagios_status(p.result())))
				resp_msg_send.add_payload()->CopyFrom(p);
		}
		if (resp_msg_send.payload_size() > 0) {
			if (item->channel.empty()) {
				NSC_LOG_ERROR_STD("No channel specified for " + item->get_alias() + " mssage will not be sent.");
				return true;
			}
			nscapi::protobuf::functions::make_submit_from_query(response, item->channel, item->get_alias(), item->target_id, item->source_id);
			std::string result;
			if (!get_core()->submit_message(item->channel, response, result)) {
				NSC_LOG_ERROR_STD("Failed to submit: " + item->get_alias());
				return true;
			}
			std::string error;
			if (!nscapi::protobuf::functions::parse_simple_submit_response(result, error)) {
				NSC_LOG_ERROR_STD("Failed to submit " + item->get_alias() + ": " + error);
				return true;
			}
		} else {
			NSC_DEBUG_MSG("Filter not matched for: " + item->get_alias() + " so nothing is reported");
		}
		return true;
	} catch (nscapi::nscapi_exception &e) {
		NSC_LOG_ERROR_EXR("Failed to register command: ", e);
		return false;
	} catch (std::exception &e) {
		NSC_LOG_ERROR_EXR("Exception: ", e);
		return false;
	} catch (...) {
		NSC_LOG_ERROR_EX(item->get_alias());
		return false;
	}
}
开发者ID:mjesse88,项目名称:nscp,代码行数:54,代码来源:Scheduler.cpp


示例20: convex_hull

Polygon convex_hull(vector<Point> ps) {
  int n = ps.size(), k = 0;
  sort(begin(ps), end(ps), comp);
  Polygon ch(2 * n);
  for (int i = 0; i < n; ch[k++] = ps[i++])
    while (k >= 2 && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;
  for (int i = n - 2, t = k + 1; i >= 0; ch[k++] = ps[i--])
    while (k >= t && ccw(ch[k - 2], ch[k - 1], ps[i]) <= 0) --k;
  ch.resize(k - 1);
  return ch;
}
开发者ID:asi1024,项目名称:ContestLibrary,代码行数:11,代码来源:convex.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ chDbgAssert函数代码示例发布时间:2022-05-30
下一篇:
C++ cgtime函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap