diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-05-03 06:30:36 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-05-03 06:30:36 +0000 |
commit | df6a899ad6c9a1c792582ef1a3b838c7eb6d330c (patch) | |
tree | ff9e17d0fd00585bc1e329a63c20f90d155b4ea8 /src | |
parent | 343bffafecd4329ce5ae6625fc6b2c1ea9759f36 (diff) | |
download | libbu++-df6a899ad6c9a1c792582ef1a3b838c7eb6d330c.tar.gz libbu++-df6a899ad6c9a1c792582ef1a3b838c7eb6d330c.tar.bz2 libbu++-df6a899ad6c9a1c792582ef1a3b838c7eb6d330c.tar.xz libbu++-df6a899ad6c9a1c792582ef1a3b838c7eb6d330c.zip |
Rearranging some stuff.
Diffstat (limited to 'src')
-rw-r--r-- | src/experimental/blowfish.cpp | 4 | ||||
-rw-r--r-- | src/stable/ringbuffer.h | 35 | ||||
-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 | ||
3 | template class Bu::CipherModeEcb<8, Bu::Blowfish<1> >; | ||
4 | template class Bu::CipherModeCfb<8, Bu::Blowfish<1> >; | ||
5 | template class Bu::CipherModeCbc<8, Bu::Blowfish<1> >; | ||
6 | template 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 | |||