#include <assert.h>
#include <string.h>
#include <stdio.h>
Include dependency graph for util_str.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| class | idStr |
| class | strdata |
Functions | |
| bool | operator!= (const char *a, const idStr &b) |
| bool | operator!= (const idStr &a, const char *b) |
| bool | operator!= (const idStr &a, const idStr &b) |
| idStr | operator+ (const idStr &a, const char b) |
| idStr | operator+ (const idStr &a, const bool b) |
| idStr | operator+ (const char *a, const idStr &b) |
| idStr | operator+ (const idStr &a, const char *b) |
| idStr | operator+ (const idStr &a, const idStr &b) |
| bool | operator== (const char *a, const idStr &b) |
| bool | operator== (const idStr &a, const char *b) |
| bool | operator== (const idStr &a, const idStr &b) |
| void | TestStringClass () |
|
||||||||||||
|
Definition at line 659 of file util_str.h. 00664 {
00665 return !( a == b );
00666 }
|
|
||||||||||||
|
Definition at line 649 of file util_str.h. 00654 {
00655 return !( a == b );
00656 }
|
|
||||||||||||
|
Definition at line 639 of file util_str.h. 00644 {
00645 return !( a == b );
00646 }
|
|
||||||||||||
|
Definition at line 539 of file util_str.h. 00544 {
00545 char text[ 2 ];
00546
00547 text[ 0 ] = b;
00548 text[ 1 ] = 0;
00549
00550 return a + text;
00551 }
|
|
||||||||||||
|
Definition at line 525 of file util_str.h. References a, idStr::append(), and b. 00530 {
00531 idStr result( a );
00532
00533 result.append( b ? "true" : "false" );
00534
00535 return result;
00536 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 511 of file util_str.h. References a, idStr::append(), and b. 00516 {
00517 idStr result( a );
00518
00519 result.append( b );
00520
00521 return result;
00522 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 497 of file util_str.h. References a, idStr::append(), and b. 00502 {
00503 idStr result( a );
00504
00505 result.append( b );
00506
00507 return result;
00508 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 483 of file util_str.h. References a, idStr::append(), and b. 00488 {
00489 idStr result( a );
00490
00491 result.append( b );
00492
00493 return result;
00494 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 624 of file util_str.h. References a, assert, b, and strcmp(). 00629 {
00630 assert( a );
00631 if ( !a )
00632 {
00633 return false;
00634 }
00635 return ( !strcmp( a, b.c_str() ) );
00636 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 609 of file util_str.h. References a, assert, b, idStr::c_str(), and strcmp(). 00614 {
00615 assert( b );
00616 if ( !b )
00617 {
00618 return false;
00619 }
00620 return ( !strcmp( a.c_str(), b ) );
00621 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 599 of file util_str.h. References a, b, idStr::c_str(), and strcmp().
|
Here is the call graph for this function:

|
|
Definition at line 513 of file util_str.cpp. References a, b, c, idStr::c_str(), ch, d, e, i, idStr::length(), NULL, and t. 00517 {
00518 char ch; // ch == ?
00519 idStr *t; // t == ?
00520 idStr a; // a.len == 0, a.data == "\0"
00521 idStr b; // b.len == 0, b.data == "\0"
00522 idStr c( "test" ); // c.len == 4, c.data == "test\0"
00523 idStr d( c ); // d.len == 4, d.data == "test\0"
00524 idStr e( reinterpret_cast<const char *>(NULL) );
00525 // e.len == 0, e.data == "\0" ASSERT!
00526 int i; // i == ?
00527
00528 i = a.length(); // i == 0
00529 i = c.length(); // i == 4
00530
00531 // TTimo: not used
00532 // const char *s1 = a.c_str(); // s1 == "\0"
00533 // const char *s2 = c.c_str(); // s2 == "test\0"
00534
00535 t = new idStr(); // t->len == 0, t->data == "\0"
00536 delete t; // t == ?
00537
00538 b = "test"; // b.len == 4, b.data == "test\0"
00539 t = new idStr( "test" ); // t->len == 4, t->data == "test\0"
00540 delete t; // t == ?
00541
00542 a = c; // a.len == 4, a.data == "test\0"
00543 // a = "";
00544 a = NULL; // a.len == 0, a.data == "\0" ASSERT!
00545 a = c + d; // a.len == 8, a.data == "testtest\0"
00546 a = c + "wow"; // a.len == 7, a.data == "testwow\0"
00547 a = c + reinterpret_cast<const char *>(NULL);
00548 // a.len == 4, a.data == "test\0" ASSERT!
00549 a = "this" + d; // a.len == 8, a.data == "thistest\0"
00550 a = reinterpret_cast<const char *>(NULL) + d;
00551 // a.len == 4, a.data == "test\0" ASSERT!
00552 a += c; // a.len == 8, a.data == "testtest\0"
00553 a += "wow"; // a.len == 11, a.data == "testtestwow\0"
00554 a += reinterpret_cast<const char *>(NULL);
00555 // a.len == 11, a.data == "testtestwow\0" ASSERT!
00556
00557 a = "test"; // a.len == 4, a.data == "test\0"
00558 ch = a[ 0 ]; // ch == 't'
00559 ch = a[ -1 ]; // ch == 0 ASSERT!
00560 ch = a[ 1000 ]; // ch == 0 ASSERT!
00561 ch = a[ 0 ]; // ch == 't'
00562 ch = a[ 1 ]; // ch == 'e'
00563 ch = a[ 2 ]; // ch == 's'
00564 ch = a[ 3 ]; // ch == 't'
00565 ch = a[ 4 ]; // ch == '\0' ASSERT!
00566 ch = a[ 5 ]; // ch == '\0' ASSERT!
00567
00568 a[ 1 ] = 'b'; // a.len == 4, a.data == "tbst\0"
00569 a[ -1 ] = 'b'; // a.len == 4, a.data == "tbst\0" ASSERT!
00570 a[ 0 ] = '0'; // a.len == 4, a.data == "0bst\0"
00571 a[ 1 ] = '1'; // a.len == 4, a.data == "01st\0"
00572 a[ 2 ] = '2'; // a.len == 4, a.data == "012t\0"
00573 a[ 3 ] = '3'; // a.len == 4, a.data == "0123\0"
00574 a[ 4 ] = '4'; // a.len == 4, a.data == "0123\0" ASSERT!
00575 a[ 5 ] = '5'; // a.len == 4, a.data == "0123\0" ASSERT!
00576 a[ 7 ] = '7'; // a.len == 4, a.data == "0123\0" ASSERT!
00577
00578 a = "test"; // a.len == 4, a.data == "test\0"
00579 b = "no"; // b.len == 2, b.data == "no\0"
00580
00581 i = ( a == b ); // i == 0
00582 i = ( a == c ); // i == 1
00583
00584 i = ( a == "blow" ); // i == 0
00585 i = ( a == "test" ); // i == 1
00586 i = ( a == NULL ); // i == 0 ASSERT!
00587
00588 i = ( "test" == b ); // i == 0
00589 i = ( "test" == a ); // i == 1
00590 i = ( NULL == a ); // i == 0 ASSERT!
00591
00592 i = ( a != b ); // i == 1
00593 i = ( a != c ); // i == 0
00594
00595 i = ( a != "blow" ); // i == 1
00596 i = ( a != "test" ); // i == 0
00597 i = ( a != NULL ); // i == 1 ASSERT!
00598
00599 i = ( "test" != b ); // i == 1
00600 i = ( "test" != a ); // i == 0
00601 i = ( NULL != a ); // i == 1 ASSERT!
00602
00603 a = "test"; // a.data == "test"
00604 b = a; // b.data == "test"
00605
00606 a = "not"; // a.data == "not", b.data == "test"
00607
00608 a = b; // a.data == b.data == "test"
00609
00610 a += b; // a.data == "testtest", b.data = "test"
00611
00612 a = b;
00613
00614 a[1] = '1'; // a.data = "t1st", b.data = "test"
00615 }
|
Here is the call graph for this function:

1.3.9.1