这篇教程C++ IsInt函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中IsInt函数的典型用法代码示例。如果您正苦于以下问题:C++ IsInt函数的具体用法?C++ IsInt怎么用?C++ IsInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了IsInt函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mathWrapIntint mathWrapInt(struct VMGlobals *g, int numArgsPushed){ PyrSlot *a, *b, *c; int err; a = g->sp - 2; b = g->sp - 1; c = g->sp; if (IsSym(b)) { *a = *b; } else if (IsSym(c)) { *a = *c; } else if (IsInt(b) && IsInt(c)) { SetRaw(a, sc_mod((int)(slotRawInt(a) - slotRawInt(b)), (int)(slotRawInt(c) - slotRawInt(b) + 1)) + slotRawInt(b)); } else { double x, lo, hi; x = slotRawInt(a); err = slotDoubleVal(b, &lo); if (err) return err; err = slotDoubleVal(c, &hi); if (err) return err; SetFloat(a, sc_mod(x - lo, hi - lo) + lo); } return errNone;}
开发者ID:danstowell,项目名称:SuperCute,代码行数:26,
示例2: ASSERT_VALIDbool CTag::WriteTagToFile(CFileDataIO* file, EUtf8Str eStrEncode) const{ ASSERT_VALID(this); // don't write tags of unknown types, we wouldn't be able to read them in again // and the met file would be corrupted if (IsStr() || IsInt() || IsFloat() || IsBlob() || IsInt64()) { file->WriteUInt8(m_uType); if (m_pszName) { UINT taglen = strlen(m_pszName); file->WriteUInt16((uint16)taglen); file->Write(m_pszName, taglen); } else { file->WriteUInt16(1); file->WriteUInt8(m_uName); } if (IsStr()) { file->WriteString(GetStr(), eStrEncode); } else if (IsInt()) { file->WriteUInt32((uint32)m_uVal); } else if (IsInt64(false)) { file->WriteUInt64(m_uVal); } else if (IsFloat()) { file->Write(&m_fVal, 4); } else if (IsBlob()) { // NOTE: This will break backward compatibility with met files for eMule versions prior to 0.44a file->WriteUInt32(m_nBlobSize); file->Write(m_pData, m_nBlobSize); } //TODO: Support more tag types else { TRACE("%s; Unknown tag: type=0x%02X/n", __FUNCTION__, m_uType); ASSERT(0); return false; } return true; } else { TRACE("%s; Ignored tag with unknown type=0x%02X/n", __FUNCTION__, m_uType); ASSERT(0); return false; }}
开发者ID:SomeSupport,项目名称:eMule,代码行数:60,
示例3: mathFoldIntint mathFoldInt(struct VMGlobals *g, int numArgsPushed){ PyrSlot *a, *b, *c; int err; a = g->sp - 2; b = g->sp - 1; c = g->sp; if (IsSym(b)) { *a = *b; } else if (IsSym(c)) { *a = *c; } else if (IsInt(b) && IsInt(c)) { SetRaw(a, sc_fold(slotRawInt(a), slotRawInt(b), slotRawInt(c))); } else { double x, lo, hi; x = slotRawInt(a); err = slotDoubleVal(b, &lo); if (err) return err; err = slotDoubleVal(c, &hi); if (err) return err; SetFloat(a, sc_fold(x, lo, hi)); } return errNone;}
开发者ID:danstowell,项目名称:SuperCute,代码行数:26,
示例4: ReadPhylip/* Function: ReadPhylip() * Date: SRE, Fri Jun 18 12:59:37 1999 [Sanger Centre] * * Purpose: Parse an alignment from an open Phylip format * alignment file. Phylip is a single-alignment format. * Return the alignment, or NULL if we have no data. * * Args: afp - open alignment file * * Returns: MSA * - an alignment object * Caller responsible for an MSAFree() * NULL if no more alignments */MSA *ReadPhylip(MSAFILE *afp){ MSA *msa; char *s, *s1, *s2; char name[11]; /* seq name max len = 10 char */ int nseq, alen; int idx; /* index of current sequence */ int slen; int nblock; if (feof(afp->f)) return NULL; /* Skip until we see a nonblank line; it's the header, * containing nseq/alen */ nseq = 0; alen = 0; while ((s = MSAFileGetLine(afp)) != NULL) { if ((s1 = sre_strtok(&s, WHITESPACE, NULL)) == NULL) continue; if ((s2 = sre_strtok(&s, WHITESPACE, NULL)) == NULL) Die("Failed to parse nseq/alen from first line of PHYLIP file %s/n", afp->fname); if (! IsInt(s1) || ! IsInt(s2)) Die("nseq and/or alen not an integer in first line of PHYLIP file %s/n", afp->fname); nseq = atoi(s1); alen = atoi(s2); break; } msa = MSAAlloc(nseq, 0); idx = 0; nblock = 0; while ((s = MSAFileGetLine(afp)) != NULL) { /* ignore blank lines. nonblank lines start w/ nonblank char */ if (isspace(*s)) continue; /* First block has seq names */ if (nblock == 0) { strncpy(name, s, 10); name[10] = '/0'; GKIStoreKey(msa->index, name); msa->sqname[idx] = sre_strdup(name, -1); s += 10; } /* be careful of trailing whitespace on lines */ if ((s1 = sre_strtok(&s, WHITESPACE, &slen)) == NULL) Die("Failed to parse sequence at line %d of PHYLIP file %s/n", afp->linenumber, afp->fname); msa->sqlen[idx] = sre_strcat(&(msa->aseq[idx]), msa->sqlen[idx], s1, slen); idx++; if (idx == nseq) { idx = 0; nblock++; } } msa->nseq = nseq; MSAVerifyParse(msa); /* verifies; sets alen, wgt; frees sqlen[] */ return msa;}
开发者ID:PWilsonUofC,项目名称:VGenes,代码行数:70,
示例5: GetColorFromInts///---------------------------------------------------------------------------------//////---------------------------------------------------------------------------------bool DeveloperConsoleArguments::GetColorFromInts( Rgba& color ){ std::string string = ""; if (PeekString( string )) { if (IsInt( string )) { color.r = (char)strtol( string.c_str(), nullptr, 10 ); m_currentIndex++; } else return false; } if (PeekString( string )) { if (IsInt( string )) { color.g = (char)strtol( string.c_str(), nullptr, 10 ); m_currentIndex++; } else return false; } if (PeekString( string )) { if (IsInt( string )) { color.b = (char)strtol( string.c_str(), nullptr, 10 ); m_currentIndex++; } else return false; } if (PeekString( string )) { if (IsInt( string )) { color.a = (char)strtol( string.c_str(), nullptr, 10 ); m_currentIndex++; return true; } else return false; } return false;}
开发者ID:tbgeorge,项目名称:putty_engine,代码行数:53,
示例6: PriorityQueueAddvoid PriorityQueueAdd(struct VMGlobals *g, PyrObject* queueobj, PyrSlot* item, double time){ PyrObject *schedq, *newschedq; int size, maxsize; PyrSlot *schedqSlot = queueobj->slots; if (!IsObj(schedqSlot)) { size = 32; schedq = newPyrArray(g->gc, size, 0, true); schedq->size = 1; SetInt(schedq->slots + 0, 0); // stability count SetObject(schedqSlot, schedq); g->gc->GCWriteNew(queueobj, schedq); // we know schedq is white so we can use GCWriteNew } else { schedq = slotRawObject(schedqSlot); maxsize = ARRAYMAXINDEXSIZE(schedq); size = schedq->size; if (size+3 > maxsize) { newschedq = newPyrArray(g->gc, maxsize*2, 0, true); newschedq->size = size; slotCopy(newschedq->slots, schedq->slots, size); assert(IsInt(newschedq->slots)); SetObject(schedqSlot, newschedq); g->gc->GCWriteNew(queueobj, newschedq); // we know newschedq is white so we can use GCWriteNew schedq = newschedq; } } addheap(g, schedq, time, item);}
开发者ID:bagong,项目名称:supercollider,代码行数:34,
示例7: SetValue void Table::SetValue(const Value &key, const Value &value) { // Try array part if (key.type_ == ValueT_Number && IsInt(key.num_)) { if (SetArrayValue(static_cast<std::size_t>(key.num_), value)) return ; } // Hash part if (!hash_) { // If value is nil and hash part is not existed, then do nothing if (value.IsNil()) return ; hash_.reset(new Hash); } auto it = hash_->find(key); if (it != hash_->end()) { // If value is nil, then just erase the element if (value.IsNil()) hash_->erase(it); else it->second = value; } else { // If key is not existed and value is not nil, then insert it if (!value.IsNil()) hash_->insert(std::make_pair(key, value)); } }
开发者ID:Gwill,项目名称:luna,代码行数:34,
示例8: prSetControlBusValuesint prSetControlBusValues(VMGlobals *g, int numArgsPushed){ PyrSlot *a = g->sp - 2; PyrSlot *b = g->sp - 1; PyrSlot *c = g->sp; assert(IsObj(a)); PyrObject * self = slotRawObject(a); int ptrIndex = 0; PyrSlot * ptrSlot = self->slots + ptrIndex; if (NotPtr(ptrSlot)) return errFailed; if (!IsInt(b)) return errFailed; int busIndex = slotRawInt(b); if (!IsObj(c)) return errFailed; PyrObject * values = slotRawObject(c); server_shared_memory_client * client = (server_shared_memory_client*)slotRawPtr(ptrSlot); float * control_busses = client->get_control_busses() + busIndex; for (int i = 0; i != values->size; ++i) { float value; int error = slotFloatVal(values->slots + i, &value); if (error != errNone) return error; control_busses[i] = value; } return errNone;}
开发者ID:robertol80,项目名称:supercollider,代码行数:35,
示例9: prSetControlBusValueint prSetControlBusValue(VMGlobals *g, int numArgsPushed){ PyrSlot *a = g->sp - 2; PyrSlot *b = g->sp - 1; PyrSlot *c = g->sp; assert(IsObj(a)); PyrObject * self = slotRawObject(a); int ptrIndex = 0; PyrSlot * ptrSlot = self->slots + ptrIndex; if (NotPtr(ptrSlot)) return errFailed; if (!IsInt(b)) return errFailed; int busIndex = slotRawInt(b); if (NotPtr(ptrSlot)) return errFailed; float value; int error = slotFloatVal(c, &value); if (error != errNone) return error; server_shared_memory_client * client = (server_shared_memory_client*)slotRawPtr(ptrSlot); client->get_control_busses()[busIndex] = value; return errNone;}
开发者ID:robertol80,项目名称:supercollider,代码行数:31,
示例10: prArray_OSCBytesint prArray_OSCBytes(VMGlobals *g, int numArgsPushed){ PyrSlot* a = g->sp; PyrObject *array = a->uo; PyrSlot* args = array->slots; int numargs = array->size; if (numargs < 1) return errFailed; big_scpacket packet; if (IsFloat(args) || IsNil(args) || IsInt(args)) { makeSynthBundle(&packet, args, numargs, false); } else if (IsSym(args) || isKindOfSlot(args, class_string)) { makeSynthMsgWithTags(&packet, args, numargs); } else { return errWrongType; } int size = packet.size(); PyrInt8Array* obj = newPyrInt8Array(g->gc, size, 0, true); obj->size = size; memcpy(obj->b, packet.data(), size); SetObject(a, (PyrObject*)obj); //for (int i=0; i<packet.size()/4; i++) post("%d %08X/n", i, packet.buf[i]); return errNone;}
开发者ID:scztt,项目名称:sc-debug,代码行数:26,
示例11: markChildrenvoid markChildren(word* p, int s[]){ if(Color(p[0]) == White){ p[0] = Paint(p[0], Black); for(int i = 1; i <= Length(p[0]); i++){ if(!IsInt(p[i]) && p[i] != 0) markChildren((word*) p[i], s); } }}
开发者ID:Tymli,项目名称:BPRDAssignments,代码行数:8,
示例12: ParseInt bool BaseParser::ParseInt(const std::string& value, int& ret) { if(IsInt(value) == false) { return false; } ret = strtol(value.c_str(), nullptr, 10); return true; }
开发者ID:johndragon,项目名称:ld3d,代码行数:9,
示例13: GetStr/////////////////////////////////////////////////// Prolog-ValueTStr TPlVal::GetStr(TPlBs* PlBs) const { TChA ChA; if (IsInt()){ChA+=TInt::GetStr(GetInt());} else if (IsFlt()){ChA+=TFlt::GetStr(GetFlt());} else if (IsAtom()){ChA+=PlBs->GetAtomQStr(GetAtomId());} else if (IsTup()){PPlTup Tup=PlBs->GetTup(GetTupId()); ChA+=Tup->GetStr(PlBs);} else {Fail;} return ChA;}
开发者ID:SherlockYang,项目名称:Archive,代码行数:11,
示例14: markPhasevoid markPhase(int s[], int sp) { printf("marking .../n"); while(sp > 0){ if(!IsInt(s[sp]) && s[sp] != 0) { markChildren((word*) s[sp],s); } sp--; }}
开发者ID:Tymli,项目名称:BPRDAssignments,代码行数:9,
示例15: markPhase//Mark all headers referenced from the stackvoid markPhase(int s[], int sp) { printf("marking .../n"); int i; for(i = 0; i<sp; i++){ if(!IsInt(s[i]) && s[i] != 0){ mark((word *)s[i]); } }}
开发者ID:hyllekilde,项目名称:mier_mhyl_OO3,代码行数:10,
示例16: markPhasevoid markPhase(int s[], int sp) { printf("/nmarking .../n"); int n; for (n = 0; n < sp; n++) { if (!IsInt(s[n]) && s[n] != 0) { mark(s[n]); } }}
开发者ID:Jegp,项目名称:BOSC,代码行数:10,
示例17: markPhase/* Marks heap references in the stack */void markPhase(int s[], int sp) { printf("/nmarking .../n"); int i; for(i = 0; i < sp; i++) /* Step A */ { if(!IsInt(s[i]) && (s[i]) != 0) // If item on stack is not an integer and is not nil, convert it to a word reference and mark it { word* block = ((word*) s[i]); block[0] = Paint(block[0], Grey); } } int goAgain = 1; word* b; int j; while(goAgain) { goAgain = 0; for(i = 0; i < HEAPSIZE; i += Length(b[0]) + 1) // To iterate over all the blocks in the heap we increment i by length of b + 1. { b = (word*) &heap[i]; // Get address of the block in the heap if(Color(b[0]) == Grey) { b[0] = Paint(b[0], Black); for(j = 1; j <= Length(b[0]); j++) // Go through all words in the block b { if(!IsInt(b[j]) && b[j] != 0) { word* rblock = (word*) b[j]; // We need to get the word pointer to be able to colour the header if(Color(rblock[0]) == White) { rblock[0] = Paint(rblock[0], Grey); goAgain = 1; // Every time we paint a block grey, we need to check recheck heap for grey blocks. } } } } } }}
开发者ID:esfdk,项目名称:BOSC,代码行数:43,
示例18: printStackAndPcvoid printStackAndPc(int s[], int bp, int sp, int p[], int pc) { printf("[ "); int i; for (i=0; i<=sp; i++) if (IsInt(s[i])) printf("%d ", Untag(s[i])); else printf("#%d ", s[i]); printf("]"); printf("{%d:", pc); printInstruction(p, pc); printf("}/n"); }
开发者ID:tollstorff,项目名称:BOSC-handin-3,代码行数:11,
示例19: markvoid mark(word* block) { if (Color(block[0]) == White) { block[0] = Paint(block[0], Black); int i; for (i = 1; i <= Length(block[0]); i++) { if (!IsInt(block[i]) && block[i] != 0) { mark(block[i]); } } }}
开发者ID:Nift,项目名称:BPRD-Exercises,代码行数:11,
示例20: FLEXT_TEMPIMPL/*! /todo there is probably also a shortcut for Max and jMax /todo size checking*/FLEXT_TEMPIMPL(void FLEXT_CLASSDEF(flext))::GetAString(const t_atom &a,char *buf,size_t szbuf){ #if FLEXT_SYS == FLEXT_SYS_PD atom_string(const_cast<t_atom *>(&a),buf,(int)szbuf);#else if(IsSymbol(a)) STD::strncpy(buf,GetString(a),szbuf); else if(IsFloat(a)) STD::snprintf(buf,szbuf,"%f",GetFloat(a)); else if(IsInt(a)) STD::snprintf(buf,szbuf,"%i",GetInt(a)); else *buf = 0;#endif}
开发者ID:Angeldude,项目名称:pd,代码行数:14,
示例21: mark//Marks the headers black recursivelyvoid mark(word* block){ //Paint header black if color is white and not 0 if(Color(block[0])==White && block[0] != 0){ block[0] = Paint(block[0], Black); //Mark recursively if one of the elements in the block is a reference int i; for(i=1; i<=Length(block[0]); i++){ if(!IsInt(block[i]) && block[i] != 0 && Color(block[i]) != Black) mark((word *)block[i]); } }}
开发者ID:hyllekilde,项目名称:mier_mhyl_OO3,代码行数:13,
示例22: markPhase/* Marks heap references in the stack */void markPhase(int s[], int sp) { printf("/nmarking .../n"); /*Step A*/ int i; for(i = 0; i < sp; i++) { if(!IsInt(s[i]) && (s[i]) != 0) // If item on stack is not an integer and is not nil, convert it to a word reference and mark it { mark((word*) s[i]); } }}
开发者ID:esfdk,项目名称:BOSC,代码行数:13,
示例23: AsInt int Value::AsInt() const { if (IsNull()) return 0; else { if (IsInt() || IsDouble()) { std::stringstream sstr(valueStr); int val; sstr >> val; return val; } else throw ValueException();
开发者ID:mqudsi,项目名称:Jzon,代码行数:15,
示例24: prGetControlBusValuesint prGetControlBusValues(VMGlobals *g, int numArgsPushed){ PyrSlot *a = g->sp - 2; PyrSlot *b = g->sp - 1; PyrSlot *c = g->sp; assert(IsObj(a)); PyrObject * self = slotRawObject(a); int ptrIndex = 0; PyrSlot * ptrSlot = self->slots + ptrIndex; if (NotPtr(ptrSlot)) return errFailed; if (!IsInt(b)) return errFailed; int busIndex = slotRawInt(b); if (!IsInt(c)) return errFailed; int numberOfChannels = slotRawInt(c); server_shared_memory_client * client = (server_shared_memory_client*)slotRawPtr(ptrSlot); PyrObject * ret = newPyrArray(g->gc, numberOfChannels, 0, 1); ret->size = numberOfChannels; for (int i = 0; i != numberOfChannels; ++i) { float value = client->get_control_busses()[busIndex + i]; SetFloat(ret->slots+i, value); } SetObject(a, ret); return errNone;}
开发者ID:robertol80,项目名称:supercollider,代码行数:36,
示例25: GetInt///---------------------------------------------------------------------------------//////---------------------------------------------------------------------------------bool DeveloperConsoleArguments::GetInt( int& integer ){ std::string string = ""; if (PeekString( string )) { if (IsInt( string )) { integer = strtol( string.c_str(), nullptr, 10 ); m_currentIndex++; return true; } return false; } return false;}
开发者ID:tbgeorge,项目名称:putty_engine,代码行数:19,
示例26: WXUNUSEDbool CTag::WriteTagToFile(CFileDataIO* file, EUtf8Str WXUNUSED(eStrEncode), bool restrictive) const{ // Don't write tags of unknown types, we wouldn't be able to read them in again // and the met file would be corrupted if (!restrictive || (IsStr() || IsInt() || IsFloat() || IsBlob())) { // If this fails, it'll throw. file->WriteTag(*this); return true; } else { printf("%s; Ignored tag with unknown type=0x%02X/n", __FUNCTION__, m_uType); return false; }}
开发者ID:windreamer,项目名称:amule-dlp,代码行数:16,
示例27: num/// Export a number to a string in given base to given base digits// FIXME API breach: aPrecision is supposed to be in digits, not bitsvoid BigNumber::ToString(LispString& aResult, int aBasePrecision, int aBase) const{ ANumber num(*iNumber);// num.CopyFrom(*iNumber); //TODO this round-off code is not correct yet, but will work in most cases // This is a bit of a messy way to round off numbers. It is probably incorrect, // even. When precision drops one digit, it rounds off the last ten digits. // So the following code is probably only correct if aPrecision>=num.iPrecision // or if aPrecision < num.iPrecision-10 if (aBasePrecision<num.iPrecision) { if (num.iExp > 1) num.RoundBits(); } num.ChangePrecision(aBasePrecision); if (!IsInt()) { for(;;) { const int ns = num.size(); bool greaterOne = false; if (num.iExp >= int(ns)) break; for (int i=num.iExp;i<ns;i++) { if (num[i] != 0) { if (!(i==num.iExp && num[i]<10000 && num.iTensExp == 0)) { greaterOne=true; break; } } } if (!greaterOne) break; PlatDoubleWord carry=0; BaseDivideInt(num,10, WordBase, carry); num.iTensExp++; } } ANumberToString(aResult, num, aBase,(iType == KFloat));}
开发者ID:cran,项目名称:Ryacas,代码行数:47,
示例28: SetValue void Table::SetValue(const Value &key, const Value &value) { // Try array part if (key.type_ == ValueT_Number && IsInt(key.num_)) { if (SetArrayValue(static_cast<std::size_t>(key.num_), value)) return ; } // Hash part if (!hash_) hash_.reset(new Hash); auto it = hash_->find(key); if (it != hash_->end()) it->second = value; else hash_->insert(std::make_pair(key, value)); }
开发者ID:codepongo,项目名称:luna,代码行数:19,
示例29: GetValue Value Table::GetValue(const Value &key) const { // Get from array first if (key.type_ == ValueT_Number && IsInt(key.num_)) { std::size_t index = static_cast<std::size_t>(key.num_); if (index >= 1 && index <= ArraySize()) return (*array_)[index - 1]; } // Get from hash table if (hash_) { auto it = hash_->find(key); if (it != hash_->end()) return it->second; } // key not exist return Value(); }
开发者ID:Gwill,项目名称:luna,代码行数:21,
注:本文中的IsInt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ IsItemIn函数代码示例 C++ IsInside函数代码示例 |