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

C++ IsNumber函数代码示例

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

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



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

示例1: IsNumber

bool Value::
IsNumber (int &i) const
{
	long long i2;
	if ( IsNumber( i2 ) ) {
		i = (int)i2;		// truncation
		return true;
	} else {
		return false;
	}
}
开发者ID:emaste,项目名称:htcondor,代码行数:11,代码来源:value.cpp


示例2: GetValueAsNumber

double AnnotationValue::GetValueAsNumber() const
{
	if (!IsNumber())
	{
		std::stringstream ss;
		ss << "Attempted to access " << GetTypeString()
			<< " annotation as a number.";
		throw AnnotationValueTypeException(ss.str());
	}
	return boost::get<double>(value);
}
开发者ID:TimSimpson,项目名称:Macaroni,代码行数:11,代码来源:AnnotationValue.cpp


示例3: TITANIUM_FUNCTION

		TITANIUM_FUNCTION(TableView, deleteSection)
		{
			if (arguments.size() < 2) {
				return get_context().CreateUndefined();
			} else if (arguments.size() >= 2) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsNumber());
				const auto _1 = arguments.at(1);
				TITANIUM_ASSERT(_1.IsObject());
				const uint32_t section = static_cast<uint32_t>(_0);
				const auto animation = static_cast<JSObject>(_1);
				deleteSection(section, animation.GetPrivate<TableViewAnimationProperties>());
			} else if (arguments.size() >= 1) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsNumber());
				const uint32_t section = static_cast<uint32_t>(_0);
				const auto animation = get_context().CreateObject();
				deleteSection(section, animation.GetPrivate<TableViewAnimationProperties>());
			}
			return get_context().CreateUndefined();
		}
开发者ID:FokkeZB,项目名称:titanium_mobile_windows,代码行数:21,代码来源:TableView.cpp


示例4: TITANIUM_FUNCTION

		TITANIUM_FUNCTION(ResultSet, fieldByName)
		{
			ENSURE_STRING_AT_INDEX(name, 0);

			if (arguments.size() > 1) {
				const auto _1 = arguments.at(1);
				TITANIUM_ASSERT(_1.IsNumber());
				const auto fieldType = Constants::to_FIELD_TYPE(static_cast<std::underlying_type<FIELD_TYPE>::type>(_1));
				return fieldByName(name, fieldType);
			}
			return fieldByName(name);
		}
开发者ID:appcelerator-forks,项目名称:appcelerator.titanium_mobile_windows,代码行数:12,代码来源:ResultSet.cpp


示例5: Jsonize

template<> void Jsonize(JsonIO& io, bool& var)
{
	if(io.IsLoading()) {
		const Value& v = io.Get();
		if(IsNumber(v) && !IsNull(v))
			var = (bool)v;
		else
			throw JsonizeError("boolean expected");
	}
	else
		io.Set(var);
}
开发者ID:kolyden,项目名称:mirror,代码行数:12,代码来源:JSON.cpp


示例6: ExtractNumber

//++
// Details: Extract the number from the string. The number can be either a
// hexadecimal or
//          natural number. It cannot contain other non-numeric characters.
// Type:    Method.
// Args:    vwrNumber   - (W) Number extracted from the string.
// Return:  bool - True = yes number, false not a number.
// Throws:  None.
//--
bool CMIUtilString::ExtractNumber(MIint64 &vwrNumber) const {
  vwrNumber = 0;

  if (!IsNumber()) {
    return ExtractNumberFromHexadecimal(vwrNumber);
  }

  std::stringstream ss(const_cast<CMIUtilString &>(*this));
  ss >> vwrNumber;

  return true;
}
开发者ID:llvm-project,项目名称:lldb,代码行数:21,代码来源:MIUtilString.cpp


示例7: SortSoftClippedReads

bool SoftClipRead::SortSoftClippedReads(SoftClipRead scRead1, SoftClipRead scRead2)
{
	std::string chromosome1 = scRead1.chromosome.substr(3,std::strlen(scRead1.chromosome.c_str()) - 2);
	std::string chromosome2 = scRead2.chromosome.substr(3,std::strlen(scRead2.chromosome.c_str()) - 2);


	if(IsNumber(chromosome1) && IsNumber(chromosome2))
	{
		if (atoi(chromosome1.c_str()) == atoi(chromosome2.c_str()))
			return scRead1.softclip_start > scRead2.softclip_start;
		return atoi(chromosome1.c_str()) > atoi(chromosome2.c_str());
		return false;
	}
	else
	{
		if(chromosome1 == chromosome2)
			return scRead1.softclip_start > scRead2.softclip_start;
		return chromosome1 > chromosome2;
		return false;
	}
}
开发者ID:ResearchDx,项目名称:HardSearch,代码行数:21,代码来源:SoftClipRead.cpp


