aboutsummaryrefslogtreecommitdiff
path: root/c++-libbu++/src/boolean.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++-libbu++/src/boolean.cpp')
-rw-r--r--c++-libbu++/src/boolean.cpp47
1 files changed, 27 insertions, 20 deletions
diff --git a/c++-libbu++/src/boolean.cpp b/c++-libbu++/src/boolean.cpp
index 729e644..7060dab 100644
--- a/c++-libbu++/src/boolean.cpp
+++ b/c++-libbu++/src/boolean.cpp
@@ -1,15 +1,22 @@
1/*
2 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libgats library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#include "gats/boolean.h" 8#include "gats/boolean.h"
2 9
3#include <bu/formatter.h> 10#include <bu/formatter.h>
4#include <bu/stream.h> 11#include <bu/stream.h>
5 12
6Gats::Boolean::Boolean() : 13Gats::Boolean::Boolean() :
7 bVal( false ) 14 bVal( false )
8{ 15{
9} 16}
10 17
11Gats::Boolean::Boolean( bool bVal ) : 18Gats::Boolean::Boolean( bool bVal ) :
12 bVal( bVal ) 19 bVal( bVal )
13{ 20{
14} 21}
15 22
@@ -19,35 +26,35 @@ Gats::Boolean::~Boolean()
19 26
20Gats::Object *Gats::Boolean::clone() const 27Gats::Object *Gats::Boolean::clone() const
21{ 28{
22 return new Gats::Boolean( bVal ); 29 return new Gats::Boolean( bVal );
23} 30}
24 31
25void Gats::Boolean::write( Bu::Stream &rOut ) const 32void Gats::Boolean::write( Bu::Stream &rOut ) const
26{ 33{
27 if( bVal ) 34 if( bVal )
28 { 35 {
29 rOut.write("1", 1 ); 36 rOut.write("1", 1 );
30 } 37 }
31 else 38 else
32 { 39 {
33 rOut.write("0", 1 ); 40 rOut.write("0", 1 );
34 } 41 }
35} 42}
36 43
37void Gats::Boolean::read( Bu::Stream &rIn, char cType ) 44void Gats::Boolean::read( Bu::Stream &rIn, char cType )
38{ 45{
39 if( cType == '1' ) 46 if( cType == '1' )
40 { 47 {
41 bVal = true; 48 bVal = true;
42 } 49 }
43 else 50 else
44 { 51 {
45 bVal = false; 52 bVal = false;
46 } 53 }
47} 54}
48 55
49Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Boolean &b ) 56Bu::Formatter &operator<<( Bu::Formatter &f, const Gats::Boolean &b )
50{ 57{
51 return f << "(bool) " << b.getValue(); 58 return f << "(bool) " << b.getValue();
52} 59}
53 60