diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-10-20 17:59:32 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-10-20 17:59:32 +0000 |
commit | addca63bba3ddaf212e44cdf16e95038b0a5bf3e (patch) | |
tree | 3aeded76d3104689485f6e66ba6a126c2bcf1287 | |
parent | 640154682b767ec19cb9ac3972118c10bba8e780 (diff) | |
download | libbu++-addca63bba3ddaf212e44cdf16e95038b0a5bf3e.tar.gz libbu++-addca63bba3ddaf212e44cdf16e95038b0a5bf3e.tar.bz2 libbu++-addca63bba3ddaf212e44cdf16e95038b0a5bf3e.tar.xz libbu++-addca63bba3ddaf212e44cdf16e95038b0a5bf3e.zip |
Just marked Bu::FString::c_str as deprecated, don't use it, it'll go away later.
-rw-r--r-- | src/fstring.h | 12 | ||||
-rw-r--r-- | src/paramproc.cpp | 2 | ||||
-rw-r--r-- | src/tests/fstratsptr.cpp | 4 | ||||
-rw-r--r-- | src/tests/fstring.cpp | 9 | ||||
-rw-r--r-- | src/unit/taf.cpp | 6 |
5 files changed, 23 insertions, 10 deletions
diff --git a/src/fstring.h b/src/fstring.h index 97959d3..c324e4a 100644 --- a/src/fstring.h +++ b/src/fstring.h | |||
@@ -11,6 +11,16 @@ | |||
11 | 11 | ||
12 | #define min( a, b ) ((a<b)?(a):(b)) | 12 | #define min( a, b ) ((a<b)?(a):(b)) |
13 | 13 | ||
14 | /* I borrowed this from someone who borrowed it from glib who borrowed it | ||
15 | * from... | ||
16 | */ | ||
17 | #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) | ||
18 | #define DEPRECATED __attribute__((__deprecated__)) | ||
19 | #else | ||
20 | #define DEPRECATED | ||
21 | #endif /* __GNUC__ */ | ||
22 | |||
23 | |||
14 | namespace Bu | 24 | namespace Bu |
15 | { | 25 | { |
16 | template< typename chr > | 26 | template< typename chr > |
@@ -286,6 +296,7 @@ namespace Bu | |||
286 | * (std::string compatability) Get a pointer to the string array. | 296 | * (std::string compatability) Get a pointer to the string array. |
287 | *@returns (chr *) The string data. | 297 | *@returns (chr *) The string data. |
288 | */ | 298 | */ |
299 | DEPRECATED | ||
289 | chr *c_str() | 300 | chr *c_str() |
290 | { | 301 | { |
291 | if( pFirst == NULL ) | 302 | if( pFirst == NULL ) |
@@ -300,6 +311,7 @@ namespace Bu | |||
300 | * (std::string compatability) Get a const pointer to the string array. | 311 | * (std::string compatability) Get a const pointer to the string array. |
301 | *@returns (const chr *) The string data. | 312 | *@returns (const chr *) The string data. |
302 | */ | 313 | */ |
314 | DEPRECATED | ||
303 | const chr *c_str() const | 315 | const chr *c_str() const |
304 | { | 316 | { |
305 | if( pFirst == NULL ) | 317 | if( pFirst == NULL ) |
diff --git a/src/paramproc.cpp b/src/paramproc.cpp index 67ef44b..c197e9c 100644 --- a/src/paramproc.cpp +++ b/src/paramproc.cpp | |||
@@ -484,7 +484,7 @@ int Bu::ParamProc::help( int argc, char *argv[] ) | |||
484 | Bu::FString sTmp = (*i)->sWord.getStr(); | 484 | Bu::FString sTmp = (*i)->sWord.getStr(); |
485 | if( (*i)->sExtra.getStr() ) | 485 | if( (*i)->sExtra.getStr() ) |
486 | sTmp += (*i)->sExtra.getStr(); | 486 | sTmp += (*i)->sExtra.getStr(); |
487 | printf( fmt, sTmp.c_str() ); | 487 | printf( fmt, sTmp.getStr() ); |
488 | } | 488 | } |
489 | else | 489 | else |
490 | { | 490 | { |
diff --git a/src/tests/fstratsptr.cpp b/src/tests/fstratsptr.cpp index 343f682..61c20bd 100644 --- a/src/tests/fstratsptr.cpp +++ b/src/tests/fstratsptr.cpp | |||
@@ -22,8 +22,8 @@ void Swap(PersonPtr one, PersonPtr two) | |||
22 | 22 | ||
23 | printf( | 23 | printf( |
24 | "%s %s\n", | 24 | "%s %s\n", |
25 | three->sFirstName->c_str(), | 25 | three->sFirstName->getStr(), |
26 | three->sLastName->c_str() ); | 26 | three->sLastName->getStr() ); |
27 | } | 27 | } |
28 | 28 | ||
29 | int main() | 29 | int main() |
diff --git a/src/tests/fstring.cpp b/src/tests/fstring.cpp index 11f147d..d20309a 100644 --- a/src/tests/fstring.cpp +++ b/src/tests/fstring.cpp | |||
@@ -27,13 +27,14 @@ Bu::FString genThing() | |||
27 | bob += "cd "; | 27 | bob += "cd "; |
28 | bob += "efg"; | 28 | bob += "efg"; |
29 | 29 | ||
30 | printf("---bob------\n%08X: %s\n", (unsigned int)bob.c_str(), bob.c_str() ); | 30 | printf("---bob------\n%08X: %s\n", (unsigned int)bob.getStr(), |
31 | bob.getStr() ); | ||
31 | return bob; | 32 | return bob; |
32 | } | 33 | } |
33 | 34 | ||
34 | void thing( Bu::FString str ) | 35 | void thing( Bu::FString str ) |
35 | { | 36 | { |
36 | printf("Hey: %s\n", str.c_str() ); | 37 | printf("Hey: %s\n", str.getStr() ); |
37 | } | 38 | } |
38 | 39 | ||
39 | void copyfunc( std::string temp ) | 40 | void copyfunc( std::string temp ) |
@@ -107,7 +108,7 @@ void doTimings() | |||
107 | delete[] buf; | 108 | delete[] buf; |
108 | } | 109 | } |
109 | 110 | ||
110 | #define pem printf("---------\n%08X: %s\n%08X: %s\n", (unsigned int)str.c_str(), str.c_str(), (unsigned int)str2.c_str(), str2.c_str() ); | 111 | #define pem printf("---------\n%08X: %s\n%08X: %s\n", (unsigned int)str.getStr(), str.getStr(), (unsigned int)str2.getStr(), str2.getStr() ); |
111 | int main( int argc, char *argv ) | 112 | int main( int argc, char *argv ) |
112 | { | 113 | { |
113 | Bu::FString fs1; | 114 | Bu::FString fs1; |
@@ -137,7 +138,7 @@ int main( int argc, char *argv ) | |||
137 | thing( str2 ); | 138 | thing( str2 ); |
138 | thing("test."); | 139 | thing("test."); |
139 | 140 | ||
140 | printf("%d == %d\n", Bu::__calcHashCode( str ), Bu::__calcHashCode( str.c_str() ) ); | 141 | printf("%d == %d\n", Bu::__calcHashCode( str ), Bu::__calcHashCode( str.getStr() ) ); |
141 | 142 | ||
142 | doTimings(); | 143 | doTimings(); |
143 | } | 144 | } |
diff --git a/src/unit/taf.cpp b/src/unit/taf.cpp index 5e0e914..94b4613 100644 --- a/src/unit/taf.cpp +++ b/src/unit/taf.cpp | |||
@@ -29,14 +29,14 @@ public: | |||
29 | fOut.write(data,strlen(data)); | 29 | fOut.write(data,strlen(data)); |
30 | fOut.close(); | 30 | fOut.close(); |
31 | 31 | ||
32 | Bu::File fIn(sFnTmp.c_str(), "rb"); | 32 | Bu::File fIn(sFnTmp.getStr(), "rb"); |
33 | Bu::TafReader tr(fIn); | 33 | Bu::TafReader tr(fIn); |
34 | 34 | ||
35 | Bu::TafGroup *tn = tr.readGroup(); | 35 | Bu::TafGroup *tn = tr.readGroup(); |
36 | unitTest( !strcmp("Bob", tn->getProperty("name").c_str()) ); | 36 | unitTest( !strcmp("Bob", tn->getProperty("name").getStr()) ); |
37 | delete tn; | 37 | delete tn; |
38 | 38 | ||
39 | unlink(sFnTmp.c_str()); | 39 | unlink(sFnTmp.getStr()); |
40 | #undef FN_TMP | 40 | #undef FN_TMP |
41 | } | 41 | } |
42 | }; | 42 | }; |