[svn] commit: r189 - in /experiments/jelte-configuration: data.cc data.h test.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Oct 29 22:15:48 UTC 2009


Author: mgraff
Date: Thu Oct 29 22:15:48 2009
New Revision: 189

Log:
refactor a bit

Modified:
    experiments/jelte-configuration/data.cc
    experiments/jelte-configuration/data.h
    experiments/jelte-configuration/test.cc

Modified: experiments/jelte-configuration/data.cc
==============================================================================
--- experiments/jelte-configuration/data.cc (original)
+++ experiments/jelte-configuration/data.cc Thu Oct 29 22:15:48 2009
@@ -747,7 +747,7 @@
     v = list_value();
     for (std::vector<ElementPtr>::iterator it = v.begin() ;
          it != v.end() ; ++it) {
-        ss << (*it)->to_wire();
+        ss << (*it)->to_wire(0);
     }
 
     if (omit_length) {
@@ -790,7 +790,7 @@
     for (std::map<std::string, ElementPtr>::iterator it = m.begin() ;
          it != m.end() ; ++it) {
         ss << encode_tag((*it).first);
-        ss << (*it).second->to_wire();
+        ss << (*it).second->to_wire(0);
     }
 
     //

Modified: experiments/jelte-configuration/data.h
==============================================================================
--- experiments/jelte-configuration/data.h (original)
+++ experiments/jelte-configuration/data.h Thu Oct 29 22:15:48 2009
@@ -52,7 +52,7 @@
         // pure virtuals, every derived class must implement these
         virtual std::string str() = 0;
         virtual std::string str_xml(size_t prefix = 0) = 0;
-        virtual std::string to_wire(int omit_length = 0) = 0;
+        virtual std::string to_wire(int omit_length = 1) = 0;
 
         // virtual function templates must match, so we
         // need separate getters for all subclassed types
@@ -144,7 +144,7 @@
         bool set_value(const int v) { i = v; return true; };
         std::string str();
         std::string str_xml(size_t prefix = 0);
-        std::string to_wire(int omit_length = 0);
+        std::string to_wire(int omit_length = 1);
     };
 
     class DoubleElement : public Element {
@@ -157,7 +157,7 @@
         bool set_value(const double v) { d = v; return true; };
         std::string str();
         std::string str_xml(size_t prefix = 0);
-        std::string to_wire(int omit_length = 0);
+        std::string to_wire(int omit_length = 1);
     };
 
     class BoolElement : public Element {
@@ -170,7 +170,7 @@
         bool set_value(const bool v) { b = v; return true; };
         std::string str();
         std::string str_xml(size_t prefix = 0);
-        std::string to_wire(int omit_length = 0);
+        std::string to_wire(int omit_length = 1);
     };
 	
     class StringElement : public Element {
@@ -183,7 +183,7 @@
         bool set_value(const std::string& v) { s = v; return true; };
         std::string str();
         std::string str_xml(size_t prefix = 0);
-        std::string to_wire(int omit_length = 0);
+        std::string to_wire(int omit_length = 1);
     };
 
     class ListElement : public Element {
@@ -199,7 +199,7 @@
         void add(ElementPtr e) { l.push_back(e); };
         std::string str();
         std::string str_xml(size_t prefix = 0);
-        std::string to_wire(int omit_length = 0);
+        std::string to_wire(int omit_length = 1);
     };
 
     class MapElement : public Element {
@@ -214,8 +214,7 @@
         void set(const std::string& s, ElementPtr p) { m[s] = p; };
         std::string str();
         std::string str_xml(size_t prefix = 0);
-
-        std::string to_wire(int omit_length = 0);
+        std::string to_wire(int omit_length = 1);
         
         //
         // Encode into the CC wire format.

Modified: experiments/jelte-configuration/test.cc
==============================================================================
--- experiments/jelte-configuration/test.cc (original)
+++ experiments/jelte-configuration/test.cc Thu Oct 29 22:15:48 2009
@@ -105,7 +105,7 @@
     in_ss_skan.str(s_skan);
     ElementPtr e_skan = Element::create_from_string(in_ss_skan);
     std::stringstream ss_skan;
-    ss_skan << e_skan->to_wire(1);
+    ss_skan << e_skan->to_wire();
     hexdump(std::string(ss_skan.str()));
 
     ElementPtr decoded = Element::from_wire(ss_skan, ss_skan.str().length());




More information about the bind10-changes mailing list