29 #ifndef OX_REQUIRED_RESULT 30 # if defined(__GNUC_) && !defined(__INTEL_COMPILER) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) 31 # define OX_REQUIRED_RESULT __attribute__ ((warn_unused_result)) 33 # define OX_REQUIRED_RESULT 71 : _text(text), _nextArg(0)
80 : _text(text), _nextArg(replaced + 1)
89 inline LocalizedText::operator std::string
const&()
const 100 template <
typename T>
103 std::ostringstream os;
104 os <<
'{' << _nextArg <<
'}';
105 std::string marker(os.str());
106 size_t pos = _text.find(marker);
107 if (std::string::npos == pos)
109 std::string ntext(_text);
112 std::string tval(os.str());
113 for ( ; std::string::npos != pos; pos = ntext.find(marker, pos + tval.length()))
115 ntext.replace(pos, marker.length(), tval);
126 template <
typename T>
129 std::ostringstream os;
130 os <<
'{' << _nextArg <<
'}';
131 std::string marker(os.str());
132 size_t pos = _text.find(marker);
133 if (std::string::npos != pos)
137 std::string tval(os.str());
138 for ( ; std::string::npos != pos; pos = _text.find(marker, pos + tval.length()))
140 _text.replace(pos, marker.length(), tval);
150 os << static_cast<std::string const &>(txt);
LocalizedText()
Create the empty string.
Definition: LocalizedText.h:49
#define OX_REQUIRED_RESULT
This is used to enable warning of unused results, to warn the user of costly function calls...
Definition: LocalizedText.h:33
A string that is already translated.
Definition: LocalizedText.h:43
LocalizedText arg(const std::string &) const OX_REQUIRED_RESULT
Replace next argument.
Definition: LocalizedText.cpp:30
const char * c_str() const OX_REQUIRED_RESULT
Get a pointer to underlying char data.
Definition: LocalizedText.h:53
Definition: BaseInfoState.cpp:40