diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-01-20 18:09:04 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-20 18:09:04 +0000 |
commit | 393f1b414746a7f1977971dd7659dd2b47092b11 (patch) | |
tree | 81d0ca1ee70ab86a7d79c1991abe5c387b655fb2 /src/string.cpp | |
parent | c259f95bd0e58b247940a339bb9b4b401b4e9438 (diff) | |
parent | 7e25a863325dc3e9762397e700030969e093b087 (diff) | |
download | libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.gz libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.bz2 libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.xz libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.zip |
Wow! Merged the branch, streams are updated, and there's no more FString, run
the fixstrings.sh script in the support directory to (hopefully) automatically
update your projects.
Diffstat (limited to '')
-rw-r--r-- | src/string.cpp (renamed from src/fstring.cpp) | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/fstring.cpp b/src/string.cpp index a3e0cb1..538ac52 100644 --- a/src/fstring.cpp +++ b/src/string.cpp | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2007-2010 Xagasoft, All rights reserved. | 2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. |
3 | * | 3 | * |
4 | * This file is part of the libbu++ library and is released under the | 4 | * This file is part of the libbu++ library and is released under the |
5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
@@ -8,12 +8,12 @@ | |||
8 | #define BU_TRACE | 8 | #define BU_TRACE |
9 | #include "bu/trace.h" | 9 | #include "bu/trace.h" |
10 | 10 | ||
11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
12 | #include "bu/hash.h" | 12 | #include "bu/hash.h" |
13 | 13 | ||
14 | template class Bu::FBasicString<char>; | 14 | template class Bu::BasicString<char>; |
15 | 15 | ||
16 | template<> uint32_t Bu::__calcHashCode<Bu::FString>( const Bu::FString &k ) | 16 | template<> uint32_t Bu::__calcHashCode<Bu::String>( const Bu::String &k ) |
17 | { | 17 | { |
18 | long j, sz = k.getSize(); | 18 | long j, sz = k.getSize(); |
19 | const char *s = k.getStr(); | 19 | const char *s = k.getStr(); |
@@ -27,18 +27,18 @@ template<> uint32_t Bu::__calcHashCode<Bu::FString>( const Bu::FString &k ) | |||
27 | return nPos; | 27 | return nPos; |
28 | } | 28 | } |
29 | 29 | ||
30 | template<> bool Bu::__cmpHashKeys<Bu::FString>( | 30 | template<> bool Bu::__cmpHashKeys<Bu::String>( |
31 | const Bu::FString &a, const Bu::FString &b ) | 31 | const Bu::String &a, const Bu::String &b ) |
32 | { | 32 | { |
33 | return a == b; | 33 | return a == b; |
34 | } | 34 | } |
35 | 35 | ||
36 | template<> void Bu::__tracer_format<Bu::FString>( const Bu::FString &v ) | 36 | template<> void Bu::__tracer_format<Bu::String>( const Bu::String &v ) |
37 | { | 37 | { |
38 | printf("(%ld)\"%s\"", v.getSize(), v.getStr() ); | 38 | printf("(%ld)\"%s\"", v.getSize(), v.getStr() ); |
39 | } | 39 | } |
40 | 40 | ||
41 | bool &Bu::operator<<( bool &dst, const Bu::FString &sIn ) | 41 | bool &Bu::operator<<( bool &dst, const Bu::String &sIn ) |
42 | { | 42 | { |
43 | if( sIn == "true" || sIn == "yes" || sIn == "t" ) | 43 | if( sIn == "true" || sIn == "yes" || sIn == "t" ) |
44 | dst = true; | 44 | dst = true; |
@@ -48,79 +48,79 @@ bool &Bu::operator<<( bool &dst, const Bu::FString &sIn ) | |||
48 | return dst; | 48 | return dst; |
49 | } | 49 | } |
50 | 50 | ||
51 | uint8_t &Bu::operator<<( uint8_t &dst, const Bu::FString &sIn ) | 51 | uint8_t &Bu::operator<<( uint8_t &dst, const Bu::String &sIn ) |
52 | { | 52 | { |
53 | sscanf( sIn.getStr(), "%hhu", &dst ); | 53 | sscanf( sIn.getStr(), "%hhu", &dst ); |
54 | return dst; | 54 | return dst; |
55 | } | 55 | } |
56 | 56 | ||
57 | int8_t &Bu::operator<<( int8_t &dst, const Bu::FString &sIn ) | 57 | int8_t &Bu::operator<<( int8_t &dst, const Bu::String &sIn ) |
58 | { | 58 | { |
59 | sscanf( sIn.getStr(), "%hhd", &dst ); | 59 | sscanf( sIn.getStr(), "%hhd", &dst ); |
60 | return dst; | 60 | return dst; |
61 | } | 61 | } |
62 | 62 | ||
63 | char &Bu::operator<<( char &dst, const Bu::FString &sIn ) | 63 | char &Bu::operator<<( char &dst, const Bu::String &sIn ) |
64 | { | 64 | { |
65 | sscanf( sIn.getStr(), "%hhd", &dst ); | 65 | sscanf( sIn.getStr(), "%hhd", &dst ); |
66 | return dst; | 66 | return dst; |
67 | } | 67 | } |
68 | 68 | ||
69 | uint16_t &Bu::operator<<( uint16_t &dst, const Bu::FString &sIn ) | 69 | uint16_t &Bu::operator<<( uint16_t &dst, const Bu::String &sIn ) |
70 | { | 70 | { |
71 | sscanf( sIn.getStr(), "%hu", &dst ); | 71 | sscanf( sIn.getStr(), "%hu", &dst ); |
72 | return dst; | 72 | return dst; |
73 | } | 73 | } |
74 | 74 | ||
75 | int16_t &Bu::operator<<( int16_t &dst, const Bu::FString &sIn ) | 75 | int16_t &Bu::operator<<( int16_t &dst, const Bu::String &sIn ) |
76 | { | 76 | { |
77 | sscanf( sIn.getStr(), "%hd", &dst ); | 77 | sscanf( sIn.getStr(), "%hd", &dst ); |
78 | return dst; | 78 | return dst; |
79 | } | 79 | } |
80 | 80 | ||
81 | uint32_t &Bu::operator<<( uint32_t &dst, const Bu::FString &sIn ) | 81 | uint32_t &Bu::operator<<( uint32_t &dst, const Bu::String &sIn ) |
82 | { | 82 | { |
83 | sscanf( sIn.getStr(), "%u", &dst ); | 83 | sscanf( sIn.getStr(), "%u", &dst ); |
84 | return dst; | 84 | return dst; |
85 | } | 85 | } |
86 | 86 | ||
87 | int32_t &Bu::operator<<( int32_t &dst, const Bu::FString &sIn ) | 87 | int32_t &Bu::operator<<( int32_t &dst, const Bu::String &sIn ) |
88 | { | 88 | { |
89 | sscanf( sIn.getStr(), "%d", &dst ); | 89 | sscanf( sIn.getStr(), "%d", &dst ); |
90 | return dst; | 90 | return dst; |
91 | } | 91 | } |
92 | 92 | ||
93 | uint64_t &Bu::operator<<( uint64_t &dst, const Bu::FString &sIn ) | 93 | uint64_t &Bu::operator<<( uint64_t &dst, const Bu::String &sIn ) |
94 | { | 94 | { |
95 | sscanf( sIn.getStr(), "%llu", &dst ); | 95 | sscanf( sIn.getStr(), "%llu", &dst ); |
96 | return dst; | 96 | return dst; |
97 | } | 97 | } |
98 | 98 | ||
99 | int64_t &Bu::operator<<( int64_t &dst, const Bu::FString &sIn ) | 99 | int64_t &Bu::operator<<( int64_t &dst, const Bu::String &sIn ) |
100 | { | 100 | { |
101 | sscanf( sIn.getStr(), "%lld", &dst ); | 101 | sscanf( sIn.getStr(), "%lld", &dst ); |
102 | return dst; | 102 | return dst; |
103 | } | 103 | } |
104 | 104 | ||
105 | float &Bu::operator<<( float &dst, const Bu::FString &sIn ) | 105 | float &Bu::operator<<( float &dst, const Bu::String &sIn ) |
106 | { | 106 | { |
107 | sscanf( sIn.getStr(), "%f", &dst ); | 107 | sscanf( sIn.getStr(), "%f", &dst ); |
108 | return dst; | 108 | return dst; |
109 | } | 109 | } |
110 | 110 | ||
111 | double &Bu::operator<<( double &dst, const Bu::FString &sIn ) | 111 | double &Bu::operator<<( double &dst, const Bu::String &sIn ) |
112 | { | 112 | { |
113 | sscanf( sIn.getStr(), "%lf", &dst ); | 113 | sscanf( sIn.getStr(), "%lf", &dst ); |
114 | return dst; | 114 | return dst; |
115 | } | 115 | } |
116 | 116 | ||
117 | long double &Bu::operator<<( long double &dst, const Bu::FString &sIn ) | 117 | long double &Bu::operator<<( long double &dst, const Bu::String &sIn ) |
118 | { | 118 | { |
119 | sscanf( sIn.getStr(), "%Lf", &dst ); | 119 | sscanf( sIn.getStr(), "%Lf", &dst ); |
120 | return dst; | 120 | return dst; |
121 | } | 121 | } |
122 | 122 | ||
123 | Bu::FString &Bu::operator<<( Bu::FString &dst, const Bu::FString &sIn ) | 123 | Bu::String &Bu::operator<<( Bu::String &dst, const Bu::String &sIn ) |
124 | { | 124 | { |
125 | dst = sIn; | 125 | dst = sIn; |
126 | return dst; | 126 | return dst; |