Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::to_string instead of MISC::itostr #148

Merged
merged 1 commit into from Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/article/articleadmin.cpp
Expand Up @@ -173,7 +173,7 @@ void ArticleAdmin::restore( const bool only_locked )
set_switchhistory( list_switchhistory );

SESSION::set_online( online );
if( get_tab_nums() ) set_command( "set_page", std::string(), MISC::itostr( set_page_num ) );
if( get_tab_nums() ) set_command( "set_page", std::string(), std::to_string( set_page_num ) );
}


Expand Down
4 changes: 2 additions & 2 deletions src/article/articleview.cpp
Expand Up @@ -282,7 +282,7 @@ void ArticleViewMain::show_view()
#endif

set_reget( false );
CORE::core_set_command( "delete_article", url_article(), "reget", MISC::itostr( jump_to ) );
CORE::core_set_command( "delete_article", url_article(), "reget", std::to_string( jump_to ) );
return;
}

Expand Down Expand Up @@ -715,7 +715,7 @@ void ArticleViewMain::live_start()
const int live_sec = DBTREE::board_get_live_sec( get_url() );

set_live( true );
ARTICLE::get_admin()->set_command_immediately( "start_autoreload", get_url(), "on", MISC::itostr( live_sec ) );
ARTICLE::get_admin()->set_command_immediately( "start_autoreload", get_url(), "on", std::to_string( live_sec ) );
set_autoreload_counter( live_sec * 1000/TIMER_TIMEOUT );
drawarea()->live_start();
drawarea()->update_live_speed( live_sec );
Expand Down
35 changes: 21 additions & 14 deletions src/article/articleviewbase.cpp
Expand Up @@ -1396,7 +1396,7 @@ void ArticleViewBase::slot_preferences_image()
//
void ArticleViewBase::back_viewhistory( const int count )
{
ARTICLE::get_admin()->set_command( "back_viewhistory", get_url(), MISC::itostr( count ) );
ARTICLE::get_admin()->set_command( "back_viewhistory", get_url(), std::to_string( count ) );
}


Expand All @@ -1405,7 +1405,7 @@ void ArticleViewBase::back_viewhistory( const int count )
//
void ArticleViewBase::forward_viewhistory( const int count )
{
ARTICLE::get_admin()->set_command( "forward_viewhistory", get_url(), MISC::itostr( count ) );
ARTICLE::get_admin()->set_command( "forward_viewhistory", get_url(), std::to_string( count ) );
}


Expand Down Expand Up @@ -1597,7 +1597,7 @@ std::string ArticleViewBase::get_html_url4report( const std::list< int >& list_r
const std::string time_str = m_article->get_time_str( num );
const std::string id_str = m_article->get_id_name( num );

html += url_for_copy() + MISC::itostr( num );
html += url_for_copy() + std::to_string( num );
if( ! time_str.empty() ) html += " " + MISC::remove_str_regex( time_str, "\\([^\\)]+\\)" ); // 曜日を取り除く
if( ! id_str.empty() ) html += " " + id_str.substr( strlen( PROTO_ID ) );
html += "<br>";
Expand Down Expand Up @@ -1791,8 +1791,11 @@ void ArticleViewBase::show_postlog( const int num )
if( i == 1 ) no = 0;
else no = maxno - ( i -1 );

if( no == num ) html_header += MISC::itostr( i ) + " ";
else html_header += std::string( "<a href=\"" ) + PROTO_POSTLOG + MISC::itostr( no ) + "\">" + MISC::itostr( i ) + "</a> ";
if( no == num ) html_header += std::to_string( i ) + " ";
else {
html_header += std::string( "<a href=\"" ) + PROTO_POSTLOG + std::to_string( no ) + "\">"
+ std::to_string( i ) + "</a> ";
}
}

