config-store coding style changes
authorJosh Pelkey <jpelkey@gatech.edu>
Fri, 13 May 2011 14:51:51 -0400
changeset 7168 7c724be8f9a6
parent 7167 d99ebd08a67c
child 7169 358f71a624d8
config-store coding style changes
src/config-store/model/config-store.cc
src/config-store/model/display-functions.cc
src/config-store/model/display-functions.h
src/config-store/model/file-config.cc
src/config-store/model/model-node-creator.cc
src/config-store/model/model-typeid-creator.cc
src/config-store/model/raw-text-config.cc
src/config-store/model/xml-config.cc
--- a/src/config-store/model/config-store.cc	Fri May 13 14:51:27 2011 -0400
+++ b/src/config-store/model/config-store.cc	Fri May 13 14:51:51 2011 -0400
@@ -30,24 +30,24 @@
   static TypeId tid = TypeId ("ns3::ConfigStore")
     .SetParent<ObjectBase> ()
     .AddAttribute ("Mode", 
-		   "Configuration mode",
-		   EnumValue (ConfigStore::NONE),
-		   MakeEnumAccessor (&ConfigStore::SetMode),
-		   MakeEnumChecker (ConfigStore::NONE, "None",
-				    ConfigStore::LOAD, "Load",
-				    ConfigStore::SAVE, "Save"))
+                   "Configuration mode",
+                   EnumValue (ConfigStore::NONE),
+                   MakeEnumAccessor (&ConfigStore::SetMode),
+                   MakeEnumChecker (ConfigStore::NONE, "None",
+                                    ConfigStore::LOAD, "Load",
+                                    ConfigStore::SAVE, "Save"))
     .AddAttribute ("Filename", 
-		   "The file where the configuration should be saved to or loaded from.",
-		   StringValue (""),
-		   MakeStringAccessor (&ConfigStore::SetFilename),
-		   MakeStringChecker ())
+                   "The file where the configuration should be saved to or loaded from.",
+                   StringValue (""),
+                   MakeStringAccessor (&ConfigStore::SetFilename),
+                   MakeStringChecker ())
     .AddAttribute ("FileFormat",
-		   "Type of file format",
-		   EnumValue (ConfigStore::RAW_TEXT),
-		   MakeEnumAccessor (&ConfigStore::SetFileFormat),
-		   MakeEnumChecker (ConfigStore::RAW_TEXT, "RawText",
-				    ConfigStore::XML, "Xml"))
-    ;
+                   "Type of file format",
+                   EnumValue (ConfigStore::RAW_TEXT),
+                   MakeEnumAccessor (&ConfigStore::SetFileFormat),
+                   MakeEnumChecker (ConfigStore::RAW_TEXT, "RawText",
+                                    ConfigStore::XML, "Xml"))
+  ;
   return tid;
 }
 TypeId 
@@ -65,34 +65,34 @@
   if (m_fileFormat == ConfigStore::XML)
     {
       if (m_mode == ConfigStore::SAVE)
-	{
-	  m_file = new XmlConfigSave ();
-	}
+        {
+          m_file = new XmlConfigSave ();
+        }
       else if (m_mode == ConfigStore::LOAD)
-	{
-	  m_file = new XmlConfigLoad ();
-	}
+        {
+          m_file = new XmlConfigLoad ();
+        }
       else 
-	{
-	  m_file = new NoneFileConfig ();
-	}
+        {
+          m_file = new NoneFileConfig ();
+        }
     }
   else 
 #endif /* HAVE_LIBXML2 */
   if (m_fileFormat == ConfigStore::RAW_TEXT)
     {
       if (m_mode == ConfigStore::SAVE)
-	{
-	  m_file = new RawTextConfigSave ();
-	}
+        {
+          m_file = new RawTextConfigSave ();
+        }
       else if (m_mode == ConfigStore::LOAD)
-	{
-	  m_file = new RawTextConfigLoad ();
-	}
+        {
+          m_file = new RawTextConfigLoad ();
+        }
       else
-	{
-	  m_file = new NoneFileConfig ();
-	}
+        {
+          m_file = new NoneFileConfig ();
+        }
     }
   m_file->SetFilename (m_filename);
 }
