2013-03-18 21:17:26 +00:00
|
|
|
#ifndef HOST_PSEUDOLOCALIZE_H
|
|
|
|
#define HOST_PSEUDOLOCALIZE_H
|
|
|
|
|
2015-12-04 15:33:35 -08:00
|
|
|
#include <android-base/macros.h>
|
2014-03-12 14:46:44 -07:00
|
|
|
#include "StringPool.h"
|
|
|
|
|
2015-05-14 18:47:00 -07:00
|
|
|
class PseudoMethodImpl {
|
|
|
|
public:
|
|
|
|
virtual ~PseudoMethodImpl() {}
|
|
|
|
virtual String16 start() { return String16(); }
|
|
|
|
virtual String16 end() { return String16(); }
|
|
|
|
virtual String16 text(const String16& text) = 0;
|
|
|
|
virtual String16 placeholder(const String16& text) = 0;
|
|
|
|
};
|
2013-03-18 21:17:26 +00:00
|
|
|
|
2015-05-14 18:47:00 -07:00
|
|
|
class PseudoMethodNone : public PseudoMethodImpl {
|
|
|
|
public:
|
|
|
|
PseudoMethodNone() {}
|
|
|
|
String16 text(const String16& text) { return text; }
|
|
|
|
String16 placeholder(const String16& text) { return text; }
|
|
|
|
private:
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(PseudoMethodNone);
|
|
|
|
};
|
|
|
|
|
|
|
|
class PseudoMethodBidi : public PseudoMethodImpl {
|
|
|
|
public:
|
|
|
|
String16 text(const String16& text);
|
|
|
|
String16 placeholder(const String16& text);
|
|
|
|
};
|
|
|
|
|
|
|
|
class PseudoMethodAccent : public PseudoMethodImpl {
|
|
|
|
public:
|
|
|
|
PseudoMethodAccent() : mDepth(0), mWordCount(0), mLength(0) {}
|
|
|
|
String16 start();
|
|
|
|
String16 end();
|
|
|
|
String16 text(const String16& text);
|
|
|
|
String16 placeholder(const String16& text);
|
|
|
|
private:
|
|
|
|
size_t mDepth;
|
|
|
|
size_t mWordCount;
|
|
|
|
size_t mLength;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Pseudolocalizer {
|
|
|
|
public:
|
2016-08-10 14:15:30 -07:00
|
|
|
explicit Pseudolocalizer(PseudolocalizationMethod m);
|
2015-05-14 18:47:00 -07:00
|
|
|
~Pseudolocalizer() { if (mImpl) delete mImpl; }
|
|
|
|
void setMethod(PseudolocalizationMethod m);
|
|
|
|
String16 start() { return mImpl->start(); }
|
|
|
|
String16 end() { return mImpl->end(); }
|
|
|
|
String16 text(const String16& text);
|
|
|
|
private:
|
|
|
|
PseudoMethodImpl *mImpl;
|
|
|
|
size_t mLastDepth;
|
|
|
|
};
|
2013-03-18 21:17:26 +00:00
|
|
|
|
|
|
|
#endif // HOST_PSEUDOLOCALIZE_H
|
|
|
|
|