Kaynağa Gözat

2008-05-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

	Use A2STR::SHARP_C and A2STR::EQUAL_C.
	* src/A2STR.cc
	* src/A2STR.h
	* src/OptionParser.cc (parse)
Tatsuhiro Tsujikawa 17 yıl önce
ebeveyn
işleme
f2588a882b
4 değiştirilmiş dosya ile 14 ekleme ve 2 silme
  1. 7 0
      ChangeLog
  2. 2 0
      src/A2STR.cc
  3. 2 0
      src/A2STR.h
  4. 3 2
      src/OptionParser.cc

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+2008-05-15  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
+
+	Use A2STR::SHARP_C and A2STR::EQUAL_C.
+	* src/A2STR.cc
+	* src/A2STR.h
+	* src/OptionParser.cc (parse)
+
 2008-05-15  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 
 	Defined fake filename `[tracker.announce]' as static const std::string.

+ 2 - 0
src/A2STR.cc

@@ -52,4 +52,6 @@ const std::string A2STR::DOT_C(".");
 
 const std::string A2STR::COLON_C(":");
 
+const std::string A2STR::EQUAL_C("=");
+
 } // namespace aria2

+ 2 - 0
src/A2STR.h

@@ -58,6 +58,8 @@ public:
   static const std::string DOT_C;
 
   static const std::string COLON_C;
+
+  static const std::string EQUAL_C;
 };
 } // namespace aria2
 

+ 3 - 2
src/OptionParser.cc

@@ -36,6 +36,7 @@
 #include "Util.h"
 #include "OptionHandlerImpl.h"
 #include "Option.h"
+#include "A2STR.h"
 #include <istream>
 #include <utility>
 
@@ -47,10 +48,10 @@ void OptionParser::parse(Option* option, std::istream& is)
   int32_t linenum = 0;
   while(getline(is, line)) {
     ++linenum;
-    if(Util::startsWith(line, "#")) {
+    if(Util::startsWith(line, A2STR::SHARP_C)) {
       continue;
     }
-    std::pair<std::string, std::string> nv = Util::split(line, "=");
+    std::pair<std::string, std::string> nv = Util::split(line, A2STR::EQUAL_C);
     OptionHandlerHandle handler = getOptionHandlerByName(nv.first);
     handler->parse(option, nv.second);
   }