QSFML
string.hpp
Go to the documentation of this file.
1 /* =========================================================== *
2  * QSFML (c) Kamil Koczurek | koczurekk@gmail.com *
3  * GNU GPL v3 License http://www.gnu.org/licenses/gpl-3.0.html *
4  * =========================================================== */
7 
8 #ifndef STRING_H
9 #define STRING_H
10 
11 #include <SFML/System/String.hpp>
12 #include <iostream>
13 #include <QString>
14 
15 namespace qsf {
20  class String
21  : public QString {
22  public:
29  template<typename T>
30  String(T obj)
31  : QString(obj)
32  { }
33 
39  String(std::string obj);
40 
46  String(sf::String str);
47 
53  template<typename T>
54  static String number(T num) {
55  return String(QString::number(num));
56  }
57 
63  template<typename T>
64  String arg(T var) const {
65  return String(static_cast<const QString*>(this)->arg(var));
66  }
67 
73  String arg(sf::String str) const;
74 
80  String arg(String str) const;
81 
88  operator sf::String const();
89 
97  friend std::ostream& operator <<(std::ostream& out, const String& string) {
98  return out << string.toStdString();
99  }
100  };
101 }
102 #endif // STRING_H
(almost) QString castable to sf::String
Definition: string.hpp:20
String(T obj)
Quite universal constructor.
Definition: string.hpp:30
Namespace containing all qsf classes and methods.
Definition: Image.cpp:3
static String number(T num)
QString::number() method overload.
Definition: string.hpp:54
friend std::ostream & operator<<(std::ostream &out, const String &string)
std::ostream << operator support
Definition: string.hpp:97
String arg(T var) const
QString::arg() method overload, takes any supported type.
Definition: string.hpp:64