File: pseudolocalize.h

package info (click to toggle)
android-platform-frameworks-base 1%3A8.1.0%2Br23-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 179,108 kB
  • sloc: java: 783,264; cpp: 234,851; xml: 204,638; python: 2,837; ansic: 366; sh: 274; makefile: 43; sed: 19
file content (58 lines) | stat: -rw-r--r-- 1,534 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef HOST_PSEUDOLOCALIZE_H
#define HOST_PSEUDOLOCALIZE_H

#include <android-base/macros.h>
#include "StringPool.h"

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;
};

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:
  explicit Pseudolocalizer(PseudolocalizationMethod m);
  ~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;
};

#endif // HOST_PSEUDOLOCALIZE_H