本文整理汇总了C++中NumberToString函数的典型用法代码示例。如果您正苦于以下问题:C++ NumberToString函数的具体用法?C++ NumberToString怎么用?C++ NumberToString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NumberToString函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: if
void TradeInterface::_ChangeViewMode(SHOP_VIEW_MODE new_mode)
{
if(_view_mode == new_mode)
return;
if(new_mode == SHOP_VIEW_MODE_LIST) {
_view_mode = new_mode;
ShopMode::CurrentInstance()->ObjectViewer()->ChangeViewMode(_view_mode);
_category_display.ChangeViewMode(_view_mode);
_properties_header.SetOwner(ShopMode::CurrentInstance()->GetMiddleWindow());
_properties_header.SetPosition(480.0f, 10.0f);
} else if(new_mode == SHOP_VIEW_MODE_INFO) {
_view_mode = new_mode;
ShopMode::CurrentInstance()->ObjectViewer()->ChangeViewMode(_view_mode);
_category_display.ChangeViewMode(_view_mode);
_category_display.SetSelectedObject(_selected_object);
_properties_header.SetOwner(ShopMode::CurrentInstance()->GetBottomWindow());
_properties_header.SetPosition(480.0f, 15.0f);
_selected_name.SetText(_selected_object->GetObject()->GetName());
_selected_icon = _selected_object->GetObject()->GetIconImage();
_selected_icon.SetDimensions(30.0f, 30.0f);
_selected_properties.SetOptionText(0, MakeUnicodeString(NumberToString(_selected_object->GetTradePrice())));
_selected_properties.SetOptionText(1, MakeUnicodeString("×" + NumberToString(_selected_object->GetStockCount())));
_selected_properties.SetOptionText(2, MakeUnicodeString("×" + NumberToString(_selected_object->GetOwnCount())));
} else {
IF_PRINT_WARNING(SHOP_DEBUG) << "tried to change to an invalid/unsupported view mode: " << new_mode << std::endl;
}
}
开发者ID:galexcode,项目名称:ValyriaTear,代码行数:31,代码来源:shop_trade.cpp
示例2: NumberToString
/** newPath - username - requestID++ - pathID - mode - color - active - page
*
* @param pathID
* @param mode
* @param color
* @param active
* @param page
*/
void Sender::NewPath(int pathID, bool mode, int color, bool active, int page)
{
//creating New Path request
std::string toSend = NumberToString(NEW_PATH);
toSend += separator;
toSend += username;
toSend += separator;
toSend += NumberToString(requestID++);
toSend += separator;
toSend += NumberToString(pathID);
toSend += separator;
toSend += BoolToString(mode);
toSend += separator;
toSend += NumberToString(color);
toSend += separator;
toSend += BoolToString(active);
toSend += separator;
toSend += NumberToString(page);
toSend += separator;
//std::cout << "NewPath: " << toSend << std::endl;
//Sending logout request
SendMessage(toSend);
}
开发者ID:GreggGut,项目名称:Scribble,代码行数:39,代码来源:Sender.cpp
示例3: StillImage
void SmallCharacterWindow::SetCharacter(GlobalCharacter* character)
{
delete _character;
_character = character;
if(!_character || _character->GetID() == vt_global::GLOBAL_CHARACTER_INVALID) {
_character_name.Clear();
_character_data.Clear();
_portrait = StillImage();
return;
}
_portrait = character->GetPortrait();
// Only size up valid portraits
if(!_portrait.GetFilename().empty())
_portrait.SetDimensions(100.0f, 100.0f);
// the characters' name is already translated.
_character_name.SetText(_character->GetName(), TextStyle("title22"));
// And the rest of the data
/// tr: level
ustring char_data = UTranslate("Lv: ") + MakeUnicodeString(NumberToString(_character->GetExperienceLevel()) + "\n");
/// tr: hit points
char_data += UTranslate("HP: ") + MakeUnicodeString(NumberToString(_character->GetHitPoints()) +
" / " + NumberToString(_character->GetMaxHitPoints()) + "\n");
/// tr: skill points
char_data += UTranslate("SP: ") + MakeUnicodeString(NumberToString(_character->GetSkillPoints()) +
" / " + NumberToString(_character->GetMaxSkillPoints()));
_character_data.SetText(char_data, TextStyle("text20"));
}
开发者ID:ValyriaTear,项目名称:ValyriaTear,代码行数:32,代码来源:save_mode.cpp
示例4: IF_PRINT_WARNING
void TreasureSupervisor::Initialize(MapTreasure *treasure)
{
if(!treasure) {
IF_PRINT_WARNING(MAP_DEBUG) << "function argument was nullptr" << std::endl;
return;
}
_treasure = treasure;
MapMode::CurrentInstance()->PushState(STATE_TREASURE);
// Construct the object list, including any drunes that were contained within the treasure
if(_treasure->_drunes != 0) {
_list_options.AddOption(MakeUnicodeString("<data/inventory/drunes.png> ") +
UTranslate("Drunes") +
MakeUnicodeString("<R>" + NumberToString(_treasure->_drunes)));
GlobalManager->Media().PlaySound("coins");
} else {
GlobalManager->Media().PlaySound("item_pickup");
}
for(uint32_t i = 0; i < _treasure->_items_list.size(); i++) {
if(_treasure->_items_list[i]->GetCount() > 1) {
_list_options.AddOption(MakeUnicodeString("<" + _treasure->_items_list[i]->GetIconImage().GetFilename() + "> ") +
_treasure->_items_list[i]->GetName() +
MakeUnicodeString("<R>x" + NumberToString(_treasure->_items_list[i]->GetCount())));
} else {
_list_options.AddOption(MakeUnicodeString("<" + _treasure->_items_list[i]->GetIconImage().GetFilename() + "> ") +
_treasure->_items_list[i]->GetName());
}
}
for(uint32_t i = 0; i < _list_options.GetNumberOptions(); i++) {
_list_options.GetEmbeddedImage(i)->SetDimensions(30.0f, 30.0f);
}
_action_options.SetSelection(0);
_action_options.SetCursorState(VIDEO_CURSOR_STATE_VISIBLE);
_list_options.SetSelection(0);
_list_options.SetCursorState(VIDEO_CURSOR_STATE_HIDDEN);
_selection = ACTION_SELECTED;
_action_window.Show();
_list_window.Show();
// Immediately add the drunes and objects to the player's inventory
GlobalManager->AddDrunes(_treasure->_drunes);
for(uint32_t i = 0; i < _treasure->_items_list.size(); ++i) {
GlobalObject *obj = _treasure->_items_list[i];
if(!obj)
continue;
if(!GlobalManager->IsItemInInventory(obj->GetID())) {
// Pass a copy to the inventory, the treasure object will delete its content on destruction.
vt_global::GlobalObject *obj_copy = GlobalCreateNewObject(obj->GetID(), obj->GetCount());
GlobalManager->AddToInventory(obj_copy);
} else {
GlobalManager->IncrementItemCount(obj->GetID(), obj->GetCount());
}
}
} // void TreasureSupervisor::Initialize(MapTreasure* treasure)
开发者ID:carriercomm,项目名称:ValyriaTear,代码行数:59,代码来源:map_treasure.cpp
示例5: while
bool OptimizeAreasLowZoomGenerator::GetAreas(const TypeConfig& typeConfig,
const ImportParameter& parameter,
Progress& progress,
FileScanner& scanner,
const TypeInfoSet& types,
std::vector<std::list<AreaRef> >& areas,
TypeInfoSet& loadedTypes)
{
uint32_t areaCount=0;
size_t collectedAreasCount=0;
loadedTypes=types;
progress.SetAction("Collecting area data to optimize");
scanner.GotoBegin();
scanner.Read(areaCount);
for (uint32_t a=1; a<=areaCount; a++) {
AreaRef area=std::make_shared<Area>();
progress.SetProgress(a,areaCount);
area->Read(typeConfig,
scanner);
if (loadedTypes.IsSet(area->GetType())) {
areas[area->GetType()->GetIndex()].push_back(area);
collectedAreasCount++;
while (collectedAreasCount>parameter.GetOptimizationMaxWayCount() &&
loadedTypes.Size()>1) {
TypeInfoRef victimType;
for (auto &type : loadedTypes) {
if (areas[type->GetIndex()].size()>0 &&
(!victimType ||
areas[type->GetIndex()].size()<areas[victimType->GetIndex()].size())) {
victimType=type;
}
}
assert(victimType);
collectedAreasCount-=areas[victimType->GetIndex()].size();
areas[victimType->GetIndex()].clear();
loadedTypes.Remove(victimType);
}
}
}
progress.Info("Collected "+NumberToString(collectedAreasCount)+" areas for "+NumberToString(loadedTypes.Size())+" types");
return !scanner.HasError();
}
开发者ID:mstar0125,项目名称:libosmscout,代码行数:57,代码来源:GenOptimizeAreasLowZoom.cpp
示例6: NumberToString
void Sender::sendCleanAll(int page)
{
std::string toSend = separator;
toSend += NumberToString(CLEAR_ALL);
toSend += separator;
toSend += NumberToString(page);
client->sendMessage(toSend);
}
开发者ID:petester42,项目名称:Scribble_GL,代码行数:10,代码来源:Sender.cpp
示例7: NumberToString
bool WayNodeReductionProcessorFilter::AfterProcessingEnd(const ImportParameter& /*parameter*/,
Progress& progress,
const TypeConfig& /*typeConfig*/)
{
progress.Info("Duplicate nodes removed: " + NumberToString(duplicateCount));
progress.Info("Redundant nodes removed: " + NumberToString(redundantCount));
progress.Info("Overall nodes: " + NumberToString(overallCount));
return true;
}
开发者ID:camiloMS,项目名称:libosmscout,代码行数:10,代码来源:SortWayDat.cpp
示例8: NumberToString
/*******************************************************************************
*** FUNCTION PARAMS()
*******************************************************************************
*** DESCRIPTION : Processes PARAMS grammar rule.
***
*** PARAMS -> idt PARAMSTAIL |
*** num PARAMSTAIL |
*** e
***
******************************************************************************/
void RecursiveParser::PARAMS()
{
if (global->Token == Global::idt)
{
EntryPtr peek = symtab->lookup(global->Lexeme);
if (peek->depth == depth || peek->depth == 1)
{
string code;
code += "push ";
if (peek->depth <= 1)
code += peek->Lexeme;
else
{
code += "[bp";
if (peek->isParam)
code += "+";
else
code += "-";
code += NumberToString(peek->var.Offset);
code += "]";
}
match(Global::idt);
PARAMSTAIL();
emit(code);
}
else
{
cout << "ERROR: " << global->Lexeme << " at line " << lex->line_num << " not defined in current scope." << endl;
raise(SIGINT);
}
}
else if (global->Token == Global::numt)
{
string code;
code += "push ";
if (lex->isFloat)
code += NumberToString(global->ValueR);
else
code += NumberToString(global->Value);
match(Global::numt);
PARAMSTAIL();
emit(code);
}
else {}
}
开发者ID:tylrmac,项目名称:C---Compiler,代码行数:65,代码来源:RecursiveParser.cpp
示例9: NumberToString
String Rational::ToString() const
{
String str;
str += NumberToString(numer);
if (denom != 1) {
str += "/";
str += NumberToString(denom);
}
str += "r";
return str;
}
开发者ID:gura-lang,项目名称:gura,代码行数:11,代码来源:Rational.cpp
示例10: NumberToString
void Consolidator::performConsolidation(ErrorCalculator& eCalculator, int gap,int min_snp,float min_cm,int extendSnp)
{
//cout<<"in consolidator extendsnp"<<extendSnp<<endl;
int consolidations = 0, removed = 0;
for(int i=0;i<person_count;++i)//for each person
{
for(int j=i;j<person_count;++j)//compare with each other person
{
int temp1=-1,temp2=-1;
for(int l=0;l<m_matches[i][j].size();++l)//for each match
{
temp1= m_matches[i][j][l].start;//cout<<"temp1 before = "<<temp1<<endl;
temp2= m_matches[i][j][l].end;//cout<<"temp2 before = "<<temp2<<endl;
if(temp2==-1||temp1==-1){continue;}
for(int k=l+1;k<m_matches[i][j].size();++k) //for each other match
{
if((m_matches[i][j][k].start-temp2-1)<=gap)
{
++consolidations;
temp2=m_matches[i][j][k].end;
m_matches[i][j][l].end=temp2;
m_matches[i][j][k].end=-1;
}
else break;
}
//this may be what is causing our initial drops to never show up...
if( ( (temp2-temp1)<min_snp) || ( (eCalculator.getCMDistance(temp2)-eCalculator.getCMDistance(temp1))<min_cm) )
{
++removed;
// m_matches[i][j][l].end=m_matches[i][j][l].start=-1;
}
}
}
}
/*std::string str = " \n Number of Consolidations: " +
NumberToString( consolidations );
str = str + " \n Number of matches removed due to initial length: "
+ NumberToString( removed );*/
/*new*/
global_initial = removed;
consolidated_str = "Number of Consolidations: " + NumberToString( consolidations );
initial_drop_str = "Number of matches removed due to initial length: " + NumberToString( removed );
/*wen*/
// eCalculator.log( str );
}
开发者ID:pipa0979,项目名称:IBG-FISHR-OBJECTORIENTED,代码行数:51,代码来源:Consolidator.cpp
示例11: JsonWriteNonce
static void JsonWriteNonce(JsonWriter& writer, int nonce)
{
WriteKey(writer, "nonce");
char nonceBuffer[32];
NumberToString(nonceBuffer, nonce);
writer.String(nonceBuffer);
}
开发者ID:AdmiralCurtiss,项目名称:dolphin,代码行数:7,代码来源:serialization.cpp
示例12:
std::string equation_handler::getX0()
{
std::string temp="(";
for(int i=0; i<n; i++)
{
if(i>=x0.size())
{
temp+="x";
temp+=NumberToString(i+1);
}
else temp+=NumberToString(x0[i]);
if(i+1!=n) temp+="; ";
}
temp+=")";
return temp;
}
开发者ID:peterhuszti,项目名称:Thesis-BSc,代码行数:16,代码来源:equation_handler.cpp
示例13: ToString
// returns an EJSPrimString*.
// maybe we could change it to return a char* to match ToDouble? that way string concat wouldn't create
// temporary strings for non-PrimString objects only to throw them away after concatenation?
ejsval ToString(ejsval exp)
{
if (EJSVAL_IS_MAGIC_IMPL(exp)) {
// holes in dense arrays end up here
return _ejs_atom_empty;
}
else if (EJSVAL_IS_NULL(exp))
return _ejs_atom_null;
else if (EJSVAL_IS_UNDEFINED(exp))
return _ejs_atom_undefined;
else if (EJSVAL_IS_BOOLEAN(exp))
return EJSVAL_TO_BOOLEAN(exp) ? _ejs_atom_true : _ejs_atom_false;
else if (EJSVAL_IS_NUMBER(exp))
return NumberToString(EJSVAL_TO_NUMBER(exp));
else if (EJSVAL_IS_STRING(exp))
return exp;
else if (EJSVAL_IS_OBJECT(exp)) {
ejsval toString = _ejs_object_getprop (exp, _ejs_atom_toString);
if (!EJSVAL_IS_FUNCTION(toString)) {
return _ejs_Object_prototype_toString(_ejs_null, exp, 0, NULL);
}
// should we be checking if this returns a string? i'd assume so...
return _ejs_invoke_closure (toString, exp, 0, NULL);
}
else
EJS_NOT_IMPLEMENTED();
}
开发者ID:shana,项目名称:echo-js,代码行数:31,代码来源:ejs-ops.c
示例14: IF_PRINT_WARNING
void ReadScriptDescriptor::OpenTable(int32 table_name) {
// At least one table must be open to use a numerical key
if (_open_tables.size() == 0) {
IF_PRINT_WARNING(SCRIPT_DEBUG) << "failed because there were no tables open when trying "
<< "to open the with the element key " << table_name << endl;
return;
}
lua_pushnumber(_lstack, table_name);
if (!lua_istable(_lstack, STACK_TOP - 1)) {
IF_PRINT_WARNING(SCRIPT_DEBUG) << "about to fail because STACK_TOP - 1 is not a "
<< "table, or the table does not exist for the table element key: " << table_name << endl;
}
// Note: This call is unsafe and might make the game crash. TODO: investigate alternative solution
lua_gettable(_lstack, STACK_TOP - 1);
if (!lua_istable(_lstack, STACK_TOP)) {
IF_PRINT_WARNING(SCRIPT_DEBUG) << "failed because the data retrieved was not a table "
<< "or did not exist for the table element key " << table_name << endl;
return;
}
_open_tables.push_back(NumberToString(table_name));
} // void ReadScriptDescriptor::OpenTable(int32 key)
开发者ID:segafan,项目名称:Hero-of-Allacrost,代码行数:26,代码来源:script_read.cpp
示例15: erode
void MotionDetection::BackGroundDetection(Mat fgMaskMOG, Mat mask, double ScaleFactor)
{
int min_size = 1, max_size = 10000;
vector<vector<Point> > contours;
erode(fgMaskMOG,fgMaskMOG,Mat());
dilate(fgMaskMOG,fgMaskMOG,Mat());
findContours( fgMaskMOG, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
// findContours( tempMog, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE,Point(0, 0));
vector<Rect> boundRect( contours.size() );
vector<vector<Point> > contours_poly( contours.size() );
// double smallest_area = contourArea( contours[0],false);
for( int i = 0; i< contours.size(); i++ )
{
approxPolyDP( Mat(contours[i]), contours_poly[i], 3, true );
boundRect[i] = boundingRect( Mat(contours_poly[i]) );
// rectangle( drawing, boundRect[i].tl(), boundRect[i].br(), Scalar( 255,255,255), -1, 8, 0 );
//drawContours( drawing, contours, i, Scalar(255,255,255), CV_FILLED, 8, hierarchy);
}
Mat drawing = Mat::zeros( fgMaskMOG.size(), CV_8UC1);
for( int i = 0; i< contours.size(); i++ )
{
//need to make sure what's the exact min_size and max_size
if(boundRect[i].area() < min_size * ScaleFactor * ScaleFactor
|| boundRect[i].area() > max_size * ScaleFactor * ScaleFactor)
{
continue;
}
rectangle( drawing, boundRect[i].tl(), boundRect[i].br(), Scalar(255,255,255), -1, 8, 0);
}
resize(drawing,
drawing,
Size(drawing.cols / ScaleFactor, drawing.rows / ScaleFactor),
0,
0,
INTER_NEAREST);
if(option_str == "-b")
{
static int counter = 0;
String output_str = outPut_Mask_Path + NumberToString(++counter) + ".png";
imwrite(output_str, drawing);
}
for(int i = 0; i < drawing.cols; i++)
{
for(int j = 0; j < drawing.rows; j++)
{
Point p(i,j);
if(drawing.at<uchar>(p) == 255)
{
mask.at<uchar>(p) += mask_add_step;
}
}
}
}
开发者ID:kuanghaochina,项目名称:Smart-Assistant-Surveillance-System,代码行数:60,代码来源:MotionDetection.cpp
示例16: NumberToString
string AdjListGraph::toString() {
string result;
result = NumberToString(order) + "\n";
result.append(NumberToString(size) + "\n");
for (int i=0; i<order; i++) {
result.append(NumberToString(i) + ": ");
for (auto &v : adjacent[i]) {
result.append(NumberToString(v) + " ");
}
result.append("\n");
}
return result;
}
开发者ID:MatematicaDiscreta,项目名称:GraphTheory,代码行数:17,代码来源:AdjListGraph.cpp
示例17: NumberToString
void World::DrawScore()
{
std::string player1ScoreStr = NumberToString(m_player1.GetScore());
std::string player2ScoreStr = NumberToString(m_player2.GetScore());
draw::DrawText(
m_width / 2 - 200, 50,
player1ScoreStr,
m_bitmapFont
);
draw::DrawText(
m_width / 2 + 200 - 30, 50,
player2ScoreStr,
m_bitmapFont
);
}
开发者ID:pavelsimo,项目名称:Pong,代码行数:17,代码来源:World.cpp
示例18: getEx
std::string equation_handler::getEx()
{
if(exact.size()==0) return "";
std::string temp="(";
for(int i=0; i<n; i++)
{
if(i>=exact.size())
{
temp+="x";
temp+=NumberToString(i+1);
}
else temp+=NumberToString(exact[i]);
if(i+1!=n) temp+="; ";
}
temp+=")";
return temp;
}
开发者ID:peterhuszti,项目名称:Thesis-BSc,代码行数:17,代码来源:equation_handler.cpp
注:本文中的NumberToString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论