aboutsummaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 18:09:04 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 18:09:04 +0000
commit393f1b414746a7f1977971dd7659dd2b47092b11 (patch)
tree81d0ca1ee70ab86a7d79c1991abe5c387b655fb2 /src/string.cpp
parentc259f95bd0e58b247940a339bb9b4b401b4e9438 (diff)
parent7e25a863325dc3e9762397e700030969e093b087 (diff)
downloadlibbu++-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
14template class Bu::FBasicString<char>; 14template class Bu::BasicString<char>;
15 15
16template<> uint32_t Bu::__calcHashCode<Bu::FString>( const Bu::FString &k ) 16template<> 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
30template<> bool Bu::__cmpHashKeys<Bu::FString>( 30template<> 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
36template<> void Bu::__tracer_format<Bu::FString>( const Bu::FString &v ) 36template<> 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
41bool &Bu::operator<<( bool &dst, const Bu::FString &sIn ) 41bool &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
51uint8_t &Bu::operator<<( uint8_t &dst, const Bu::FString &sIn ) 51uint8_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
57int8_t &Bu::operator<<( int8_t &dst, const Bu::FString &sIn ) 57int8_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
63char &Bu::operator<<( char &dst, const Bu::FString &sIn ) 63char &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
69uint16_t &Bu::operator<<( uint16_t &dst, const Bu::FString &sIn ) 69uint16_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
75int16_t &Bu::operator<<( int16_t &dst, const Bu::FString &sIn ) 75int16_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
81uint32_t &Bu::operator<<( uint32_t &dst, const Bu::FString &sIn ) 81uint32_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
87int32_t &Bu::operator<<( int32_t &dst, const Bu::FString &sIn ) 87int32_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
93uint64_t &Bu::operator<<( uint64_t &dst, const Bu::FString &sIn ) 93uint64_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
99int64_t &Bu::operator<<( int64_t &dst, const Bu::FString &sIn ) 99int64_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
105float &Bu::operator<<( float &dst, const Bu::FString &sIn ) 105float &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
111double &Bu::operator<<( double &dst, const Bu::FString &sIn ) 111double &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
117long double &Bu::operator<<( long double &dst, const Bu::FString &sIn ) 117long 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
123Bu::FString &Bu::operator<<( Bu::FString &dst, const Bu::FString &sIn ) 123Bu::String &Bu::operator<<( Bu::String &dst, const Bu::String &sIn )
124{ 124{
125 dst = sIn; 125 dst = sIn;
126 return dst; 126 return dst;