aboutsummaryrefslogtreecommitdiff
path: root/src/newline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newline.cpp')
-rw-r--r--src/newline.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/newline.cpp b/src/newline.cpp
new file mode 100644
index 0000000..0dbbae5
--- /dev/null
+++ b/src/newline.cpp
@@ -0,0 +1,56 @@
1#include "bu/newline.h"
2
3Bu::NewLine::NewLine( Bu::Stream &rNext ) :
4 Bu::Filter( rNext ),
5 bExChar( false )
6{
7}
8
9Bu::NewLine::~NewLine()
10{
11}
12
13void Bu::NewLine::start()
14{
15}
16
17size_t Bu::NewLine::stop()
18{
19 return 0;
20}
21
22size_t Bu::NewLine::read( void *pBuf, size_t iAmnt )
23{
24 size_t iRead = rNext.read( pBuf, iAmnt );
25 size_t iOffset = 0;
26
27 for( size_t i = 0; i < iRead; i++ )
28 {
29 if( pBuf[i] == '\r' )
30 {
31 pBuf[i+iOffset] = '\n';
32 if( pBuf[j+1] == '\n' )
33 {
34 iOffset--;
35 }
36 }
37 else if( pBuf[i] == '\n' )
38 {
39 if( pBuf[j+1] == '\r' )
40 {
41 iOffset--;
42 }
43 }
44 else if( iOffset )
45 {
46 pBuf[i+iOffset] = pBuf[i];
47 }
48 }
49
50 iRead += iOffset;
51}
52
53size_t Bu::NewLine::write( const void *pBuf, size_t iAmnt )
54{
55}
56