| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef AAPT_COMPILE_PSEUDOLOCALIZE_H |
| 18 |
#define AAPT_COMPILE_PSEUDOLOCALIZE_H |
| 19 |
|
| 20 |
#include <memory> |
| 21 |
|
| 22 |
#include "android-base/macros.h" |
| 23 |
#include "androidfw/StringPiece.h" |
| 24 |
|
| 25 |
#include "ResourceValues.h" |
| 26 |
#include "StringPool.h" |
| 27 |
|
| 28 |
namespace aapt { |
| 29 |
|
| 30 |
class PseudoMethodImpl { |
| 31 |
public: |
| 32 |
virtual ~PseudoMethodImpl() {} |
| 33 |
virtual std::string Start() { return {}; } |
| 34 |
virtual std::string End() { return {}; } |
| 35 |
virtual std::string Text(const android::StringPiece& text) = 0; |
| 36 |
virtual std::string Placeholder(const android::StringPiece& text) = 0; |
| 37 |
}; |
| 38 |
|
| 39 |
class Pseudolocalizer { |
| 40 |
public: |
| 41 |
enum class Method { |
| 42 |
kNone, |
| 43 |
kAccent, |
| 44 |
kBidi, |
| 45 |
}; |
| 46 |
|
| 47 |
explicit Pseudolocalizer(Method method); |
| 48 |
void SetMethod(Method method); |
| 49 |
std::string Start() { return impl_->Start(); } |
| 50 |
std::string End() { return impl_->End(); } |
| 51 |
std::string Text(const android::StringPiece& text); |
| 52 |
|
| 53 |
private: |
| 54 |
std::unique_ptr<PseudoMethodImpl> impl_; |
| 55 |
size_t last_depth_; |
| 56 |
}; |
| 57 |
|
| 58 |
} |
| 59 |
|
| 60 |
#endif |