Added ifdef to exclude ICU/unicode code from Android build

This commit is contained in:
renaud gaudin 2013-04-04 10:48:33 +02:00
parent 2d88190f28
commit 8fcd9583c4
2 changed files with 36 additions and 5 deletions

View File

@ -19,6 +19,8 @@
#include "stringTools.h" #include "stringTools.h"
#ifndef __ANDROID__
/* Prepare integer for display */ /* Prepare integer for display */
std::string kiwix::beautifyInteger(const unsigned int number) { std::string kiwix::beautifyInteger(const unsigned int number) {
std::stringstream numberStream; std::stringstream numberStream;
@ -190,3 +192,26 @@ std::string kiwix::urlDecode(const std::string &SRC) {
return (ret); return (ret);
} }
#else
std::string kiwix::ucFirst (const std::string &word) {
if (word.empty())
return "";
std::string new_string = word;
new_string[0] = toupper(new_string[0]);
return new_string;
}
std::string kiwix::lcFirst (const std::string &word) {
if (word.empty())
return "";
std::string new_string = word;
new_string[0] = tolower(new_string[0]);
return new_string;
}
#endif

View File

@ -20,6 +20,7 @@
#ifndef KIWIX_STRINGTOOLS_H #ifndef KIWIX_STRINGTOOLS_H
#define KIWIX_STRINGTOOLS_H #define KIWIX_STRINGTOOLS_H
#ifndef __ANDROID__
#include <unicode/translit.h> #include <unicode/translit.h>
#include <unicode/normlzr.h> #include <unicode/normlzr.h>
#include <unicode/unistr.h> #include <unicode/unistr.h>
@ -28,6 +29,7 @@
#include <unicode/uniset.h> #include <unicode/uniset.h>
#include <unicode/ustring.h> #include <unicode/ustring.h>
#include <unicode/ucnv.h> #include <unicode/ucnv.h>
#endif
#include <iostream> #include <iostream>
#include <vector> #include <vector>
@ -36,6 +38,7 @@
#include <sstream> #include <sstream>
namespace kiwix { namespace kiwix {
#ifndef __ANDROID__
std::string removeAccents(const std::string &text); std::string removeAccents(const std::string &text);
std::string beautifyInteger(const unsigned int number); std::string beautifyInteger(const unsigned int number);
std::vector<std::string> split(const std::string&, const std::string&); std::vector<std::string> split(const std::string&, const std::string&);
@ -45,14 +48,17 @@ namespace kiwix {
void printStringInHexadecimal(const char *s); void printStringInHexadecimal(const char *s);
void printStringInHexadecimal(UnicodeString s); void printStringInHexadecimal(UnicodeString s);
#endif
std::string ucFirst(const std::string &word); std::string ucFirst(const std::string &word);
std::string lcFirst(const std::string &word); std::string lcFirst(const std::string &word);
#ifndef __ANDROID__
void stringReplacement(std::string& str, const std::string& oldStr, const std::string& newStr); void stringReplacement(std::string& str, const std::string& oldStr, const std::string& newStr);
std::string urlEncode(const std::string &c); std::string urlEncode(const std::string &c);
std::string urlDecode(const std::string &c); std::string urlDecode(const std::string &c);
#endif
} }
#endif #endif