[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3014 - in gnunet-qt/src: common include
From: |
durner |
Subject: |
[GNUnet-SVN] r3014 - in gnunet-qt/src: common include |
Date: |
Fri, 16 Jun 2006 06:12:05 -0700 (PDT) |
Author: durner
Date: 2006-06-16 06:12:00 -0700 (Fri, 16 Jun 2006)
New Revision: 3014
Added:
gnunet-qt/src/common/gstring.cc
Modified:
gnunet-qt/src/common/common.pro.in
gnunet-qt/src/include/gnunet_qt_common.h
Log:
GString (extended QString with "proper case" support)
Modified: gnunet-qt/src/common/common.pro.in
===================================================================
--- gnunet-qt/src/common/common.pro.in 2006-06-16 10:38:05 UTC (rev 3013)
+++ gnunet-qt/src/common/common.pro.in 2006-06-16 13:12:00 UTC (rev 3014)
@@ -8,5 +8,5 @@
INCLUDEPATH = ../include
-SOURCES = pluginLoader.cc
+SOURCES = pluginLoader.cc gstring.cc
HEADERS = pluginLoader.h ../include/gnunet_qt_common.h
\ No newline at end of file
Added: gnunet-qt/src/common/gstring.cc
===================================================================
--- gnunet-qt/src/common/gstring.cc 2006-06-16 10:38:05 UTC (rev 3013)
+++ gnunet-qt/src/common/gstring.cc 2006-06-16 13:12:00 UTC (rev 3014)
@@ -0,0 +1,60 @@
+/*
+ This file is part of gnunet-qt.
+ (C) 2006 Nils Durner (and other contributing authors)
+
+ gnunet-qt is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ gnunet-qt is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/common/gstring.cc
+ * @brief Extended QString
+ * @author Nils Durner
+ */
+
+#include "gnunet_qt_common.h"
+
+/**
+ * @brief Capitalize every word in this string
+ */
+void GString::proper()
+{
+ int idx = length();
+
+ while(true)
+ {
+ QChar c = at(idx);
+
+ if (idx == 0)
+ {
+ if (c.isLower())
+ replace(0, 1, c.toUpper());
+
+ break;
+ }
+ else
+ if (c.isSpace())
+ {
+ int dst = idx + 1;
+
+ if (at(dst).isLower())
+ replace(dst, 1, at(dst).toUpper());
+ }
+
+ idx--;
+ }
+}
+
+/* end of gstring.cc */
Modified: gnunet-qt/src/include/gnunet_qt_common.h
===================================================================
--- gnunet-qt/src/include/gnunet_qt_common.h 2006-06-16 10:38:05 UTC (rev
3013)
+++ gnunet-qt/src/include/gnunet_qt_common.h 2006-06-16 13:12:00 UTC (rev
3014)
@@ -61,6 +61,17 @@
QList<GPluginSpec> plugins;
};
+class GString : public QString
+{
+public:
+ GString(const char *str) : QString(str) {};
+
+ /**
+ * @brief Capitalize every word in this string
+ */
+ void proper();
+};
+
typedef GPlugin *(*InitPlugin) ();
typedef void (*ShutdownPlugin) (GPlugin *plugin);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3014 - in gnunet-qt/src: common include,
durner <=