-
Notifications
You must be signed in to change notification settings - Fork 388
Expand file tree
/
Copy pathWCombinedLocalizedStrings
More file actions
94 lines (80 loc) · 2.43 KB
/
WCombinedLocalizedStrings
File metadata and controls
94 lines (80 loc) · 2.43 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WCOMBINED_LOCALIZED_STRINGS_
#define WCOMBINED_LOCALIZED_STRINGS_
#include <vector>
#include <Wt/WLocalizedStrings>
namespace Wt {
class WMessageResources;
/*! \class WCombinedLocalizedStrings Wt/WCombinedLocalizedStrings Wt/WCombinedLocalizedStrings
* \brief A localized string resolver that bundles multiple string resolvers.
*
* This class implements the localized strings interface and delegates
* WString::tr() string resolution to one or more string
* resolvers. You will typically use this class if you want to combine
* different methods of string resolution (e.g. some from files, and
* other strings using a database).
*
* \sa WApplication::setLocalizedStrings()
*/
class WT_API WCombinedLocalizedStrings : public WLocalizedStrings
{
public:
/*! \brief Constructor.
*/
WCombinedLocalizedStrings();
virtual ~WCombinedLocalizedStrings();
/*! \brief Adds a string resolver.
*
* The order in which string resolvers are added is significant:
* resolveKey() will consult each string resolver in the order they
* have been added, until a match is found.
*
* \if cpp
* Ownership of the resolver is transferred.
* \endif
*/
void add(WLocalizedStrings *resolver);
/*! \brief Inserts a string resolver.
*
* \sa add()
*/
void insert(int index, WLocalizedStrings *resolver);
/*! \brief Removes a string resolver.
*
* \if cpp
* This returns ownership of the resolver.
* \endif
*
* \sa add()
*/
void remove(WLocalizedStrings *resolver);
/*! \brief Returns the list of resolvers.
*
* \sa add(), remove()
*/
const std::vector<WLocalizedStrings *> &items() const;
virtual void refresh();
virtual void hibernate();
#ifndef WT_TARGET_JAVA
virtual bool resolveKey(const std::string& key, std::string& result);
#else // WT_TARGET_JAVA
virtual std::string *resolveKey(const std::string& key) = 0;
#endif // WT_TARGET_JAVA
#ifndef WT_TARGET_JAVA
virtual bool resolvePluralKey(const std::string& key,
std::string& result,
::uint64_t amount);
#else // WT_TARGET_JAVA
//TODO make this work for java
//virtual std::string *resolveKey(const std::string& key) = 0;
#endif // WT_TARGET_JAVA
private:
std::vector<WLocalizedStrings *> localizedStrings_;
};
}
#endif // WCOMBINED_LOCALIZED_STRINGS_