当前位置: 首页>>代码示例>>C++>>正文


C++ ToInt函数代码示例

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


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

示例1: RunOperation

void RunOperation(char operation, const std::vector<std::string>& arguments,  MinHeap<T>& heap, std::ostream& file)
{
	if(operation == 'I')
	{
		auto value = ToInt(arguments[1]);
		heap.Insert(value);
	}
	else if(operation == 'D')
	{
		auto value = ToInt(arguments[1]);
		heap.Delete(value);
	}
	else if(operation == 'C')
	{
		auto oldValue = ToInt(arguments[1]);
		auto newValue = ToInt(arguments[2]);
		heap.Change(oldValue, newValue);
	}
	else if(operation == 'P')
	{
		heap.PrintPostOrder(file);
		file << std::endl;
	}

}
开发者ID:chadsmith12,项目名称:Min-Heap,代码行数:25,代码来源:program4.cpp

示例2: CreateSFMLTexture

void GD_EXTENSION_API CreateSFMLTexture( RuntimeScene & scene, const std::string & imageName, unsigned int width, unsigned int height, const std::string & colorStr )
{
    //Get or create the texture in memory
    std::shared_ptr<SFMLTextureWrapper> newTexture;
    if ( !scene.GetImageManager()->HasLoadedSFMLTexture(imageName) )
        newTexture = std::shared_ptr<SFMLTextureWrapper>(new SFMLTextureWrapper);
    else
        newTexture = scene.GetImageManager()->GetSFMLTexture(imageName);

    //Get the color
    sf::Color color;
    bool colorIsOk = false;
    std::vector < std::string > colors = SplitString<std::string>(colorStr, ';');
    if ( colors.size() == 3 )
    {
        colorIsOk = true;
        color = sf::Color(ToInt(colors[0]), ToInt(colors[1]), ToInt(colors[2]));
    }

    //Create the SFML image and the SFML texture
    if ( width != 0 && height != 0 && colorIsOk )
        newTexture->image.create(width, height, color);

    newTexture->texture.loadFromImage(newTexture->image); //Do not forget to update the associated texture

    scene.GetImageManager()->SetSFMLTextureAsPermanentlyLoaded(imageName, newTexture); //Otherwise
}
开发者ID:AntonioModer,项目名称:GD,代码行数:27,代码来源:PrimitiveDrawingTools.cpp

示例3: Split

void SemanticVersion::Parse(const string_t& version) {
  std::vector<string_t> identifiers;
  std::wstring last_one;

  Split(version, L".", identifiers);

  if (identifiers.empty())
    return;

  last_one = identifiers.back();
  identifiers.pop_back();
  Split(last_one, L"-", identifiers);

  last_one = identifiers.back();
  identifiers.pop_back();
  Split(last_one, L"+", identifiers);

  if (identifiers.size() > 0)
    major = ToInt(identifiers.at(0));
  if (identifiers.size() > 1)
    minor = ToInt(identifiers.at(1));
  if (identifiers.size() > 2)
    patch = ToInt(identifiers.at(2));
  if (identifiers.size() > 3)
    prerelease_identifiers = identifiers.at(3);
  if (identifiers.size() > 4)
    build_metadata = identifiers.at(4);
}
开发者ID:alfateam123,项目名称:taiga,代码行数:28,代码来源:version.cpp

示例4: SortAsEpisodeRange

int SortAsEpisodeRange(const std::wstring& str1, const std::wstring& str2) {
  auto is_volume = [](const std::wstring& str) {
    return !str.empty() && !IsNumericChar(str.front());
  };
  auto get_last_number_in_range = [](const std::wstring& str) {
    auto pos = InStr(str, L"-");
    return pos > -1 ? ToInt(str.substr(pos + 1)) : ToInt(str);
  };
  auto get_volume = [&](const std::wstring& str) {
    auto pos = InStr(str, L" ");
    return pos > -1 ? get_last_number_in_range(str.substr(pos + 1)) : 0;
  };

  bool is_volume1 = is_volume(str1);
  bool is_volume2 = is_volume(str2);

  if (is_volume1 && is_volume2) {
    return CompareValues<int>(get_volume(str1), get_volume(str2));
  } else if (!is_volume1 && !is_volume2) {
    return CompareValues<int>(get_last_number_in_range(str1),
                              get_last_number_in_range(str2));
  } else {
    return is_volume1 ? base::kLessThan : base::kGreaterThan;
  }
}
开发者ID:Hydro8182,项目名称:taiga,代码行数:25,代码来源:list.cpp

