@@ -56,7 +56,18 @@ namespace Read_Txt_Input
5656 void Input_Process::check_transform ()
5757 {
5858 for (auto &item : input.list )
59+ {
5960 item.second .check_transform (item.second );
61+
62+ for (size_t i=0 ; i<item.second .values .size (); ++i)
63+ {
64+ if (item.second .values_type [i]==" b" )
65+ {
66+ if (!Read_Txt_Tools::in_set ( item.second .values [i].gets (), Read_Txt_Tools::Preset::Bool))
67+ throw std::invalid_argument (" INPUT " +item.second .label +" must be bool" );
68+ }
69+ }
70+ }
6071 }
6172
6273 void Input_Process::default2 ()
@@ -71,9 +82,26 @@ namespace Read_Txt_Input
7182 for (const std::string &label : input.add_order )
7283 {
7384 ofs<<label<<" \t " ;
74- for (const Input_Value &value : input.list .at (label).values )
75- ofs<<value.gets ()<<" " ;
76- ofs<<" \t # " <<input.list .at (label).annotation <<std::endl;
85+ const Read_Txt_Input::Input_Item &item = input.list .at (label);
86+ for (size_t i=0 ; i<item.values .size (); ++i)
87+ {
88+ if (item.values_type [i]==" s" )
89+ ofs<<item.values [i].gets ()<<" " ;
90+ else if (item.values_type [i]==" d" )
91+ ofs<<std::to_string (item.values [i].getd ())<<" " ;
92+ else if (item.values_type [i]==" i" )
93+ ofs<<std::to_string (item.values [i].geti ())<<" " ;
94+ else if (item.values_type [i]==" b" )
95+ {
96+ if (item.values [i].getb ())
97+ ofs<<" true" <<" " ;
98+ else
99+ ofs<<" false" <<" " ;
100+ }
101+ else
102+ throw invalid_argument (" Input_Process::out() value_type[" +std::to_string (i)+" ]=" +item.values_type [i]);
103+ }
104+ ofs<<" \t # " <<item.annotation <<std::endl;
77105 }
78106 }
79107
0 commit comments