aboutsummaryrefslogtreecommitdiff
path: root/c++-libbu++/src/object.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c++-libbu++/src/object.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/c++-libbu++/src/object.cpp b/c++-libbu++/src/object.cpp
index 61471b9..7cd50e6 100644
--- a/c++-libbu++/src/object.cpp
+++ b/c++-libbu++/src/object.cpp
@@ -15,10 +15,14 @@
15#include "gats/dictionary.h" 15#include "gats/dictionary.h"
16#include "gats/null.h" 16#include "gats/null.h"
17 17
18#include "gats/gatsstream.h"
19
18#include <stdlib.h> 20#include <stdlib.h>
19 21
20#include <bu/formatter.h> 22#include <bu/formatter.h>
21#include <bu/stream.h> 23#include <bu/stream.h>
24#include <bu/membuf.h>
25#include <bu/staticmembuf.h>
22 26
23#include <bu/sio.h> 27#include <bu/sio.h>
24using namespace Bu; 28using namespace Bu;
@@ -31,6 +35,21 @@ Gats::Object::~Object()
31{ 35{
32} 36}
33 37
38Bu::String Gats::Object::toPacket()
39{
40 Bu::MemBuf mbOut;
41 Gats::GatsStream gsOut( mbOut );
42 gsOut.writeObject( this );
43 return mbOut.getString();
44}
45
46Gats::Object *Gats::Object::fromPacket( const Bu::String &sData )
47{
48 Bu::StaticMemBuf mbIn( sData.getStr(), sData.getSize() );
49 Gats::GatsStream gsIn( mbIn );
50 return gsIn.readObject();
51}
52
34Gats::Object *Gats::Object::read( Bu::Stream &rIn ) 53Gats::Object *Gats::Object::read( Bu::Stream &rIn )
35{ 54{
36 char buf; 55 char buf;