示例8: IsNumber2

bool IsNumber2(const Value &val) {
	if (IsNull(val))
		return false;
	if (IsNumber(val))
		return true;
	if (IsString(val)) {
		double d = ScanDouble(val.ToString());
		if (!IsNull(d))
			return true;
	}
	return false;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:12,代码来源:Regression.cpp


示例9: FormatXmlRpcValue

String FormatXmlRpcValue(const Value& _v)
{
	String r;
	Value v = _v;
	if(v.GetType() == INT64_V) {
		int64 x = v;
		if((int)x == x)
			v = (int)x;
	}
	if(IsNull(v) && !IsString(v) && !IsValueArray(v))
		r = XmlTag("nil")();
	else
	if(v.GetType() == INT_V)
		r = XmlTag("int")(Format("%d", (int)v));
	else
	if(v.GetType() == BOOL_V)
		r = XmlTag("boolean")(AsString((int)(bool)v));
	else
	if(IsNumber(v))
		r = XmlTag("double")(Format("%.16g", (double)v));
	else
	if(IsDateTime(v)) {
		Time t = v;
		r = XmlTag("dateTime.iso8601")
					(Format("%04.4d%02.2d%02.2d`T%02.2d`:%02.2d`:%02.2d",
					        t.year, t.month, t.day, t.hour, t.minute, t.second));
	}
	else
	if(v.GetType() == VALUEMAP_V) {
		r = "<struct>";
		ValueMap vm = v;
		const Index<Value>& k = vm.GetKeys();
		ValueArray va = vm.GetValues();
		for(int i = 0; i < k.GetCount(); i++)
			r << XmlTag("member")(XmlTag("name")(k[i]) + FormatXmlRpcValue(va[i]));
		r << "</struct>";
	}
	else
	if(v.GetType() == VALUEARRAY_V) {
		r = "<array><data>";
		ValueArray va = v;
		for(int i = 0; i < va.GetCount(); i++)
			r << FormatXmlRpcValue(va[i]);
		r << "</data></array>";
	}
	else
	if(v.Is<RawJsonText>())
		r = XmlTag("string").Text(v.To<RawJsonText>().json);
	else
		r = XmlTag("string").Text(v);
	return XmlTag("value")(r);
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:52,代码来源:Xml.cpp


示例10: getLiteral

int ObjLexer::AddNewToken(Token::Type const& type, int i, std::string const& raw_object)
{
  Token new_token;
  new_token.SetType(type);

  std::string str = getLiteral(i, raw_object);
  if (IsNumber(str))
    new_token.SetFloat(StringToNumber<float>(str));

  tokens_.push(new_token);

  return str.size();
}
开发者ID:BrandonSchaefer,项目名称:ObjectLoader,代码行数:13,代码来源:ObjLexer.cpp


示例11: SetEmpty

void CppScanner::GetNext()
{
	SetEmpty();
	SkipWhitespace();
	if (f.Get() == '/') { SkipComment(); SkipWhitespace(); }

	char ch = f.Get();
	if (IsNumber(ch) || (ch == '+') || (ch == '-')) GetNumber();
	else if (IsAlpha(ch)) GetName();
	else if (ch == '(' || ch == ')' || ch == '<' || ch == '>' || ch == '=' || ch == ',' || ch == ';' || ch == '&')
	{ type = CToken::DELIMITER; delimiter = ch; f.GetNext(); }
	else throw CPError(CPError::UNKNOWN_CHARACTER);
}
开发者ID:psi46,项目名称:tools,代码行数:13,代码来源:cpp_scanner.cpp


示例12: while

Token* Scanner::GetNumber(char currentChar) {
	string s = "";
	int pos = currentPos, line = currentLine, dot = 0, E = 0;
	s += currentChar;

	while( (currentChar = GetChar()) != '\0' && !IsSpace(currentChar)) {
		if(dot && IsDot(currentChar)) 
			throw ScannerException(currentLine, currentPos, "Too many dots in real number: \"" + GetInvalidToken(pos) + "\"");

		if(E) {
			if(IsE(currentChar)) 
				throw ScannerException(currentLine, currentPos, "Too many symbol \"E\" in real number: \"" + GetInvalidToken(pos) + "\"");

			if(IsNumber(currentChar) || currentChar == '-' || currentChar == '+') {
				s += currentChar;
				continue;
			}
			else
				throw ScannerException(currentLine, currentPos, "Invalid real number: \"" + GetInvalidToken(pos) + "\"");
		}

		if( IsNumber(currentChar) || IsE(currentChar) || IsDot(currentChar) ) {
			E += IsE(currentChar);
			dot += IsDot(currentChar);
			s += currentChar;
		}
		else {
			if(IsLetter(currentChar)) 
				throw ScannerException(currentLine, currentPos, "Invalid identificator: \"" + GetInvalidToken(pos) + "\"");

			BackToPreviousChar();
			break;
		}
	}
	if(IsE(s[s.length() - 1]) || IsDot(s[s.length() - 1])) 
		throw ScannerException(currentLine, currentPos, "Invalid real number: \"" + s + "\"");

	return new Token(line, pos, dot || E ? CONST_REAL : CONST_INTEGER, DEFAULT, s);
}
开发者ID:forsaken1,项目名称:compiler,代码行数:39,代码来源:scanner.cpp


示例13: ASSERT

int CALLBACK CSortListCtrl::CompareFunction( LPARAM lParam1, LPARAM lParam2, LPARAM lParamData )
{
	CSortListCtrl* pListCtrl = reinterpret_cast<CSortListCtrl*>( lParamData );
	ASSERT( pListCtrl->IsKindOf( RUNTIME_CLASS( CListCtrl ) ) );

	ItemData* pid1 = reinterpret_cast<ItemData*>( lParam1 );
	ItemData* pid2 = reinterpret_cast<ItemData*>( lParam2 );

	ASSERT( pid1 );
	ASSERT( pid2 );

	LPCTSTR pszText1 = pid1->arrpsz[ pListCtrl->m_iSortColumn ];
	LPCTSTR pszText2 = pid2->arrpsz[ pListCtrl->m_iSortColumn ];

	ASSERT_VALID_STRING( pszText1 );
	ASSERT_VALID_STRING( pszText2 );

	if( IsNumber( pszText1 ) && IsNumber( pszText2 ))
		return pListCtrl->m_bSortAscending ? NumberCompare( pszText1, pszText2 ) : NumberCompare( pszText2, pszText1 );
	else
		// text.
		return pListCtrl->m_bSortAscending ? lstrcmp( pszText1, pszText2 ) : lstrcmp( pszText2, pszText1 );
}
开发者ID:dyao-vu,项目名称:meta-core,代码行数:23,代码来源:SortListCtrl.cpp


示例14: TITANIUM_FUNCTION

		TITANIUM_FUNCTION(ListSection, deleteItemsAt)
		{
			const auto js_context = this_object.get_context();
			if (arguments.size() >= 2) {
				const auto _0 = arguments.at(0);
				TITANIUM_ASSERT(_0.IsNumber());
				const auto _1 = arguments.at(1);
				TITANIUM_ASSERT(_1.IsNumber());

				JSObject animation = js_context.CreateObject();
				const auto itemIndex = static_cast<std::uint32_t>(_0);
				const auto count = static_cast<std::uint32_t>(_1);

				if (arguments.size() >= 3) {
					const auto _2 = arguments.at(2);
					if (_2.IsObject()) {
						animation = listviewAnimationProperties_ctor__.CallAsConstructor({ _2 });
					}
				}
				deleteItemsAt(itemIndex, count, animation.GetPrivate<ListViewAnimationProperties>());
			}
			return get_context().CreateUndefined();
		}
开发者ID:jonasbjurhult,项目名称:titanium_mobile_windows,代码行数:23,代码来源:ListSection.cpp


示例15: UpdateData

void CEditKDATADlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData( );

	if( !IsNumber( m_strOpen, FALSE ) || !IsNumber( m_strHigh, FALSE )
		|| !IsNumber( m_strLow, FALSE ) || !IsNumber( m_strClose, FALSE ) )
	{
		AfxMessageBox( IDS_EDITKDATA_NOTNUMBER, MB_OK|MB_ICONINFORMATION );
		return;
	}

	CSPTime	sptime( m_tmDate.GetTime() );
	m_kd.m_date		=	sptime.ToStockTime( CKData::IsDayOrMin(m_nKType) );
	m_kd.m_fOpen	=	(float)atof(m_strOpen);
	m_kd.m_fHigh	=	(float)atof(m_strHigh);
	m_kd.m_fLow		=	(float)atof(m_strLow);
	m_kd.m_fClose	=	(float)atof(m_strClose);
	m_kd.m_fVolume	=	(float)m_dwVolume*100;
	m_kd.m_fAmount	=	(float)m_dwAmount*1000;

	CXFDialog::OnOK();
}
开发者ID:darwinbeing,项目名称:trade,代码行数:23,代码来源:EditKDATADlg.cpp


示例16: LispCharString

void LispCharString(LispEnvironment& aEnvironment, LispInt aStackTop)
{
  const LispString* str = ARGUMENT(1)->String();
  CheckArg(str, 2, aEnvironment, aStackTop);
  CheckArg(IsNumber(str->c_str(), false), 2, aEnvironment, aStackTop);
  LispInt asciiCode = InternalAsciiToInt(*str);

  LispChar ascii[4];
  ascii[0] = '\"';
  ascii[1] = (LispChar)asciiCode;
  ascii[2] = '\"';
  ascii[3] = '\0';
  RESULT = (LispAtom::New(aEnvironment,ascii));
}
开发者ID:grzegorzmazur,项目名称:ryacas,代码行数:14,代码来源:mathcommands2.cpp


示例17: if

bool ezVariant::operator==(const ezVariant& other) const
{
  if (IsFloatingPoint(m_Type) && IsNumber(other.m_Type))
  {
    return ConvertNumber<double>() == other.ConvertNumber<double>();
  }
  else if (IsNumber(m_Type) && IsNumber(other.m_Type))
  {
    return ConvertNumber<ezInt64>() == other.ConvertNumber<ezInt64>();
  }
  else if (m_Type == other.m_Type)
  {
    CompareFunc compareFunc;
    compareFunc.m_pThis = this;
    compareFunc.m_pOther = &other;

    DispatchTo(compareFunc, GetType());

    return compareFunc.m_bResult;
  }
    
  return false;
}
开发者ID:blittle,项目名称:ezEngine,代码行数:23,代码来源:Variant.cpp


示例18: GetParStr

bool cConsole::cfAddPerlScript::operator()()
{
	string scriptfile, pathname, filename;
	bool number = false;
	int num = 0;
	GetParStr(1, scriptfile);
	vector<cPerlInterpreter *>::iterator it;
	cPerlInterpreter *pi;

	if (IsNumber(scriptfile.c_str())) {
		num = atoi(scriptfile.c_str());
		number = true;
	}
	cServerDC *server= cServerDC::sCurrentServer;
	pathname = server->mConfigBaseDir;


	if(number) {
		DIR *dir = opendir(pathname.c_str());
		int i = 0;
		if(!dir) {
			(*mOS) << autosprintf(_("Failed loading directory %s."), pathname.c_str()) << " ";
			return false;
		}
		struct dirent *dent = NULL;

		while(NULL != (dent=readdir(dir))) {

			filename = dent->d_name;
			if((filename.size() > 4) && (StrCompare(filename,filename.size()-3,3,".pl")==0)) {
				if(i == num)
					scriptfile = pathname + "/" + filename;
				i++;
			}

		}
		closedir(dir);
	}
	char *argv[] = { (char*)"", (char*)scriptfile.c_str(), NULL };
	for(it = GetPI()->mPerl.mPerl.begin(); it != GetPI()->mPerl.mPerl.end(); ++it) {
		pi = *it;
		if (StrCompare(pi->mScriptName,0,pi->mScriptName.size(),scriptfile)==0) {
			(*mOS) << autosprintf(_("Script %s is already running."), scriptfile.c_str()) << " ";
			return false;
		}
	}
	GetPI()->mPerl.Parse(2, argv);
	(*mOS) << autosprintf(_("Script %s is now running."), scriptfile.c_str()) << " ";
	return true;
}
开发者ID:HalooWd,项目名称:verlihub-1.0.0,代码行数:50,代码来源:cconsole.cpp


示例19: CheckForNumber

static BOOL CheckForNumber(char * String)
{
    return IsNumber(String);

    errno = 0;
    char* p = String;
    unsigned long test = strtol(String, &p, 10);
    if ((errno != 0) || (String == p) || (*p != 0))
    {
        return FALSE;
    }

    return TRUE;
}
开发者ID:douglassanoja,项目名称:LDmicro,代码行数:14,代码来源:iolist.cpp


示例20: GetWindowText

void CNumberEdit::ProcessTextChangingMessage()
{
	CString csOrigText;
	GetWindowText(csOrigText);

	Default();

	CString csNewText;
	GetWindowText(csNewText);
	if (!IsNumber(csNewText) || !IsInRange(_tstoi(csNewText)))
	{
		MessageBeep(-1);
		SetWindowText(csOrigText);
	}
}
开发者ID:mosunovpa,项目名称:Projects,代码行数:15,代码来源:NumberEdit.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ IsOK函数代码示例发布时间:2022-05-30
下一篇:
C++ IsNullOrEmptyString函数代码示例发布时间: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