示例5: AfxGetMainWnd

void CCEMPatientStatistic::OnSetWindowEvents(){
	CHMSMainFrame *pMF = (CHMSMainFrame*) AfxGetMainWnd();
	//m_wndYear.SetEvent(WE_CHANGE, _OnYearChangeFnc);
	//m_wndYear.SetEvent(WE_SETFOCUS, _OnYearSetfocusFnc);
	//m_wndYear.SetEvent(WE_KILLFOCUS, _OnYearKillfocusFnc);
	m_wndYear.SetEvent(WE_CHECKVALUE, _OnYearCheckValueFnc);
	m_wndReportPeriod.SetEvent(WE_SELENDOK, _OnReportPeriodSelendokFnc);
	//m_wndReportPeriod.SetEvent(WE_SETFOCUS, _OnReportPeriodSetfocusFnc);
	//m_wndReportPeriod.SetEvent(WE_KILLFOCUS, _OnReportPeriodKillfocusFnc);
	m_wndReportPeriod.SetEvent(WE_SELCHANGE, _OnReportPeriodSelectChangeFnc);
	m_wndReportPeriod.SetEvent(WE_LOADDATA, _OnReportPeriodLoadDataFnc);
	//m_wndReportPeriod.SetEvent(WE_ADDNEW, _OnReportPeriodAddNewFnc);
	//m_wndFromDate.SetEvent(WE_CHANGE, _OnFromDateChangeFnc);
	//m_wndFromDate.SetEvent(WE_SETFOCUS, _OnFromDateSetfocusFnc);
	//m_wndFromDate.SetEvent(WE_KILLFOCUS, _OnFromDateKillfocusFnc);
	m_wndFromDate.SetEvent(WE_CHECKVALUE, _OnFromDateCheckValueFnc);
	//m_wndToDate.SetEvent(WE_CHANGE, _OnToDateChangeFnc);
	//m_wndToDate.SetEvent(WE_SETFOCUS, _OnToDateSetfocusFnc);
	//m_wndToDate.SetEvent(WE_KILLFOCUS, _OnToDateKillfocusFnc);
	m_wndToDate.SetEvent(WE_CHECKVALUE, _OnToDateCheckValueFnc);
	m_wndPrintPreview.SetEvent(WE_CLICK, _OnPrintPreviewSelectFnc);
	m_wndExport.SetEvent(WE_CLICK, _OnExportSelectFnc);
	CString szSysDate = pMF->GetSysDate();
	m_nYear = ToInt(szSysDate.Left(4));
	m_szReportPeriodKey.Format(_T("%d"), ToInt(szSysDate.Mid(5, 2)));
	m_szFromDate = m_szToDate = pMF->GetSysDate();
	m_szFromDate += _T("00:00");
	m_szToDate += _T("23:59");
	UpdateData(false);

}
开发者ID:smithgold53,项目名称:HMSReportForms,代码行数:31,代码来源:CEMPatientStatistic.cpp

示例6: ChangeSceneBackground

void GD_API ChangeSceneBackground( RuntimeScene & scene, std::string newColor )
{
    vector < string > colors = SplitString <string> (newColor, ';');
    if ( colors.size() > 2 ) scene.SetBackgroundColor( ToInt(colors[0]), ToInt(colors[1]), ToInt(colors[2]) );

    return;
}
开发者ID:cubemoon,项目名称:GD,代码行数:7,代码来源:RuntimeSceneTools.cpp

示例7: _appserver_initial

