aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/experimental/blowfish.cpp4
-rw-r--r--src/stable/ringbuffer.h35
-rw-r--r--src/tests/bnfcompile.cpp (renamed from src/tools/bnfcompile.cpp)0
-rw-r--r--src/tests/parser.cpp (renamed from src/tools/parser.cpp)0
4 files changed, 33 insertions, 6 deletions
diff --git a/src/experimental/blowfish.cpp b/src/experimental/blowfish.cpp
index d01ecd3..7ff8a4d 100644
--- a/src/experimental/blowfish.cpp
+++ b/src/experimental/blowfish.cpp
@@ -1,2 +1,6 @@
1#include "bu/blowfish.h" 1#include "bu/blowfish.h"
2 2
3template class Bu::CipherModeEcb<8, Bu::Blowfish<1> >;
4template class Bu::CipherModeCfb<8, Bu::Blowfish<1> >;
5template class Bu::CipherModeCbc<8, Bu::Blowfish<1> >;
6template class Bu::CipherModeOfb<8, Bu::Blowfish<1> >;
diff --git a/src/stable/ringbuffer.h b/src/stable/ringbuffer.h
index d4b5993..79c5a15 100644
--- a/src/stable/ringbuffer.h
+++ b/src/stable/ringbuffer.h
@@ -67,16 +67,15 @@ namespace Bu
67 iStart = 0; 67 iStart = 0;
68 iEnd = 1; 68 iEnd = 1;
69 va.construct( &aData[0], v ); 69 va.construct( &aData[0], v );
70 return;
70 } 71 }
71 else if( iStart == iEnd ) 72 else if( iStart == iEnd )
72 { 73 {
73 throw ExceptionBase("Hey, it's full!"); 74 // The ringbuffer is full
74 } 75 dequeue();
75 else
76 {
77 va.construct( &aData[iEnd], v );
78 iEnd = (iEnd+1)%iCapacity;
79 } 76 }
77 va.construct( &aData[iEnd], v );
78 iEnd = (iEnd+1)%iCapacity;
80 } 79 }
81 80
82 value dequeue() 81 value dequeue()
@@ -104,6 +103,16 @@ namespace Bu
104 return aData[(iIndex+iStart)%iCapacity]; 103 return aData[(iIndex+iStart)%iCapacity];
105 } 104 }
106 105
106 value &first()
107 {
108 return aData[iStart];
109 }
110
111 value &last()
112 {
113 return aData[(iEnd-1+iCapacity)%iCapacity];
114 }
115
107 int getSize() 116 int getSize()
108 { 117 {
109 if( iStart < 0 ) 118 if( iStart < 0 )
@@ -201,6 +210,20 @@ namespace Bu
201 return core->get( 0 ); 210 return core->get( 0 );
202 } 211 }
203 212
213 virtual value &first()
214 {
215 _hardCopy();
216
217 return core->first();
218 }
219
220 virtual value &last()
221 {
222 _hardCopy();
223
224 return core->last();
225 }
226
204 value &operator[]( int iIndex ) 227 value &operator[]( int iIndex )
205 { 228 {
206 _hardCopy(); 229 _hardCopy();
diff --git a/src/tools/bnfcompile.cpp b/src/tests/bnfcompile.cpp
index af7a0eb..af7a0eb 100644
--- a/src/tools/bnfcompile.cpp
+++ b/src/tests/bnfcompile.cpp
diff --git a/src/tools/parser.cpp b/src/tests/parser.cpp
index af53bc8..af53bc8 100644
--- a/src/tools/parser.cpp
+++ b/src/tests/parser.cpp