--- a/src/config-store/model/display-functions.cc	Fri May 13 14:51:27 2011 -0400
+++ b/src/config-store/model/display-functions.cc	Fri May 13 14:51:51 2011 -0400
@@ -590,5 +590,5 @@
 }
 
 
-}//end ns3 namespace
+} //end ns3 namespace
 
--- a/src/config-store/model/display-functions.h	Fri May 13 14:51:27 2011 -0400
+++ b/src/config-store/model/display-functions.h	Fri May 13 14:51:51 2011 -0400
@@ -145,6 +145,6 @@
 gboolean
 clean_model_callback_config_default (GtkTreeModel *model, GtkTreePath *path,
                                      GtkTreeIter *iter, gpointer data);
-}//end namespace ns3
+} //end namespace ns3
 
 #endif
--- a/src/config-store/model/file-config.cc	Fri May 13 14:51:27 2011 -0400
+++ b/src/config-store/model/file-config.cc	Fri May 13 14:51:51 2011 -0400
@@ -3,12 +3,15 @@
 namespace ns3 {
 
 FileConfig::~FileConfig ()
-{}
+{
+}
 
 NoneFileConfig::NoneFileConfig ()
-{}
+{
+}
 NoneFileConfig::~NoneFileConfig ()
-{}
+{
+}
 void 
 NoneFileConfig::SetFilename (std::string filename)
 {}
@@ -18,7 +21,7 @@
 void 
 NoneFileConfig::Global (void)
 {}
-void 
+void
 NoneFileConfig::Attributes (void)
 {}
 
--- a/src/config-store/model/model-node-creator.cc	Fri May 13 14:51:27 2011 -0400
+++ b/src/config-store/model/model-node-creator.cc	Fri May 13 14:51:51 2011 -0400
@@ -116,8 +116,8 @@
   node->index = index;
   gtk_tree_store_append (m_treestore, current, parent);
   gtk_tree_store_set (m_treestore, current,
-              COL_NODE, node,
-                     -1);
+                      COL_NODE, node,
+                      -1);
   m_iters.push_back (current);
 }
 void 
@@ -125,6 +125,6 @@
 {
   GtkTreeIter *iter = m_iters.back ();
   g_free (iter);
-  m_iters.pop_back ();  
+  m_iters.pop_back ();
 }
-}//end namespace ns3
+} //end namespace ns3
--- a/src/config-store/model/model-typeid-creator.cc	Fri May 13 14:51:27 2011 -0400
+++ b/src/config-store/model/model-typeid-creator.cc	Fri May 13 14:51:51 2011 -0400
@@ -78,4 +78,4 @@
 {
   Remove ();
 }
-}//end namespace ns3
+} //end namespace ns3
--- a/src/config-store/model/raw-text-config.cc	Fri May 13 14:51:27 2011 -0400
+++ b/src/config-store/model/raw-text-config.cc	Fri May 13 14:51:51 2011 -0400
@@ -12,7 +12,8 @@
 
 RawTextConfigSave::RawTextConfigSave ()
   : m_os (0)
