[Bug 2022] Spurious characters in config paths
authorPeter D. Barnes, Jr. <barnes26@llnl.gov>
Wed, 03 Dec 2014 15:27:46 -0800
changeset 11080 5a41f780e361
parent 11079 fde91036410a
child 11081 6c49e5d27afb
[Bug 2022] Spurious characters in config paths On Nov 24, 2014, at 12:48 PM, Tom Henderson <tomh@tomh.org> wrote: > On 11/24/2014 12:39 PM, Peter Barnes wrote: >> I see the '%' being use in two places, beginning at line 1156 in >> StaticInformation::DoGather () >> >> Mitch used the % to escape the class names so doxygen wouldn't >> create links. I'm not sure why the links are bad. Is the config >> path token with '::' sometimes not the same as a class name? >> Then doxygen would be looking for a non-existent class and >> complaining, so suppressing might be good. >> >> Looks like I might have added the surrounding '"' in r10977. >> Could this be the problem? > > Not sure. Let me know if you don't get to this before you > disappear for a while, and I'll pick it up if so. Removing the quotes fixes the problem. Removing the '%' (and leaving the quotes) fixes the problem. This is my preferred solution, since it's a reminder that the config path is just a string. So my recommendation is to remove the temporaryCharacter formatting string completely.
utils/print-introspected-doxygen.cc
--- a/utils/print-introspected-doxygen.cc	Sat Nov 29 10:13:25 2014 -0800
+++ b/utils/print-introspected-doxygen.cc	Wed Dec 03 15:27:46 2014 -0800
@@ -71,7 +71,6 @@
   std::string sectionStart;        ///< start of a section or group
   std::string seeAlso;             ///< Reference to other docs
   std::string subSectionStart;     ///< start a new subsection
-  std::string temporaryCharacter;  ///< "%" placeholder
   std::string variable;            ///< variable or class member
 
 } // anonymous namespace
@@ -119,7 +118,6 @@
       sectionStart                 = "Section ";
       seeAlso                      = "  See: ";
       subSectionStart              = "Subsection ";
-      temporaryCharacter           = "";
       variable                     = "Variable: ";
     }
   else
@@ -155,7 +153,6 @@
       sectionStart                 = "\\ingroup ";
       seeAlso                      = "\\see ";
       subSectionStart              = "\\addtogroup ";
-      temporaryCharacter           = "%";
       variable                     = "\\var ";
     }
 }  // SetMarkup ()
@@ -988,14 +985,6 @@
    */
   bool HasAlreadyBeenProcessed (TypeId tid) const;
   /**
-   * (Inplace) find and replace all instances of string
-   *
-   * \param source [inout] string to search and replace in
-   * \param find [in] string to search for
-   * \param replace [in] string to insert in place of find
-   */
-  void find_and_replace (std::string &source, const std::string find, std::string replace );
-  /**
    * Configuration path for each TypeId
    */
   std::vector<std::pair<TypeId,std::string> > m_output;
@@ -1153,10 +1142,7 @@
       TypeId child = TypeId::GetRegistered (j);
       if (child.IsChildOf (tid))
         {
-          //please take a look at the following note for an explanation 
-          std::string childName = "$" + temporaryCharacter + child.GetName ();
-          std::string replaceWith = "::" + temporaryCharacter;
-          find_and_replace(childName,"::",replaceWith);
+          std::string childName = "$" + child.GetName ();
           m_currentPath.push_back (childName);
           m_alreadyProcessed.push_back (tid);
           DoGather (child);
@@ -1178,21 +1164,7 @@
             {
               other = tmp.first;
             }
-          /**
-           * Note: for the Doxygen version only, we insert a % in the
-           * path below to ensure that doxygen does not attempt to
-           * resolve the typeid names included in the string.  if the
-           * name contains ::, using the % sign will remove that sign
-           * resulting for instance in $ns3MobilityModel instead of
-           * $ns3::MobilityModel hence the output must be in the form
-           * $%ns3::%MobilityModel in order to show correctly
-           * $ns3::MobilityModel We add at the beginning of the name
-           * $% and we replace all the :: in the string by ::%.
-           */  
-          std::string name = "$" + temporaryCharacter + other.GetName ();
-          //finding and replacing :: by ::% (for Doxygen version only).
-          std::string replaceWith = "::" + temporaryCharacter;
-          find_and_replace(name,"::",replaceWith);
+          std::string name = "$" + other.GetName ();
           m_currentPath.push_back (name);
           m_alreadyProcessed.push_back (tid);
           DoGather (other);
@@ -1203,20 +1175,6 @@
 }  // StaticInformation::DoGather ()
 
 
-void 
-StaticInformation::find_and_replace( std::string &source, const std::string find, std::string replace )
-{
-  NS_LOG_FUNCTION (this << source << find << replace);
-  size_t j; 
-  j = source.find (find);
-  while (j != std::string::npos ) 
-    {
-      source.replace (j, find.length (),replace);
-      j = source.find (find,j+1);
-    }
-}
-
-
 StaticInformation
 GetTypicalAggregations ()
 {
@@ -1333,8 +1291,8 @@
 	{
 	  std::string path = paths[k];
 	  os << listLineStart
-	     <<   "\"" << path << "\""
-	     << listLineStop
+             <<   "\"" << path << "\""
+	     <<  listLineStop 
 	     << breakTextOnly
 	     << std::endl;
 	}