#ifdef _DEBUG
Expand Down Expand Up @@ -2582,7 +2585,7 @@ bool ArticleViewBase::click_url( std::string url, int res_number, GdkEventButton

// ジャンプ先セット
m_jump_to = url.substr( strlen( PROTO_ANCHORE ) );
m_jump_from = MISC::itostr( res_number );
m_jump_from = std::to_string( res_number );
m_str_num = m_jump_to;

#ifdef _DEBUG
Expand All @@ -2609,7 +2612,7 @@ bool ArticleViewBase::click_url( std::string url, int res_number, GdkEventButton

hide_popup();

m_str_num = MISC::itostr( res_number );
m_str_num = std::to_string( res_number );
m_url_tmp = DBTREE::url_readcgi( m_url_article, res_number, 0 );

// ジャンプ先セット
Expand Down Expand Up @@ -2676,7 +2679,7 @@ bool ArticleViewBase::click_url( std::string url, int res_number, GdkEventButton
hide_popup();

if( control.button_alloted( event, CONTROL::PopupmenuImageButton ) ){
m_str_num = MISC::itostr( res_number );
m_str_num = std::to_string( res_number );
show_popupmenu( url, false );
}

Expand Down Expand Up @@ -3476,10 +3479,14 @@ void ArticleViewBase::slot_search_title()
//
void ArticleViewBase::slot_usrcmd( int num )
{
int res_num = 0;
if( m_drawarea ) res_num = m_drawarea->get_current_res_num();
std::string current = "0";
std::string selection;
if( m_drawarea ) {
current = std::to_string( m_drawarea->get_current_res_num() );
selection = m_drawarea->str_selection();
}

CORE::core_set_command( "exec_usr_cmd" ,m_url_article, MISC::itostr( num ), m_url_tmp, m_drawarea->str_selection(), MISC::itostr( res_num ) );
CORE::core_set_command( "exec_usr_cmd", m_url_article, std::to_string( num ), m_url_tmp, selection, current );
}


Expand Down Expand Up @@ -3594,8 +3601,8 @@ void ArticleViewBase::slot_quote_selection_res()

const int num_to = m_drawarea->get_selection_resnum_to();

std::string str_num = MISC::itostr( num_from );
if( num_from < num_to ) str_num += "-" + MISC::itostr( num_to );
std::string str_num = std::to_string( num_from );
if( num_from < num_to ) str_num += "-" + std::to_string( num_to );

std::string str_res;
str_res = CONFIG::get_ref_prefix();
Expand Down Expand Up @@ -4197,7 +4204,7 @@ void ArticleViewBase::exec_search()
}
else{
focus_view();
CORE::core_set_command( "set_info", "", "検索結果: " + MISC::itostr( hit ) + "件" );
CORE::core_set_command( "set_info", "", "検索結果: " + std::to_string( hit ) + "件" );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/article/drawareabase.cpp
Expand Up @@ -4837,7 +4837,7 @@ std::string DrawAreaBase::get_selection_as_url( const CARET_POSITION& caret_pos
// 数字
if( dig && num ){

url = PROTO_ANCHORE + MISC::itostr( num );
url = PROTO_ANCHORE + std::to_string( num );

for(;;){

Expand All @@ -4856,7 +4856,7 @@ std::string DrawAreaBase::get_selection_as_url( const CARET_POSITION& caret_pos
select_str = select_str.substr( tmpstr.length() );

num = MISC::str_to_uint( select_str.c_str(), dig, n );
if( dig && num ) url += tmpstr2 + MISC::itostr( num );
if( dig && num ) url += tmpstr2 + std::to_string( num );
else break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/article/preference.cpp
Expand Up @@ -46,7 +46,7 @@ Preferences::Preferences( Gtk::Window* parent, const std::string& url, const std
int size = DBTREE::article_lng_dat( get_url() );

m_label_cache.set_text( CACHE::path_dat( get_url() ) );
m_label_size.set_text( MISC::itostr( size ) + " / " + MISC::itostr( size/1024 ) );
m_label_size.set_text( std::to_string( size ) + " / " + std::to_string( size/1024 ) );

if( DBTREE::article_date_modified( get_url() ).empty() ) m_label_modified.set_text( "未取得" );
else m_label_modified.set_text(
Expand Down
4 changes: 1 addition & 3 deletions src/bbslist/bbslistadmin.cpp
Expand Up @@ -11,8 +11,6 @@
#include "skeleton/dragnote.h"
#include "skeleton/undobuffer.h"

#include "jdlib/miscutil.h"

#include "global.h"
#include "viewfactory.h"
#include "session.h"
Expand Down Expand Up @@ -125,7 +123,7 @@ void BBSListAdmin::restore( const bool only_locked )
command_arg = url_to_openarg( URL_HISTCLOSEIMGVIEW, true, false );
open_view( command_arg );

set_command( "set_page", std::string(), MISC::itostr( SESSION::bbslist_page() ) );
set_command( "set_page", std::string(), std::to_string( SESSION::bbslist_page() ) );
set_command( "hide_tabs" );
}

Expand Down
4 changes: 2 additions & 2 deletions src/bbslist/bbslistviewbase.cpp
Expand Up @@ -1730,7 +1730,7 @@ void BBSListViewBase::slot_opendir_as_board()

const std::string tab = "newtab";
const std::string mode = "";
CORE::core_set_command( "open_sidebar_board", get_url(), tab, mode, MISC::itostr( dirid ) );
CORE::core_set_command( "open_sidebar_board", get_url(), tab, mode, std::to_string( dirid ) );
}


Expand All @@ -1747,7 +1747,7 @@ void BBSListViewBase::slot_create_vboard()
CORE::DATA_INFO info;
info.type = TYPE_VBOARD;
info.parent = BBSLIST::get_admin()->get_win();
info.url = get_url() + SIDEBAR_SIGN + MISC::itostr( dirid );
info.url = get_url() + SIDEBAR_SIGN + std::to_string( dirid );
info.name = path2name( m_path_selected );
info.path = m_path_selected.to_string();
list_info.push_back( info );
Expand Down
4 changes: 1 addition & 3 deletions src/bbslist/editlistwin.cpp
Expand Up @@ -11,8 +11,6 @@
#include "skeleton/compentry.h"
#include "skeleton/undobuffer.h"

#include "jdlib/miscutil.h"

#include "viewfactory.h"

using namespace BBSLIST;
Expand Down Expand Up @@ -139,7 +137,7 @@ void EditListWin::slot_operate_search( const int controlid )
std::cout << "EditListWin::slot_operate_search id = " << controlid << std::endl;
#endif

if( m_selectview ) m_selectview->operate_search( MISC::itostr( controlid ) );
if( m_selectview ) m_selectview->operate_search( std::to_string( controlid ) );
}


Expand Down
3 changes: 1 addition & 2 deletions src/board/boardadmin.cpp
Expand Up @@ -15,7 +15,6 @@

#include "icons/iconmanager.h"

#include "jdlib/miscutil.h"
#include "jdlib/jdregex.h"
#include "jdlib/miscmsg.h"

Expand Down Expand Up @@ -136,7 +135,7 @@ void BoardAdmin::restore( const bool only_locked )
set_switchhistory( list_switchhistory );

SESSION::set_online( online );
if( get_tab_nums() ) set_command( "set_page", std::string(), MISC::itostr( set_page_num ) );
if( get_tab_nums() ) set_command( "set_page", std::string(), std::to_string( set_page_num ) );
}


Expand Down
6 changes: 3 additions & 3 deletions src/board/boardviewbase.cpp
Expand Up @@ -2630,7 +2630,7 @@ bool BoardViewBase::drawout( const bool force_reset )

if( reset ) CORE::core_set_command( "set_info", "", "" );
else if( ! hit ) CORE::core_set_command( "set_info", "", "検索結果: ヒット無し" );
else CORE::core_set_command( "set_info", "", "検索結果: " + MISC::itostr( hit ) + "件" );
else CORE::core_set_command( "set_info", "", "検索結果: " + std::to_string( hit ) + "件" );

return true;
}
Expand Down Expand Up @@ -2796,7 +2796,7 @@ void BoardViewBase::slot_preferences_article()
//
void BoardViewBase::back_viewhistory( const int count )
{
BOARD::get_admin()->set_command( "back_viewhistory", get_url(), MISC::itostr( count ) );
BOARD::get_admin()->set_command( "back_viewhistory", get_url(), std::to_string( count ) );
}


Expand All @@ -2805,7 +2805,7 @@ void BoardViewBase::back_viewhistory( const int count )
//
void BoardViewBase::forward_viewhistory( const int count )
{
BOARD::get_admin()->set_command( "forward_viewhistory", get_url(), MISC::itostr( count ) );
BOARD::get_admin()->set_command( "forward_viewhistory", get_url(), std::to_string( count ) );
}


Expand Down
12 changes: 6 additions & 6 deletions src/board/preference.cpp
Expand Up @@ -61,7 +61,7 @@ Preferences::Preferences( Gtk::Window* parent, const std::string& url, const std
// 書き込み設定
const int samba_sec = DBTREE::board_samba_sec( get_url() );
if( ! samba_sec ) m_label_samba.set_text( "未取得" );
else m_label_samba.set_text( MISC::itostr( samba_sec ) );
else m_label_samba.set_text( std::to_string( samba_sec ) );

m_button_clearsamba.signal_clicked().connect( sigc::mem_fun(*this, &Preferences::slot_clear_samba ) );
m_hbox_samba.pack_start( m_label_samba );
Expand Down Expand Up @@ -152,8 +152,8 @@ Preferences::Preferences( Gtk::Window* parent, const std::string& url, const std
set_activate_entry( m_spin_live );

// 一般ページのパッキング
m_label_max_line.set_text( MISC::itostr( DBTREE::line_number( get_url() ) * 2 ) );
m_label_max_byte.set_text( MISC::itostr( DBTREE::message_count( get_url() ) ) );
m_label_max_line.set_text( std::to_string( DBTREE::line_number( get_url() ) * 2 ) );
m_label_max_byte.set_text( std::to_string( DBTREE::message_count( get_url() ) ) );
m_hbox_max.pack_start( m_label_max_line );
m_hbox_max.pack_start( m_label_max_byte );

Expand Down Expand Up @@ -227,7 +227,7 @@ Preferences::Preferences( Gtk::Window* parent, const std::string& url, const std
if( DBTREE::board_get_local_proxy_basicauth( get_url() ).empty() ) host = DBTREE::board_get_local_proxy( get_url() );
else host = DBTREE::board_get_local_proxy_basicauth( get_url() ) + "@" + DBTREE::board_get_local_proxy( get_url() );
m_proxy_frame.entry_host.set_text( host );
m_proxy_frame.entry_port.set_text( MISC::itostr( DBTREE::board_get_local_proxy_port( get_url() ) ) );
m_proxy_frame.entry_port.set_text( std::to_string( DBTREE::board_get_local_proxy_port( get_url() ) ) );

switch( DBTREE::board_get_mode_local_proxy_w( get_url() ) ){
case DBTREE::PROXY_GLOBAL: m_proxy_frame_w.rd_global.set_active(); break;
Expand All @@ -237,7 +237,7 @@ Preferences::Preferences( Gtk::Window* parent, const std::string& url, const std
if( DBTREE::board_get_local_proxy_basicauth_w( get_url() ).empty() ) host = DBTREE::board_get_local_proxy_w( get_url() );
else host = DBTREE::board_get_local_proxy_basicauth_w( get_url() ) + "@" + DBTREE::board_get_local_proxy_w( get_url() );
m_proxy_frame_w.entry_host.set_text( host );
m_proxy_frame_w.entry_port.set_text( MISC::itostr( DBTREE::board_get_local_proxy_port_w( get_url() ) ) );
m_proxy_frame_w.entry_port.set_text( std::to_string( DBTREE::board_get_local_proxy_port_w( get_url() ) ) );

m_vbox_proxy.pack_start( m_label_proxy, Gtk::PACK_SHRINK );
m_vbox_proxy.pack_start( m_proxy_frame, Gtk::PACK_SHRINK );
Expand Down Expand Up @@ -390,7 +390,7 @@ void Preferences::slot_clear_samba()

const int samba_sec = DBTREE::board_samba_sec( get_url() );
if( ! samba_sec ) m_label_samba.set_text( "未取得" );
else m_label_samba.set_text( MISC::itostr( samba_sec ) );
else m_label_samba.set_text( std::to_string( samba_sec ) );
}


Expand Down
2 changes: 1 addition & 1 deletion src/cache.cpp
Expand Up @@ -384,7 +384,7 @@ std::string CACHE::path_msglog()
//
std::string CACHE::path_completion( int mode )
{
return CACHE::path_root() + "comp" + MISC::itostr( mode ) + ".info";
return CACHE::path_root() + "comp" + std::to_string( mode ) + ".info";
}


Expand Down
4 changes: 1 addition & 3 deletions src/config/aboutconfig.cpp
Expand Up @@ -16,8 +16,6 @@

#include "skeleton/msgdiag.h"

#include "jdlib/miscutil.h"

#include "colorid.h"

enum
Expand Down Expand Up @@ -369,7 +367,7 @@ void AboutConfig::set_value( Gtk::TreeModel::Row& row, const std::string& value

void AboutConfig::set_value( Gtk::TreeModel::Row& row, const int value )
{
row[ m_columns.m_col_value ] = MISC::itostr( value );
row[ m_columns.m_col_value ] = std::to_string( value );

const int defaultval = row[ m_columns.m_col_default_int ];
if( value != defaultval ) row[ m_columns.m_col_drawbg ] = true;
Expand Down
6 changes: 2 additions & 4 deletions src/config/aboutconfigdiag.cpp
Expand Up @@ -5,8 +5,6 @@

#include "aboutconfigdiag.h"

#include "jdlib/miscutil.h"

using namespace CONFIG;

AboutConfigDiagStr::AboutConfigDiagStr( Gtk::Window* parent, std::string* value, const std::string& defaultval )
Expand Down Expand Up @@ -52,7 +50,7 @@ AboutConfigDiagInt::AboutConfigDiagInt( Gtk::Window* parent, int* value, const i
{
resize( 200, 1 );

m_entry.set_text( MISC::itostr( *value ) );
m_entry.set_text( std::to_string( *value ) );
m_hbox.pack_start( m_entry );

m_button_default.signal_clicked().connect( sigc::mem_fun( *this, &AboutConfigDiagInt::slot_default ) );
Expand All @@ -76,7 +74,7 @@ void AboutConfigDiagInt::slot_ok_clicked()

void AboutConfigDiagInt::slot_default()
{
m_entry.set_text( MISC::itostr( m_defaultval ) );
m_entry.set_text( std::to_string( m_defaultval ) );
}


Expand Down
7 changes: 4 additions & 3 deletions src/core.cpp
Expand Up @@ -2316,7 +2316,7 @@ void Core::set_command( const COMMAND_ARGS& command )
// もう一度開く
if( command.arg1 == "reget" ){

const std::string str_num_open = "page" + MISC::itostr( num_open );
const std::string str_num_open = "page" + std::to_string( num_open );
const std::string mode = std::string( "noswitch" ) + ( locked ? " lock" : "" );
const std::string str_num_jump = command.arg2;

Expand Down Expand Up @@ -2809,7 +2809,8 @@ void Core::set_command( const COMMAND_ARGS& command )
const size_t max_lng = DBTREE::board_get_max_dat_lng( command.url );
if( max_lng > 0 && DBTREE::article_lng_dat( command.url ) > max_lng * 1000 ){

SKELETON::MsgDiag mdiag( NULL, "スレのサイズが" + MISC::itostr( max_lng ) + "Kバイトを越えています。\n\n本当に書き込みますか?",
SKELETON::MsgDiag mdiag( nullptr, "スレのサイズが" + std::to_string( max_lng )
+ "Kバイトを越えています。\n\n本当に書き込みますか?",
false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO );
if( mdiag.run() != Gtk::RESPONSE_YES ) return;
}
Expand Down Expand Up @@ -3268,7 +3269,7 @@ void Core::exec_command()
std::cout << "exec : open_article url = " << url_dat << std::endl;
#endif

if( num_from ) CORE::core_set_command( "open_article" , url_dat, "newtab", "", MISC::itostr( num_from ) );
if( num_from ) CORE::core_set_command( "open_article" , url_dat, "newtab", "", std::to_string( num_from ) );
else CORE::core_set_command( "open_article" , url_dat, "newtab", "" );
}

Expand Down