]> git.tdb.fi Git - libs/net.git/blobdiff - source/protocol.h
Style update: spaces around assignments
[libs/net.git] / source / protocol.h
index 8ae5cdd149170c0bfdc0e5dcf3342e226ff27946..4bde291ea5c263ce519ea4cac690a6120758fc92 100644 (file)
@@ -20,9 +20,9 @@ private:
                PacketDefBase(unsigned i): id(i) { }
        public:
                virtual ~PacketDefBase() { }
-               virtual unsigned get_class_id() const =0;
+               virtual unsigned get_class_id() const = 0;
                unsigned get_id() const { return id; }
-               virtual const char *disassemble(ReceiverBase &, const char *, const char *) const =0;
+               virtual const char *disassemble(ReceiverBase &, const char *, const char *) const = 0;
 
                static unsigned next_class_id;
        };
@@ -34,8 +34,8 @@ private:
                FieldBase() { }
        public:
                virtual ~FieldBase() { }
-               virtual char *assemble(const P &, char *, char *) const =0;
-               virtual const char *disassemble(P &, const char *, const char *) const =0;
+               virtual char *assemble(const P &, char *, char *) const = 0;
+               virtual const char *disassemble(P &, const char *, const char *) const = 0;
        };
 
        template<typename P, typename T>
@@ -63,7 +63,7 @@ protected:
 
        public:
                PacketDef(unsigned i): PacketDefBase(i)
-               { if(!class_id) class_id=next_class_id++; }
+               { if(!class_id) class_id = next_class_id++; }
 
                ~PacketDef()
                {
@@ -80,18 +80,18 @@ protected:
                char *assemble(const P &p, char *d, char *e) const
                {
                        for(typename std::vector<FieldBase<P> *>::const_iterator i=fields.begin(); i!=fields.end(); ++i)
-                               d=(*i)->assemble(p, d, e);
+                               d = (*i)->assemble(p, d, e);
                        return d;
                }
 
                const char *disassemble(ReceiverBase &r, const char *d, const char *e) const
                {
-                       PacketReceiver<P> *prcv=dynamic_cast<PacketReceiver<P> *>(&r);
+                       PacketReceiver<P> *prcv = dynamic_cast<PacketReceiver<P> *>(&r);
                        if(!prcv)
                                throw Exception("Packet type not supported by receiver");
                        P pkt;
                        for(typename std::vector<FieldBase<P> *>::const_iterator i=fields.begin(); i!=fields.end(); ++i)
-                               d=(*i)->disassemble(pkt, d, e);
+                               d = (*i)->disassemble(pkt, d, e);
                        prcv->receive(pkt);
                        return d;
                }
@@ -105,7 +105,7 @@ protected:
        PacketMap packet_class_defs;
        PacketMap packet_id_defs;
 
-       Protocol(unsigned =1);
+       Protocol(unsigned = 1);
 public:
        ~Protocol();
 
@@ -116,7 +116,7 @@ protected:
        template<typename P>
        PacketDef<P> &add()
        {
-               PacketDef<P> *pdef=new PacketDef<P>(next_packet_id++);
+               PacketDef<P> *pdef = new PacketDef<P>(next_packet_id++);
                add_packet(*pdef);
                return *pdef;
        }
@@ -128,10 +128,10 @@ public:
        template<typename P>
        unsigned assemble(const P &pkt, char *buf, unsigned size) const
        {
-               unsigned id=PacketDef<P>::class_id;
-               const PacketDef<P> &pdef=static_cast<const PacketDef<P> &>(get_packet_by_class(id));
-               char *ptr=pdef.assemble(pkt, buf+4, buf+size);
-               assemble_header(buf, pdef.get_id(), (size=ptr-buf));
+               unsigned id = PacketDef<P>::class_id;
+               const PacketDef<P> &pdef = static_cast<const PacketDef<P> &>(get_packet_by_class(id));
+               char *ptr = pdef.assemble(pkt, buf+4, buf+size);
+               assemble_header(buf, pdef.get_id(), (size = ptr-buf));
                return size;
        }
 
@@ -152,7 +152,7 @@ private:
 };
 
 template<typename P>
-unsigned Protocol::PacketDef<P>::class_id=0;
+unsigned Protocol::PacketDef<P>::class_id = 0;
 
 } // namespace Net
 } // namespace Msp