diff --git a/projectfiles/CodeBlocks-SCons/wesnoth.cbp b/projectfiles/CodeBlocks-SCons/wesnoth.cbp index 4cf5010c3d5..6783ab2e9b1 100644 --- a/projectfiles/CodeBlocks-SCons/wesnoth.cbp +++ b/projectfiles/CodeBlocks-SCons/wesnoth.cbp @@ -421,6 +421,7 @@ + diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp index a89667a733a..4c7450f222a 100644 --- a/projectfiles/CodeBlocks/wesnoth.cbp +++ b/projectfiles/CodeBlocks/wesnoth.cbp @@ -452,6 +452,7 @@ + diff --git a/projectfiles/VC9/wesnoth.vcproj b/projectfiles/VC9/wesnoth.vcproj index 611c25bc1b8..470fe87233d 100644 --- a/projectfiles/VC9/wesnoth.vcproj +++ b/projectfiles/VC9/wesnoth.vcproj @@ -678,6 +678,10 @@ RelativePath="..\..\src\shared_object.hpp" > + + diff --git a/src/shared_string.hpp b/src/shared_string.hpp new file mode 100644 index 00000000000..f58aa7928ef --- /dev/null +++ b/src/shared_string.hpp @@ -0,0 +1,59 @@ +/* + Copyright (C) 2009 by Chris Hopman + Part of the Battle for Wesnoth Project http://www.wesnoth.org/ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 + or at your option any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY. + + See the COPYING file for more details. +*/ + + +#include "shared_object.hpp" +#include "tstring.hpp" +#include + +struct shared_string : public shared_object { + typedef shared_object super; + + template + shared_string(const T& o) : super(o) { } + const char* c_str() const { + return get().c_str(); + } + + operator std::string() const { + return super::operator std::string(); + } + + operator t_string() const { + return super::operator std::string(); + } + + bool empty() const { + return get().empty(); + } + + size_t find(const std::string& str, size_t pos = 0) const { + return get().find(str, pos); + } + + std::string substr(size_t pos = 0, size_t n = std::string::npos) const { + return get().substr(pos, n); + } + + size_t size() const { + return get().size(); + } + + std::string::const_iterator begin() const { + return get().begin(); + } + + std::string::const_iterator end() const { + return get().end(); + } +};