Wexus2 0.20
|
00001 00002 /* 00003 * Copyright (c) 2011 Aleksander B. Demko 00004 * This source code is distributed under the MIT license. 00005 * See the accompanying file LICENSE.MIT.txt for details. 00006 */ 00007 00008 #ifndef __INCLUDED_WEXUS_STRINGUTIL_H__ 00009 #define __INCLUDED_WEXUS_STRINGUTIL_H__ 00010 00011 #include <QString> 00012 #include <QStringList> 00013 00014 #include <wexus/HTMLString.h> 00015 00016 namespace wexus 00017 { 00018 /** 00019 * Converts a raw :: filled C++ typename 00020 * to a __ encoded one. 00021 * 00022 * Basically, converts : to _ 00023 * 00024 * @author Aleksander Demko 00025 */ 00026 QString colonsToUnderscores(const QString &s); 00027 /** 00028 * Splits the string (a raw :: filled C++ typename) 00029 * into parts by :: 00030 * 00031 * @author Aleksander Demko 00032 */ 00033 void colonsToParts(const QString &s, QStringList &out); 00034 /** 00035 * Splits a __ encoded string back to parts 00036 * 00037 * @author Aleksander Demko 00038 */ 00039 void underscoresToParts(const QString &s, QStringList &out); 00040 00041 /** 00042 * Converts parts back into a CPP name 00043 * 00044 * @author Aleksander Demko 00045 */ 00046 QString partsToCPP(const QStringList &parts); 00047 00048 /** 00049 * Returns the same string with the first 00050 * letter lowercased. 00051 * 00052 * @author Aleksander Demko 00053 */ 00054 QString lowerFirstChar(const QString &s); 00055 00056 /** 00057 * Returns the same string with the first 00058 * letter lowercased. 00059 * 00060 * @author Aleksander Demko 00061 */ 00062 QString upperFirstChar(const QString &s); 00063 00064 /** 00065 * If the given string is null, return the default string instead. 00066 * 00067 * @author Aleksander Demko 00068 */ 00069 QString checkNull(const QString &s, const QString &def); 00070 00071 /** 00072 * If the given string is null, return the default string instead. 00073 * 00074 * Will we be needing HTMLString versions of everything? 00075 * 00076 * @author Aleksander Demko 00077 */ 00078 HTMLString checkNull(const HTMLString &s, const QString &def); 00079 }; 00080 00081 #endif 00082