#include <string.h>#include <iostream>#include <iomanip>#include <stdlib.h>#include <ctype.h>#include "IntlDefs.h"#include "String.h"Include dependency graph for String.cc:

Go to the source code of this file.
Functions | |
| void | Error (const bool fatal, const String &function_name, const String &error_msg) |
| String | operator+ (const String &str1, const String &str2) |
| int | operator== (const String &str1, const String &str2) |
| int | operator!= (const String &str1, const String &str2) |
| String | get_segment (const String &str, const int start, const int end) |
| String | make_lower_case (const String &str) |
| int | str2int (const String &str) |
| long | str2long (const String &str) |
| double | str2dbl (const String &str) |
| long | str2hex (const String &str) |
| String | hex2str (long n) |
| istream & | operator>> (istream &is, String &str) |
| ostream & | operator<< (ostream &os, const String &str) |
|
||||||||||||||||
|
Definition at line 72 of file Various.cc. 00073 {
00074 cerr << "RealTimeBattle: " << _("Error in") << " "
00075 << function_name << ": " << error_msg << endl;
00076 // perror("RealTimeBattle: errno message");
00077
00078 if( fatal == true )
00079 {
00080 Quit(false);
00081 }
00082 }
|
|
||||||||||||||||
|
Definition at line 284 of file String.cc. References String::array, String::enlarge_array(), Error(), and String::length. Referenced by check_for_robots_and_arenas(), check_if_filename_is_arena(), check_if_filename_is_robot(), StartTournamentWindow::new_tournament(), Options::read_options_file(), Robot::Robot(), split_colonseparated_dirs(), and ArenaRealTime::start_game(). 00285 {
00286 String segment;
00287 int st = ( start < 0 ? str.length + start : start );
00288 int en = ( end < 0 ? str.length + end : end );
00289 if( st < 0 || st > str.length || en < 0 || en > str.length || st > en + 1 )
00290 Error(true, "String out of range", "String::get_segment");
00291
00292 if( st == en + 1 ) return segment;
00293
00294 segment.length = en - st + 1;
00295 segment.enlarge_array(segment.length);
00296 strncpy( segment.array, &str.array[st], segment.length );
00297 segment.array[segment.length] = '\0';
00298
00299 return segment;
00300 }
|
Here is the call graph for this function:

|
|
Definition at line 359 of file String.cc. References String::allocate_array(), String::array, String::erase(), and String::length. Referenced by OptionsWindow::long_def(), OptionsWindow::long_max(), OptionsWindow::long_min(), OptionsWindow::OptionsWindow(), ArenaRealTime::print_to_logfile(), Options::save_all_options_to_file(), and OptionsWindow::update_all_gtk_entries(). 00360 {
00361 String str;
00362 str.length = 15;
00363 str.allocate_array(15);
00364 str.array[15] = '\0';
00365 int pos = 14;
00366
00367 int k = ( n>0 ? n : -n );
00368
00369 if( k == 0 )
00370 str.array[pos--] = '0';
00371 else
00372 for(; k > 0; k/=16)
00373 {
00374 if( k%16 < 10 )
00375 str.array[pos--] = '0' + k%16;
00376 else
00377 str.array[pos--] = 'A' - 10 + k%16;
00378 }
00379
00380 if( n < 0 )
00381 {
00382 str.array[0] = '-';
00383 str.erase(1, pos);
00384 }
00385 else
00386 str.erase(0, pos+1);
00387
00388 return str;
00389 }
|
Here is the call graph for this function:

|
|
Definition at line 303 of file String.cc. References String::array, and String::length. Referenced by parse_tournament_file(). 00304 {
00305 String lower_str(str);
00306 for(int i = 0;i<lower_str.length;i++)
00307 lower_str.array[i] = tolower(lower_str.array[i]);
00308
00309 return lower_str;
00310 }
|
|
||||||||||||
|
Definition at line 223 of file String.cc. References String::array.
|
|
||||||||||||
|
Definition at line 208 of file String.cc. 00209 {
00210 String sum(str1);
00211 sum += str2;
00212
00213 return sum;
00214 }
|
|
||||||||||||
|
Definition at line 413 of file String.cc. References String::array. 00414 {
00415 os << str.array;
00416 return( os );
00417 }
|
|
||||||||||||
|
Definition at line 217 of file String.cc. References String::array.
|
|
||||||||||||
|
Definition at line 402 of file String.cc. 00403 {
00404 char buf[500];
00405 is.get(buf, 500, '\n');
00406
00407 str = buf;
00408
00409 return( is );
00410 }
|
|
|
Definition at line 324 of file String.cc. References String::array. Referenced by float_compare(), and OptionsWindow::set_all_options(). 00325 {
00326 return atof(str.array);
00327 }
|
|
|
Definition at line 330 of file String.cc. References String::array, and String::length. Referenced by ArenaReplay::parse_log_line(), Options::read_options_file(), and OptionsWindow::set_all_options(). 00331 {
00332 int pos = 0;
00333 long sign = 1;
00334 char c;
00335 long number = 0;
00336
00337 if( str.array[pos] == '-' )
00338 {
00339 pos++;
00340 sign = -1;
00341 }
00342
00343 for( ; pos < str.length; pos++)
00344 {
00345 c = str.array[pos];
00346 if( c >= '0' && c <= '9' )
00347 number=number*16+(c-'0');
00348 else if( c >='a' && c <= 'f' )
00349 number=number*16+10+(c-'a');
00350 else if( c >='A' && c <= 'F' )
00351 number=number*16+10+(c-'A');
00352 else break;
00353 }
00354
00355 return sign*number;
00356 }
|
|
|
Definition at line 312 of file String.cc. References String::array. Referenced by int_compare(), parse_command_line(), parse_tournament_file(), StartTournamentWindow::save_tournament_file(), StartTournamentWindow::set_entry(), and StartTournamentWindow::start(). 00313 {
00314 return atoi(str.array);
00315 }
|
|
|
Definition at line 318 of file String.cc. References String::array. Referenced by OptionsWindow::set_all_options(). 00319 {
00320 return atol(str.array);
00321 }
|
1.3.9.1