Documented GViewport a small amount, fixed a translation bug in BasicViewport.
[aesalon.git] / src / visualizer / StringHacks.cpp
blob0adb27546c7d70b10b35c5ce5cb40b61a3a3908a
1 /** Aesalon, a tool to visualize program behaviour in real time.
2 Copyright (C) 2009-2011, Aesalon development team.
4 Aesalon is distributed under the terms of the GNU GPLv3. See
5 the included file LICENSE for more information.
7 @file src/visualizer/StringHacks.cpp
8 */
10 #include "visualizer/StringHacks.h"
12 std::ostream &operator<<(std::ostream &stream, const QString &string) {
13 stream << string.toStdString();
14 return stream;
17 uint qHash(const std::string &string) {
18 /* Hashing algorithm: djb2. */
19 uint hash = 0;
20 int c = 0;
21 const char *p = string.c_str();
22 while((c = (*p++))) {
23 hash = c + (hash << 6) + (hash << 16) - hash;
26 return hash;