summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-05-16 15:45:05 +0200
committerattilamolnar <attilamolnar@hush.com>2013-05-18 21:08:25 +0200
commit21eba8e86b3d7361bc9334b4e15e968ba095db76 (patch)
treecc13a1daebf1bae4d86602451f55aa29295c1a72
parent780757cbc172daa4d9973e8e3b87fd42cfac5541 (diff)
irc::stringjoiner cleanup
- Get rid of unused constructors - signed -> unsigned - return const ref from GetJoined()
-rw-r--r--include/hashcomp.h22
-rw-r--r--src/hashcomp.cpp26
2 files changed, 6 insertions, 42 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h
index 94c222e14..4f7065081 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -185,28 +185,12 @@ namespace irc
* @param begin The starting element in the sequence to be joined
* @param end The ending element in the sequence to be joined
*/
- stringjoiner(const std::string &seperator, const std::vector<std::string> &sequence, int begin, int end);
-
- /** Join elements of a deque, between (and including) begin and end
- * @param seperator The string to seperate values with
- * @param sequence One or more items to seperate
- * @param begin The starting element in the sequence to be joined
- * @param end The ending element in the sequence to be joined
- */
- stringjoiner(const std::string &seperator, const std::deque<std::string> &sequence, int begin, int end);
-
- /** Join elements of an array of char arrays, between (and including) begin and end
- * @param seperator The string to seperate values with
- * @param sequence One or more items to seperate
- * @param begin The starting element in the sequence to be joined
- * @param end The ending element in the sequence to be joined
- */
- stringjoiner(const std::string &seperator, const char* const* sequence, int begin, int end);
+ stringjoiner(const std::string& seperator, const std::vector<std::string>& sequence, unsigned int begin, unsigned int end);
/** Get the joined sequence
- * @return A reference to the joined string
+ * @return A constant reference to the joined string
*/
- std::string& GetJoined();
+ const std::string& GetJoined() const;
};
/** irc::modestacker stacks mode sequences into a list.
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index a2f99b70c..9fded8b4b 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -430,37 +430,17 @@ int irc::modestacker::GetStackedLine(std::vector<std::string> &result, int max_l
return n;
}
-irc::stringjoiner::stringjoiner(const std::string &seperator, const std::vector<std::string> &sequence, int begin, int end)
+irc::stringjoiner::stringjoiner(const std::string& seperator, const std::vector<std::string>& sequence, unsigned int begin, unsigned int end)
{
if (end < begin)
return; // nothing to do here
- for (int v = begin; v < end; v++)
+ for (unsigned int v = begin; v < end; v++)
joined.append(sequence[v]).append(seperator);
joined.append(sequence[end]);
}
-irc::stringjoiner::stringjoiner(const std::string &seperator, const std::deque<std::string> &sequence, int begin, int end)
-{
- if (end < begin)
- return; // nothing to do here
-
- for (int v = begin; v < end; v++)
- joined.append(sequence[v]).append(seperator);
- joined.append(sequence[end]);
-}
-
-irc::stringjoiner::stringjoiner(const std::string &seperator, const char* const* sequence, int begin, int end)
-{
- if (end < begin)
- return; // nothing to do here
-
- for (int v = begin; v < end; v++)
- joined.append(sequence[v]).append(seperator);
- joined.append(sequence[end]);
-}
-
-std::string& irc::stringjoiner::GetJoined()
+const std::string& irc::stringjoiner::GetJoined() const
{
return joined;
}