-{}
+{
+}
 RawTextConfigSave::~RawTextConfigSave ()
 {
   if (m_os != 0)
@@ -33,11 +34,11 @@
 {
   class RawTextDefaultIterator : public AttributeDefaultIterator
   {
-  public:
+public:
     RawTextDefaultIterator (std::ostream *os) {
       m_os = os;
     }
-  private:
+private:
     virtual void StartVisitTypeId (std::string name) {
       m_typeId = name;
     }
@@ -66,10 +67,10 @@
 {
   class RawTextAttributeIterator : public AttributeIterator
   {
-  public:
+public:
     RawTextAttributeIterator (std::ostream *os)
       : m_os (os) {}
-  private:
+private:
     virtual void DoVisitAttribute (Ptr<Object> object, std::string name) {
       StringValue str;
       object->GetAttribute (name, str);
@@ -84,7 +85,8 @@
 
 RawTextConfigLoad::RawTextConfigLoad ()
   : m_is (0)
-{}
+{
+}
 RawTextConfigLoad::~RawTextConfigLoad ()
 {
   if (m_is != 0)
@@ -121,9 +123,9 @@
       NS_LOG_DEBUG ("type=" << type << ", name=" << name << ", value=" << value);
       value = Strip (value);
       if (type == "default")
-	{
-	  Config::SetDefault (name, StringValue (value));
-	}
+        {
+          Config::SetDefault (name, StringValue (value));
+        }
       *m_is >> type >> name >> value;
     }
 }
@@ -138,9 +140,9 @@
       NS_LOG_DEBUG ("type=" << type << ", name=" << name << ", value=" << value);
       value = Strip (value);
       if (type == "global")
-	{
-	  Config::SetGlobal (name, StringValue (value));
-	}
+        {
+          Config::SetGlobal (name, StringValue (value));
+        }
       *m_is >> type >> name >> value;
     }
 }
@@ -155,9 +157,9 @@
       NS_LOG_DEBUG ("type=" << type << ", path=" << path << ", value=" << value);
       value = Strip (value);
       if (type == "value")
-	{
-	  Config::Set (path, StringValue (value));
-	}
+        {
+          Config::Set (path, StringValue (value));
+        }
       *m_is >> type >> path >> value;
     }
 }
--- a/src/config-store/model/xml-config.cc	Fri May 13 14:51:27 2011 -0400
+++ b/src/config-store/model/xml-config.cc	Fri May 13 14:51:51 2011 -0400
@@ -82,39 +82,39 @@
 {
   class XmlDefaultIterator : public AttributeDefaultIterator
   {
-  public:
+public:
     XmlDefaultIterator (xmlTextWriterPtr writer) {
       m_writer = writer;
     }
-  private:
+private:
     virtual void StartVisitTypeId (std::string name) {
       m_typeid = name;
     }
     virtual void DoVisitAttribute (std::string name, std::string defaultValue) {
       int rc;
       rc = xmlTextWriterStartElement(m_writer, BAD_CAST "default");
-       if (rc < 0) 
-	 {
-	   NS_FATAL_ERROR ("Error at xmlTextWriterStartElement");
-	 }
-       std::string fullname = m_typeid + "::" + name;
-       rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "name",
-					BAD_CAST fullname.c_str ());
-       if (rc < 0) 
-	 {
-	   NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
-	 }
-       rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "value",
-					BAD_CAST defaultValue.c_str ());
-       if (rc < 0) 
-	 {
-	   NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
-	 }
+      if (rc < 0)
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterStartElement");
+        }
+      std::string fullname = m_typeid + "::" + name;
+      rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "name",
+                                       BAD_CAST fullname.c_str ());
+      if (rc < 0)
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
+        }
+      rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "value",
+                                       BAD_CAST defaultValue.c_str ());
+      if (rc < 0)
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
+        }
       rc = xmlTextWriterEndElement(m_writer);
       if (rc < 0) 
-	{
-	  NS_FATAL_ERROR ("Error at xmlTextWriterEndElement");
-	}
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterEndElement");
+        }
     }
     xmlTextWriterPtr m_writer;
     std::string m_typeid;
