aboutsummaryrefslogtreecommitdiff
path: root/src/cache.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-05-28 16:23:38 +0000
committerMike Buland <eichlan@xagasoft.com>2009-05-28 16:23:38 +0000
commit22914644fb62bc1a9d49eec50a10f2870dde1d0b (patch)
treeec7e69e4efddd3602d59444706a49e389ab01a45 /src/cache.h
parent98e1848ebf1024f28e82ee39cc6a81bd2b14d4fa (diff)
downloadlibbu++-22914644fb62bc1a9d49eec50a10f2870dde1d0b.tar.gz
libbu++-22914644fb62bc1a9d49eec50a10f2870dde1d0b.tar.bz2
libbu++-22914644fb62bc1a9d49eec50a10f2870dde1d0b.tar.xz
libbu++-22914644fb62bc1a9d49eec50a10f2870dde1d0b.zip
Added some helpers to the Bu::Cache::Ptr, you can clear them now, and cast to
bool to see if they're bound, you still have to use isValid to see if they're valid or not. Also, fixed a bug in libbu++ that's been around for a while, apparently, in the Bu::Socket code. Non-blocking reading wasn't working correctly, when data wasn't waiting on the line, it would return immediately with zero bytes read. That was sure stupid. This should fix a lot of things.
Diffstat (limited to 'src/cache.h')
-rw-r--r--src/cache.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cache.h b/src/cache.h
index 97ed140..c4e1b0b 100644
--- a/src/cache.h
+++ b/src/cache.h
@@ -100,6 +100,11 @@ namespace Bu
100 return pData != NULL; 100 return pData != NULL;
101 } 101 }
102 102
103 operator bool() const
104 {
105 return isBound() && isValid();
106 }
107
103 const keytype &getKey() const 108 const keytype &getKey() const
104 { 109 {
105 return kId; 110 return kId;
@@ -112,6 +117,17 @@ namespace Bu
112 pData = NULL; 117 pData = NULL;
113 } 118 }
114 119
120 void clear()
121 {
122 unbind();
123 pCache = NULL;
124 }
125
126 void unset()
127 {
128 clear();
129 }
130
115 Ptr &operator=( const Ptr &rRhs ) 131 Ptr &operator=( const Ptr &rRhs )
116 { 132 {
117 if( pCache && pData ) 133 if( pCache && pData )