aboutsummaryrefslogtreecommitdiff
path: root/src/tests/cache.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/tests/cache.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/tests/cache.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/tests/cache.cpp b/src/tests/cache.cpp
index 7fe660a..243012d 100644
--- a/src/tests/cache.cpp
+++ b/src/tests/cache.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.
@@ -14,7 +14,7 @@
14 14
15#include "bu/cache.h" 15#include "bu/cache.h"
16#include "bu/file.h" 16#include "bu/file.h"
17#include "bu/fstring.h" 17#include "bu/string.h"
18#include "bu/cachecalc.h" 18#include "bu/cachecalc.h"
19 19
20class Bob 20class Bob
@@ -90,7 +90,7 @@ public:
90 writeNum("bobcache/last", cLastId ); 90 writeNum("bobcache/last", cLastId );
91 } 91 }
92 92
93 long readNum( const Bu::FString &sFile ) 93 long readNum( const Bu::String &sFile )
94 { 94 {
95 TRACE( sFile ); 95 TRACE( sFile );
96 Bu::File f( sFile, Bu::File::Read ); 96 Bu::File f( sFile, Bu::File::Read );
@@ -99,13 +99,13 @@ public:
99 return strtol( buf, NULL, 0 ); 99 return strtol( buf, NULL, 0 );
100 } 100 }
101 101
102 void writeNum( const Bu::FString &sFile, long num ) 102 void writeNum( const Bu::String &sFile, long num )
103 { 103 {
104 TRACE( sFile, num ); 104 TRACE( sFile, num );
105 Bu::File f( sFile, 105 Bu::File f( sFile,
106 Bu::File::Write|Bu::File::Create|Bu::File::Truncate 106 Bu::File::Write|Bu::File::Create|Bu::File::Truncate
107 ); 107 );
108 Bu::FString s; 108 Bu::String s;
109 s.format("%d", num ); 109 s.format("%d", num );
110 f.write( s ); 110 f.write( s );
111 } 111 }
@@ -126,7 +126,7 @@ public:
126 virtual Bob *load( const long &key ) 126 virtual Bob *load( const long &key )
127 { 127 {
128 TRACE( key ); 128 TRACE( key );
129 Bu::FString sDest; 129 Bu::String sDest;
130 sDest.format("bobcache/%d", key ); 130 sDest.format("bobcache/%d", key );
131 return new Bob( readNum( sDest ) ); 131 return new Bob( readNum( sDest ) );
132 } 132 }
@@ -134,7 +134,7 @@ public:
134 virtual void unload( Bob *pObj, const long &key ) 134 virtual void unload( Bob *pObj, const long &key )
135 { 135 {
136 TRACE( pObj, key ); 136 TRACE( pObj, key );
137 Bu::FString sDest; 137 Bu::String sDest;
138 sDest.format("bobcache/%d", key ); 138 sDest.format("bobcache/%d", key );
139 writeNum( sDest, pObj->getInt() ); 139 writeNum( sDest, pObj->getInt() );
140 delete pObj; 140 delete pObj;
@@ -144,7 +144,7 @@ public:
144 { 144 {
145 TRACE( rSrc ); 145 TRACE( rSrc );
146 long id = ++cLastId; 146 long id = ++cLastId;
147 Bu::FString sDest; 147 Bu::String sDest;
148 sDest.format("bobcache/%d", id ); 148 sDest.format("bobcache/%d", id );
149 writeNum( sDest, rSrc->getInt() ); 149 writeNum( sDest, rSrc->getInt() );
150 return id; 150 return id;
@@ -153,7 +153,7 @@ public:
153 virtual void destroy( Bob *pObj, const long &key ) 153 virtual void destroy( Bob *pObj, const long &key )
154 { 154 {
155 TRACE( pObj, key ); 155 TRACE( pObj, key );
156 Bu::FString sDest; 156 Bu::String sDest;
157 sDest.format("bobcache/%d", key ); 157 sDest.format("bobcache/%d", key );
158 if( !access( sDest.getStr(), F_OK ) ) 158 if( !access( sDest.getStr(), F_OK ) )
159 unlink( sDest.getStr() ); 159 unlink( sDest.getStr() );
@@ -163,7 +163,7 @@ public:
163 virtual void destroy( const long &key ) 163 virtual void destroy( const long &key )
164 { 164 {
165 TRACE( pObj, key ); 165 TRACE( pObj, key );
166 Bu::FString sDest; 166 Bu::String sDest;
167 sDest.format("bobcache/%d", key ); 167 sDest.format("bobcache/%d", key );
168 if( !access( sDest.getStr(), F_OK ) ) 168 if( !access( sDest.getStr(), F_OK ) )
169 unlink( sDest.getStr() ); 169 unlink( sDest.getStr() );