wavelength 1.0.0
Loading...
Searching...
No Matches
localizeerrors.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <map>
5#include <memory>
6
7#include "os/string.h"
8
18public:
20 enum Type {
23 };
24
30
38 explicit LocalizeErrors(const char *pszFile) : mFile(pszFile), mType(kTypeMissing) {
39 }
40
48 explicit LocalizeErrors(int nType) : mType(nType) {
49 }
50
58 LocalizeErrors(const LocalizeErrors &other) = default;
59
66 void Store();
67
76 static void CountToken(const char *pszToken, int nCount);
77
84 static void CountLocaleTokens();
85
87 const String &GetFile() const {
88 return mFile;
89 }
90
92 int GetType() const {
93 return mType;
94 }
95
97 std::list<SingleError> &GetErrors() {
98 return mErrors;
99 }
100
102 const std::list<SingleError> &GetErrors() const {
103 return mErrors;
104 }
105
107 static std::list<LocalizeErrors> *GetRecords() {
108 return sRecords.get();
109 }
110
112 static std::map<String, int> *GetTokenCounts() {
113 return sTokenCounts.get();
114 }
115
117 static void ClearRecords() {
118 sRecords.reset();
119 }
120
122 static void ClearTokenCounts() {
123 sTokenCounts.reset();
124 }
125
126private:
127 String mFile;
128 int mType;
129 std::list<SingleError> mErrors;
130
137 static std::unique_ptr<std::list<LocalizeErrors>> sRecords;
138
145 static std::unique_ptr<std::map<String, int>> sTokenCounts;
146};
LocalizeErrors(int nType)
Construct an empty record with no file.
Definition localizeerrors.h:48
void Store()
Keep a copy of the record for the report.
const std::list< SingleError > & GetErrors() const
Definition localizeerrors.h:102
Type
What a record lists, the values of mType.
Definition localizeerrors.h:20
@ kTypeMissing
Definition localizeerrors.h:21
@ kTypeUnused
Definition localizeerrors.h:22
static std::map< String, int > * GetTokenCounts()
Definition localizeerrors.h:112
LocalizeErrors(const char *pszFile)
Construct an empty record of a file's missing tokens.
Definition localizeerrors.h:38
std::list< SingleError > & GetErrors()
Definition localizeerrors.h:97
static void ClearRecords()
Delete the records Store() retained.
Definition localizeerrors.h:117
static std::list< LocalizeErrors > * GetRecords()
Definition localizeerrors.h:107
static void ClearTokenCounts()
Delete the counts of the uses of each token.
Definition localizeerrors.h:122
const String & GetFile() const
Definition localizeerrors.h:87
int GetType() const
Definition localizeerrors.h:92
LocalizeErrors(const LocalizeErrors &other)=default
Copy another record.
static void CountLocaleTokens()
Enter every token of the locale in the counts, with no uses added.
static void CountToken(const char *pszToken, int nCount)
Add to the number of times a token was used.
Growable text buffer that is also a PrnStream.
Definition string.h:19
One token of a record.
Definition localizeerrors.h:26
String mText
Definition localizeerrors.h:28
String mObject
Definition localizeerrors.h:27