Преглед изворни кода

merge r1797 from lp:~donkult/apt/experimental

Michael Vogt пре 17 година
родитељ
комит
fa3b09450e
3 измењених фајлова са 13 додато и 8 уклоњено
  1. 11 0
      apt-pkg/contrib/strutl.cc
  2. 1 0
      apt-pkg/contrib/strutl.h
  3. 1 8
      apt-pkg/depcache.cc

+ 11 - 0
apt-pkg/contrib/strutl.cc

@@ -387,6 +387,17 @@ string SubstVar(string Str,const struct SubstVar *Vars)
    return Str;
    return Str;
 }
 }
 									/*}}}*/
 									/*}}}*/
+// OutputInDepth - return a string with separator multiplied with depth /*{{{*/
+// ---------------------------------------------------------------------
+/* Returns a string with the supplied separator depth + 1 times in it */
+std::string OutputInDepth(const unsigned long Depth, const char* Separator)
+{
+   std::string output = "";
+   for(unsigned long d=Depth+1; d > 0; d--)
+      output.append(Separator);
+   return output;
+}
+									/*}}}*/
 // URItoFileName - Convert the uri into a unique file name		/*{{{*/
 // URItoFileName - Convert the uri into a unique file name		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This converts a URI into a safe filename. It quotes all unsafe characters
 /* This converts a URI into a safe filename. It quotes all unsafe characters

+ 1 - 0
apt-pkg/contrib/strutl.h

@@ -48,6 +48,7 @@ string DeQuoteString(const string &Str);
 string SizeToStr(double Bytes);
 string SizeToStr(double Bytes);
 string TimeToStr(unsigned long Sec);
 string TimeToStr(unsigned long Sec);
 string Base64Encode(const string &Str);
 string Base64Encode(const string &Str);
+string OutputInDepth(const unsigned long Depth, const char* Separator="  ");
 string URItoFileName(const string &URI);
 string URItoFileName(const string &URI);
 string TimeRFC1123(time_t Date);
 string TimeRFC1123(time_t Date);
 bool StrToTime(const string &Val,time_t &Result);
 bool StrToTime(const string &Val,time_t &Result);

+ 1 - 8
apt-pkg/depcache.cc

@@ -15,6 +15,7 @@
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/algorithms.h>
 
 
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/tagfile.h>
@@ -47,14 +48,6 @@ ConfigValueInSubTree(const char* SubTree, const char *needle)
    return false;
    return false;
 }
 }
 
 
-std::string OutputInDepth(const unsigned long Depth)
-{
-   std::string output = "";
-   for(unsigned long d=Depth; d > 0; d--)
-      output += "  ";
-   return output;
-}
-
 pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :
 pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :
   cache(cache), released(false)
   cache(cache), released(false)
 {
 {