summaryrefslogtreecommitdiff
path: root/util/mongoutils
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-09-14 17:08:06 +0200
committerAntonin Kral <a.kral@bobek.cz>2011-09-14 17:08:06 +0200
commit5d342a758c6095b4d30aba0750b54f13b8916f51 (patch)
tree762e9aa84781f5e3b96db2c02d356c29cf0217c0 /util/mongoutils
parentcbe2d992e9cd1ea66af9fa91df006106775d3073 (diff)
downloadmongodb-5d342a758c6095b4d30aba0750b54f13b8916f51.tar.gz
Imported Upstream version 2.0.0
Diffstat (limited to 'util/mongoutils')
-rwxr-xr-xutil/mongoutils/README2
-rw-r--r--util/mongoutils/str.h8
-rw-r--r--util/mongoutils/test.cpp2
3 files changed, 7 insertions, 5 deletions
diff --git a/util/mongoutils/README b/util/mongoutils/README
index fd2a589..f61277c 100755
--- a/util/mongoutils/README
+++ b/util/mongoutils/README
@@ -11,3 +11,5 @@
So basically, easy to use, general purpose stuff, with no arduous dependencies to drop into
any new project.
+
+ *** PLACE UNIT TESTS IN mongoutils/test.cpp ***
diff --git a/util/mongoutils/str.h b/util/mongoutils/str.h
index ea8f938..57b94fa 100644
--- a/util/mongoutils/str.h
+++ b/util/mongoutils/str.h
@@ -29,6 +29,8 @@
#include <string>
#include <sstream>
+
+// this violates the README rules for mongoutils:
#include "../../bson/util/builder.h"
namespace mongoutils {
@@ -48,13 +50,11 @@ namespace mongoutils {
class stream {
public:
mongo::StringBuilder ss;
-
template<class T>
stream& operator<<(const T& v) {
ss << v;
return *this;
}
-
operator std::string () const { return ss.str(); }
};
@@ -106,13 +106,13 @@ namespace mongoutils {
return strchr(s.c_str(), x) != 0;
}
- /** @return everything befor the character x, else entire string */
+ /** @return everything before the character x, else entire string */
inline string before(const string& s, char x) {
const char *p = strchr(s.c_str(), x);
return (p != 0) ? s.substr(0, p-s.c_str()) : s;
}
- /** @return everything befor the string x, else entire string */
+ /** @return everything before the string x, else entire string */
inline string before(const string& s, const string& x) {
const char *p = strstr(s.c_str(), x.c_str());
return (p != 0) ? s.substr(0, p-s.c_str()) : s;
diff --git a/util/mongoutils/test.cpp b/util/mongoutils/test.cpp
index d8ee461..45268c5 100644
--- a/util/mongoutils/test.cpp
+++ b/util/mongoutils/test.cpp
@@ -19,9 +19,9 @@
* limitations under the License.
*/
+#include <assert.h>
#include "str.h"
#include "html.h"
-#include <assert.h>
using namespace std;
using namespace mongoutils;