use FbTk::StringUtil API
This commit is contained in:
parent
84a81a1ac1
commit
3c7407beb4
1 changed files with 4 additions and 15 deletions
|
@ -22,33 +22,24 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "App.hh"
|
|
||||||
#include "Texture.hh"
|
#include "Texture.hh"
|
||||||
|
#include "App.hh"
|
||||||
|
#include "StringUtil.hh"
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#ifdef HAVE_CSTRING
|
#ifdef HAVE_CSTRING
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#else
|
#else
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTYPE
|
|
||||||
#include <cctype>
|
|
||||||
#else
|
|
||||||
#include <ctype.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
void Texture::setFromString(const char * const texture_str) {
|
void Texture::setFromString(const char * const texture_str) {
|
||||||
if (texture_str == 0)
|
if (texture_str == 0)
|
||||||
return;
|
return;
|
||||||
int t_len = strlen(texture_str) + 1;
|
|
||||||
char *ts = new char[t_len];
|
|
||||||
strcpy(ts, texture_str);
|
|
||||||
|
|
||||||
// to lower
|
const std::string t = FbTk::StringUtil::toLower(texture_str);
|
||||||
for (size_t byte_pos = 0; byte_pos < strlen(ts); ++byte_pos)
|
const char* ts = t.c_str();
|
||||||
ts[byte_pos] = tolower(ts[byte_pos]);
|
|
||||||
|
|
||||||
if (strstr(ts, "parentrelative")) {
|
if (strstr(ts, "parentrelative")) {
|
||||||
setType(Texture::PARENTRELATIVE);
|
setType(Texture::PARENTRELATIVE);
|
||||||
|
@ -105,8 +96,6 @@ void Texture::setFromString(const char * const texture_str) {
|
||||||
if (strstr(ts, "tiled"))
|
if (strstr(ts, "tiled"))
|
||||||
addType(Texture::TILED);
|
addType(Texture::TILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] ts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Texture::calcHiLoColors(int screen_num) {
|
void Texture::calcHiLoColors(int screen_num) {
|
||||||
|
|
Loading…
Reference in a new issue