1 #ifndef HOST_PSEUDOLOCALIZE_H
2 #define HOST_PSEUDOLOCALIZE_H
4 #include <android-base/macros.h>
5 #include "StringPool.h"
7 class PseudoMethodImpl {
9 virtual ~PseudoMethodImpl() {}
10 virtual String16 start() { return String16(); }
11 virtual String16 end() { return String16(); }
12 virtual String16 text(const String16& text) = 0;
13 virtual String16 placeholder(const String16& text) = 0;
16 class PseudoMethodNone : public PseudoMethodImpl {
19 String16 text(const String16& text) { return text; }
20 String16 placeholder(const String16& text) { return text; }
22 DISALLOW_COPY_AND_ASSIGN(PseudoMethodNone);
25 class PseudoMethodBidi : public PseudoMethodImpl {
27 String16 text(const String16& text);
28 String16 placeholder(const String16& text);
31 class PseudoMethodAccent : public PseudoMethodImpl {
33 PseudoMethodAccent() : mDepth(0), mWordCount(0), mLength(0) {}
36 String16 text(const String16& text);
37 String16 placeholder(const String16& text);
44 class Pseudolocalizer {
46 Pseudolocalizer(PseudolocalizationMethod m);
47 ~Pseudolocalizer() { if (mImpl) delete mImpl; }
48 void setMethod(PseudolocalizationMethod m);
49 String16 start() { return mImpl->start(); }
50 String16 end() { return mImpl->end(); }
51 String16 text(const String16& text);
53 PseudoMethodImpl *mImpl;
57 #endif // HOST_PSEUDOLOCALIZE_H