// * ================================================================================ *
// @ _appserver_initial
// * ================================================================================ *
t_int _appserver_initial()
{
	nsocket_env_init();

	g_appserver.m_iport_shortmsg = ToInt(myconfig["SMSSERVER_PORT"][1]);
	g_appserver.m_sip_shortmsg = myconfig["SMSSERVER_IP"][1];
	g_appserver.m_iresendtimes_shortmsg = ToInt(myconfig["SMSSERVER_RESEND_TIMES"][1]);
	g_appserver.m_iresendtmout_shortmsg = ToInt(myconfig["SMSSERVER_RESEND_INTERVAL"][1]);
	g_appserver.m_imaxsendpersec_shortmsg = ToInt(myconfig["SMSSERVER_MAX_SEND_PER_SECOND"][1]);

	g_appserver.m_sdb_ip = myconfig["DATABASE_IP"][1];
	g_appserver.m_sdb_name = myconfig["DATABASE_NAME"][1];
	g_appserver.m_sdb_uname = myconfig["DATABASE_USER_NAME"][1];
	g_appserver.m_sdb_upwd = myconfig["DATABASE_PASSWD"][1];

	g_appserver.m_suser_shortmsg = myconfig["SMSSERVER_USER"][1];
	g_appserver.m_spwd_shortmsg = myconfig["SMSSERVER_PASS"][1];	//MD5
	
	g_appserver.p_index_terminal.Initial(MAXNUM_REALTEST);
	
	g_appserver.p_buf_smsg_snd = CBasicBuffer::CreateInstance(64*1024);
	g_appserver.p_buf_smsg_rcv = CBasicBuffer::CreateInstance(64*1024);

	appserver_opendb(g_appserver.m_sdb_name.c_str(), g_appserver.m_sdb_ip.c_str(), g_appserver.m_sdb_uname.c_str(), g_appserver.m_sdb_upwd.c_str());
	
	create_db_tables();
	insert_db_default_data();
	
	//appserver_execute("UPDATE BUSSOP SET STATUS='Y', RES_CODE=111 WHERE STATUS='B';");
	//appserver_execute("UPDATE CONFIG_TERMINAL_ROUTINE_CONTENT_EXTRA_PESQ SET EXEC_DATE='19000101';");

	g_appserver.m_runing = 1;
	
	return 0;
}
开发者ID:rock007,项目名称:hello,代码行数:38,代码来源:appserver.cpp

示例8: main

int main() {
	freopen("1810.in" , "r", stdin );
	freopen("1810.out", "w", stdout);
	
	scanf("%d %d", &n, &m);
	for (int i=0; i<n; i++)
		scanf("%s", nor[i]);
	for (int i=0; i<n; i++)
		scanf("%s", ill[i]);

	power[0] = 1;
	for (int i=1; i<=m; i++)
		power[i] = (power[i-1] * 4) % PRIME1;
	for (int i=0; i<n; i++)
		for (int j=1; j<=m; j++) {
			sum[i][j] = (sum[i][j-1] * 4 + ToInt(nor[i][j-1])) % PRIME1;
			kum[i][j] = (kum[i][j-1] * 4 + ToInt(ill[i][j-1])) % PRIME1;
		}

	int l=0, r=m+1, mid;
	while (l + 1 < r) {
		mid = (l + r) / 2;
		if (TryLen(mid)) r = mid;
		else             l = mid;
	}
	printf("%d\n", r);


	return 0;
}
开发者ID:YanWQ-monad,项目名称:monad,代码行数:30,代码来源:1810.cpp

示例9: ToInt

episode_number_range_t Episode::episode_number_range() const {
  auto numbers = elements_.get_all(anitomy::kElementEpisodeNumber);
  episode_number_range_t range{
    numbers.empty() ? 0 : ToInt(numbers.front()),
    numbers.empty() ? 0 : ToInt(numbers.back())
  };
  return range;
}
开发者ID:ShiroNek0,项目名称:taiga,代码行数:8,代码来源:anime_episode.cpp

示例10: year

Date::Date(const std::wstring& date)
    : year(0), month(0), day(0) {
  // Convert from YYYY-MM-DD
  if (date.length() >= 10) {
    year = ToInt(date.substr(0, 4));
    month = ToInt(date.substr(5, 2));
    day = ToInt(date.substr(8, 2));
  }
}
开发者ID:IamKenshin,项目名称:taiga,代码行数:9,代码来源:time.cpp

示例11: MemoryDebugMenu

// メモリデバッグメニュー
void MemoryDebugMenu()
{
    char tmp[MAX_SIZE];
    TOKEN_LIST *t;
    char *cmd;
    Print("Mayaqua Kernel Memory Debug Tools\n"
          "Copyright (C) SoftEther Corporation. All Rights Reserved.\n\n");
    g_memcheck = false;
    while (true)
    {
        Print("debug>");
        GetLine(tmp, sizeof(tmp));
        t = ParseToken(tmp, " \t");
        if (t->NumTokens == 0)
        {
            FreeToken(t);
            DebugPrintAllObjects();
            continue;
        }
        cmd = t->Token[0];
        if (!StrCmpi(cmd, "?"))
        {
            DebugPrintCommandList();
        }
        else if (!StrCmpi(cmd, "a"))
        {
            DebugPrintAllObjects();
        }
        else if (!StrCmpi(cmd, "i"))
        {
            if (t->NumTokens == 1)
            {
                Print("Usage: i <obj_id>\n\n");
            }
            else
            {
                DebugPrintObjectInfo(ToInt(t->Token[1]));
            }
        }
        else if (!StrCmpi(cmd, "q"))
        {
            break;
        }
        else if (ToInt(cmd) != 0)
        {
            DebugPrintObjectInfo(ToInt(t->Token[0]));
        }
        else
        {
            Print("Command Not Found,\n\n");
        }
        FreeToken(t);
    }
    FreeToken(t);
    g_memcheck = true;
}
开发者ID:falcon8823,项目名称:utvpn,代码行数:57,代码来源:Tracking.c