@@ -128,36 +128,36 @@
 {
   class XmlTextAttributeIterator : public AttributeIterator
   {
-  public:
+public:
     XmlTextAttributeIterator (xmlTextWriterPtr writer)
       : m_writer (writer) {}
-  private:
+private:
     virtual void DoVisitAttribute (Ptr<Object> object, std::string name) {
       StringValue str;
       object->GetAttribute (name, str);
       int rc;
       rc = xmlTextWriterStartElement(m_writer, BAD_CAST "value");
       if (rc < 0) 
-	{
-	  NS_FATAL_ERROR ("Error at xmlTextWriterStartElement");
-	}
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterStartElement");
+        }
       rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "path",
-				       BAD_CAST GetCurrentPath ().c_str ());
+                                       BAD_CAST GetCurrentPath ().c_str ());
       if (rc < 0) 
-	{
-	  NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
-	}
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
+        }
       rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "value",
-				       BAD_CAST str.Get ().c_str ());
+                                       BAD_CAST str.Get ().c_str ());
       if (rc < 0) 
-	{
-	  NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
-	}
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
+        }
       rc = xmlTextWriterEndElement(m_writer);
       if (rc < 0) 
-	{
-	  NS_FATAL_ERROR ("Error at xmlTextWriterEndElement");
-	}
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterEndElement");
+        }
     }
     xmlTextWriterPtr m_writer;
   };
@@ -176,27 +176,27 @@
       (*i)->GetValue (value);
 
       rc = xmlTextWriterStartElement(m_writer, BAD_CAST "global");
-       if (rc < 0) 
-	 {
-	   NS_FATAL_ERROR ("Error at xmlTextWriterStartElement");
-	 }
-       rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "name",
-					BAD_CAST (*i)->GetName ().c_str ());
-       if (rc < 0) 
-	 {
-	   NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
-	 }
-       rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "value",
-					BAD_CAST value.Get ().c_str ());
-       if (rc < 0) 
-	 {
-	   NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
-	 }
+      if (rc < 0)
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterStartElement");
+        }
+      rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "name",
+                                       BAD_CAST (*i)->GetName ().c_str ());
+      if (rc < 0)
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
+        }
+      rc = xmlTextWriterWriteAttribute(m_writer, BAD_CAST "value",
+                                       BAD_CAST value.Get ().c_str ());
+      if (rc < 0)
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterWriteAttribute");
+        }
       rc = xmlTextWriterEndElement(m_writer);
-       if (rc < 0) 
-	 {
-	   NS_FATAL_ERROR ("Error at xmlTextWriterEndElement");
-	 }
+      if (rc < 0)
+        {
+          NS_FATAL_ERROR ("Error at xmlTextWriterEndElement");
+        }
     }
 }
 
@@ -229,26 +229,26 @@
     {
       const xmlChar *type = xmlTextReaderConstName(reader);
       if (type == 0)
-	{
-	  NS_FATAL_ERROR ("Invalid value");
-	}
+        {
+          NS_FATAL_ERROR ("Invalid value");
+        }
       if (std::string ((char*)type) == "default")
-	{
-	  xmlChar *name = xmlTextReaderGetAttribute (reader, BAD_CAST "name");
-	  if (name == 0)
-	    {
-	      NS_FATAL_ERROR ("Error getting attribute 'name'");
-	    }
-	  xmlChar *value = xmlTextReaderGetAttribute (reader, BAD_CAST "value");
-	  if (value == 0)
-	    {
-	      NS_FATAL_ERROR ("Error getting attribute 'value'");
-	    }
-	  NS_LOG_DEBUG ("default="<<(char*)name<<", value=" <<value);
-	  Config::SetDefault ((char*)name, StringValue ((char*)value));
-	  xmlFree (name);
-	  xmlFree (value);
-	}
+        {
+          xmlChar *name = xmlTextReaderGetAttribute (reader, BAD_CAST "name");
+          if (name == 0)
+            {
+              NS_FATAL_ERROR ("Error getting attribute 'name'");
+            }
+          xmlChar *value = xmlTextReaderGetAttribute (reader, BAD_CAST "value");
+          if (value == 0)
+            {
+              NS_FATAL_ERROR ("Error getting attribute 'value'");
+            }
+          NS_LOG_DEBUG ("default="<<(char*)name<<", value=" <<value);
+          Config::SetDefault ((char*)name, StringValue ((char*)value));
+          xmlFree (name);
+          xmlFree (value);
+        }
       rc = xmlTextReaderRead (reader);
     }
   xmlFreeTextReader (reader);
