Commit 2e73e7bc7dc349d5742f975ea6ca4945959e486a
1 parent
f0d5a769
basic changes for envispec software
Showing
2 changed files
with
20 additions
and
16 deletions
Show diff stats
envi/bsq.h
ui/arguments.h
1 | -#ifndef RTS_ARGUMENTS | ||
2 | -#define RTS_ARGUMENTS | 1 | +#ifndef STIM_ARGUMENTS |
2 | +#define STIM_ARGUMENTS | ||
3 | 3 | ||
4 | #include <string> | 4 | #include <string> |
5 | #include <vector> | 5 | #include <vector> |
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | #include <Windows.h> | 13 | #include <Windows.h> |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | -namespace rts{ | 16 | +namespace stim{ |
17 | 17 | ||
18 | class argument | 18 | class argument |
19 | { | 19 | { |
@@ -82,7 +82,7 @@ namespace rts{ | @@ -82,7 +82,7 @@ namespace rts{ | ||
82 | } | 82 | } |
83 | 83 | ||
84 | //return the value of a text argument | 84 | //return the value of a text argument |
85 | - std::string as_text(int n = 0) | 85 | + std::string as_string(unsigned int n = 0) |
86 | { | 86 | { |
87 | if(!flag) | 87 | if(!flag) |
88 | { | 88 | { |
@@ -97,7 +97,7 @@ namespace rts{ | @@ -97,7 +97,7 @@ namespace rts{ | ||
97 | } | 97 | } |
98 | 98 | ||
99 | //return the value of a floating point argument | 99 | //return the value of a floating point argument |
100 | - float as_float(int n = 0) | 100 | + float as_float(unsigned int n = 0) |
101 | { | 101 | { |
102 | if(!flag) | 102 | if(!flag) |
103 | { | 103 | { |
@@ -108,7 +108,7 @@ namespace rts{ | @@ -108,7 +108,7 @@ namespace rts{ | ||
108 | if(vals.size() > n) | 108 | if(vals.size() > n) |
109 | { | 109 | { |
110 | float r; | 110 | float r; |
111 | - if ( ! (istringstream(vals[n]) >> r) ) r = 0; | 111 | + if ( ! (std::istringstream(vals[n]) >> r) ) r = 0; |
112 | return r; | 112 | return r; |
113 | } | 113 | } |
114 | 114 | ||
@@ -116,7 +116,7 @@ namespace rts{ | @@ -116,7 +116,7 @@ namespace rts{ | ||
116 | } | 116 | } |
117 | 117 | ||
118 | //return the value of an integer argument | 118 | //return the value of an integer argument |
119 | - int as_int(int n = 0) | 119 | + int as_int(unsigned int n = 0) |
120 | { | 120 | { |
121 | if(!flag) | 121 | if(!flag) |
122 | { | 122 | { |
@@ -127,7 +127,7 @@ namespace rts{ | @@ -127,7 +127,7 @@ namespace rts{ | ||
127 | if(vals.size() > n) | 127 | if(vals.size() > n) |
128 | { | 128 | { |
129 | int r; | 129 | int r; |
130 | - if ( ! (istringstream(vals[n]) >> r) ) r = 0; | 130 | + if ( ! (std::istringstream(vals[n]) >> r) ) r = 0; |
131 | return r; | 131 | return r; |
132 | } | 132 | } |
133 | 133 | ||
@@ -148,7 +148,7 @@ namespace rts{ | @@ -148,7 +148,7 @@ namespace rts{ | ||
148 | n += 6; | 148 | n += 6; |
149 | 149 | ||
150 | //for each default argument value | 150 | //for each default argument value |
151 | - for(int v=0; v<vals.size(); v++) | 151 | + for(unsigned int v=0; v<vals.size(); v++) |
152 | n += vals[v].size() + 1; | 152 | n += vals[v].size() + 1; |
153 | } | 153 | } |
154 | 154 | ||
@@ -174,7 +174,7 @@ namespace rts{ | @@ -174,7 +174,7 @@ namespace rts{ | ||
174 | if(ansi) | 174 | if(ansi) |
175 | left_part += "\033[1;32m"; | 175 | left_part += "\033[1;32m"; |
176 | left_part += " ( = "; | 176 | left_part += " ( = "; |
177 | - for(int v=0; v<vals.size(); v++) | 177 | + for(unsigned int v=0; v<vals.size(); v++) |
178 | left_part += vals[v] + std::string(" "); | 178 | left_part += vals[v] + std::string(" "); |
179 | left_part += ")"; | 179 | left_part += ")"; |
180 | if(ansi) | 180 | if(ansi) |
@@ -191,7 +191,7 @@ namespace rts{ | @@ -191,7 +191,7 @@ namespace rts{ | ||
191 | ss<<std::left<<std::setw(width + color_size)<<left_part; | 191 | ss<<std::left<<std::setw(width + color_size)<<left_part; |
192 | 192 | ||
193 | //output right column | 193 | //output right column |
194 | - for(int d=0; d<desc.size(); d++) | 194 | + for(unsigned int d=0; d<desc.size(); d++) |
195 | { | 195 | { |
196 | if(d == 0) | 196 | if(d == 0) |
197 | ss<<desc[0]; | 197 | ss<<desc[0]; |
@@ -261,7 +261,7 @@ namespace rts{ | @@ -261,7 +261,7 @@ namespace rts{ | ||
261 | void set_ansi(bool b) | 261 | void set_ansi(bool b) |
262 | { | 262 | { |
263 | ansi = b; | 263 | ansi = b; |
264 | - for(int i=0; i<args.size(); i++) | 264 | + for(unsigned int i=0; i<args.size(); i++) |
265 | args[i].set_ansi(ansi); | 265 | args[i].set_ansi(ansi); |
266 | } | 266 | } |
267 | 267 | ||
@@ -293,7 +293,7 @@ namespace rts{ | @@ -293,7 +293,7 @@ namespace rts{ | ||
293 | si = 0; | 293 | si = 0; |
294 | 294 | ||
295 | //for each argument | 295 | //for each argument |
296 | - for(int a=0; a<args.size(); a++) | 296 | + for(unsigned int a=0; a<args.size(); a++) |
297 | { | 297 | { |
298 | if(si != -1 && a == sections[si].index) | 298 | if(si != -1 && a == sections[si].index) |
299 | { | 299 | { |
@@ -302,7 +302,7 @@ namespace rts{ | @@ -302,7 +302,7 @@ namespace rts{ | ||
302 | else | 302 | else |
303 | ss<<std::endl<<std::left<<std::setfill('=')<<std::setw(col_width)<<sections[si].name<<std::endl; | 303 | ss<<std::endl<<std::left<<std::setfill('=')<<std::setw(col_width)<<sections[si].name<<std::endl; |
304 | si++; | 304 | si++; |
305 | - if(si == sections.size()) si = -1; | 305 | + if(si == (int)sections.size()) si = -1; |
306 | } | 306 | } |
307 | 307 | ||
308 | ss<<args[a].toStr(col_width)<<std::endl; | 308 | ss<<args[a].toStr(col_width)<<std::endl; |
@@ -313,7 +313,7 @@ namespace rts{ | @@ -313,7 +313,7 @@ namespace rts{ | ||
313 | 313 | ||
314 | int index(std::string _name) | 314 | int index(std::string _name) |
315 | { | 315 | { |
316 | - int i = find(args.begin(), args.end(), _name) - args.begin(); | 316 | + unsigned int i = find(args.begin(), args.end(), _name) - args.begin(); |
317 | 317 | ||
318 | if(i >= args.size()) | 318 | if(i >= args.size()) |
319 | i = -1; | 319 | i = -1; |
@@ -414,6 +414,6 @@ namespace rts{ | @@ -414,6 +414,6 @@ namespace rts{ | ||
414 | 414 | ||
415 | 415 | ||
416 | 416 | ||
417 | -} //end namespace rts | 417 | +} //end namespace stim |
418 | 418 | ||
419 | #endif | 419 | #endif |