示例12: SetColor

void RuntimeSpriteObject::SetColor(const std::string & colorStr)
{
    std::vector < std::string > colors = SplitString<std::string>(colorStr, ';');

    if ( colors.size() < 3 ) return; //La couleur est incorrecte

    SetColor(  ToInt(colors[0]),
               ToInt(colors[1]),
               ToInt(colors[2]) );
}
开发者ID:darkhog,项目名称:GD,代码行数:10,代码来源:RuntimeSpriteObject.cpp

示例13: MaxPathSum

int MaxPathSum(BinTree r, int &res) {
	if (r == NULL)
		return 0;
	int left = MaxPathSum(r->lchild, res);  //左子树叶节点到根结点最大路径和
	int right = MaxPathSum(r->rchild, res);  //右子树叶节点到根结点最大路径和
	int sum = max(ToInt(r), ToInt(r) + max(left, right)); // sum记录叶节点到根结点的最大路径和
	res = max(res, ToInt(r) + left + right);
	res = max(res, sum);  //最大路径和
	return sum;
}
开发者ID:hooluupog,项目名称:DataStructure,代码行数:10,代码来源:BinTreeProblems.cpp

示例14: SetText

BOOL FeedConditionDialog::OnInitDialog() {
  // Set title
  if (condition.element != 0 || condition.op != 0 || !condition.value.empty()) {
    SetText(L"Edit Condition");
  }

  // Initialize
  element_combo_.Attach(GetDlgItem(IDC_COMBO_FEED_ELEMENT));
  operator_combo_.Attach(GetDlgItem(IDC_COMBO_FEED_OPERATOR));
  value_combo_.Attach(GetDlgItem(IDC_COMBO_FEED_VALUE));

  // Add elements
  for (int i = 0; i < FEED_FILTER_ELEMENT_COUNT; i++) {
    element_combo_.AddItem(Aggregator.filter_manager.TranslateElement(i).c_str(), i);
  }
  
  // Set element
  element_combo_.SetCurSel(condition.element);
  ChooseElement(condition.element);
  // Set operator
  operator_combo_.SetCurSel(operator_combo_.FindItemData(condition.op));
  // Set value
  switch (condition.element) {
    case FEED_FILTER_ELEMENT_META_ID: {
      value_combo_.SetCurSel(0);
      for (int i = 0; i < value_combo_.GetCount(); i++) {
        int anime_id = static_cast<int>(value_combo_.GetItemData(i));
        if (anime_id == ToInt(condition.value)) {
          value_combo_.SetCurSel(i);
          break;
        }
      }
      break;
    }
    case FEED_FILTER_ELEMENT_USER_STATUS: {
      int value = ToInt(condition.value);
      if (value == 6) value--;
      value_combo_.SetCurSel(value);
      break;
    }
    case FEED_FILTER_ELEMENT_META_STATUS:
    case FEED_FILTER_ELEMENT_META_TYPE:
      value_combo_.SetCurSel(ToInt(condition.value) - 1);
      break;
    case FEED_FILTER_ELEMENT_LOCAL_EPISODE_AVAILABLE:
      value_combo_.SetCurSel(condition.value == L"True" ? 1 : 0);
      break;
    default:
      value_combo_.SetText(condition.value);
  }

  return TRUE;
}
开发者ID:Greathood,项目名称:taiga,代码行数:53,代码来源:dlg_feed_condition.cpp

示例15: ToInt

/**
 * Apply changes
 */
void EditLink::OnOkBtClick(wxCommandEvent& event)
{
    editedEvent.SetTarget(ToString(linkedNameEdit->GetValue()));
    if ( AllEventsCheck->GetValue() == true )
        editedEvent.SetIncludeAllEvents(true);
    else
    {
        editedEvent.SetIncludeAllEvents(false);
        editedEvent.SetIncludeStartAndEnd(ToInt(ToString(StartEdit->GetValue()))-1, ToInt(ToString(EndEdit->GetValue()))-1);
    }
    EndModal(1);
}
开发者ID:AntonioModer,项目名称:GD,代码行数:15,代码来源:EditLink.cpp


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