@@ -267,26 +267,26 @@
     {
       const xmlChar *type = xmlTextReaderConstName(reader);
       if (type == 0)
-	{
-	  NS_FATAL_ERROR ("Invalid value");
-	}
+        {
+          NS_FATAL_ERROR ("Invalid value");
+        }
       if (std::string ((char*)type) == "global")
-	{
-	  xmlChar *name = xmlTextReaderGetAttribute (reader, BAD_CAST "name");
-	  if (name == 0)
-	    {
-	      NS_FATAL_ERROR ("Error getting attribute 'name'");
-	    }
-	  xmlChar *value = xmlTextReaderGetAttribute (reader, BAD_CAST "value");
-	  if (value == 0)
-	    {
-	      NS_FATAL_ERROR ("Error getting attribute 'value'");
-	    }
-	  NS_LOG_DEBUG ("global="<<(char*)name<<", value=" <<value);
-	  Config::SetGlobal ((char*)name, StringValue ((char*)value));
-	  xmlFree (name);
-	  xmlFree (value);
-	}
+        {
+          xmlChar *name = xmlTextReaderGetAttribute (reader, BAD_CAST "name");
+          if (name == 0)
+            {
+              NS_FATAL_ERROR ("Error getting attribute 'name'");
+            }
+          xmlChar *value = xmlTextReaderGetAttribute (reader, BAD_CAST "value");
+          if (value == 0)
+            {
+              NS_FATAL_ERROR ("Error getting attribute 'value'");
+            }
+          NS_LOG_DEBUG ("global="<<(char*)name<<", value=" <<value);
+          Config::SetGlobal ((char*)name, StringValue ((char*)value));
+          xmlFree (name);
+          xmlFree (value);
+        }
       rc = xmlTextReaderRead (reader);
     }
   xmlFreeTextReader (reader);
@@ -305,26 +305,26 @@
     {
       const xmlChar *type = xmlTextReaderConstName(reader);
       if (type == 0)
-	{
-	  NS_FATAL_ERROR ("Invalid value");
-	}
+        {
+          NS_FATAL_ERROR ("Invalid value");
+        }
       if (std::string ((char*)type) == "value")
-	{
-	  xmlChar *path = xmlTextReaderGetAttribute (reader, BAD_CAST "path");
-	  if (path == 0)
-	    {
-	      NS_FATAL_ERROR ("Error getting attribute 'path'");
-	    }
-	  xmlChar *value = xmlTextReaderGetAttribute (reader, BAD_CAST "value");
-	  if (value == 0)
-	    {
-	      NS_FATAL_ERROR ("Error getting attribute 'value'");
-	    }
-	  NS_LOG_DEBUG ("path="<<(char*)path << ", value=" << (char*)value);
-	  Config::Set ((char*)path, StringValue ((char*)value));
-	  xmlFree (path);
-	  xmlFree (value);
-	}
+        {
+          xmlChar *path = xmlTextReaderGetAttribute (reader, BAD_CAST "path");
+          if (path == 0)
+            {
+              NS_FATAL_ERROR ("Error getting attribute 'path'");
+            }
+          xmlChar *value = xmlTextReaderGetAttribute (reader, BAD_CAST "value");
+          if (value == 0)
+            {
+              NS_FATAL_ERROR ("Error getting attribute 'value'");
+            }
+          NS_LOG_DEBUG ("path="<<(char*)path << ", value=" << (char*)value);
+          Config::Set ((char*)path, StringValue ((char*)value));
+          xmlFree (path);
+          xmlFree (value);
+        }
       rc = xmlTextReaderRead (reader);
     }
   xmlFreeTextReader (reader);