Open Chinese Convert  1.1.0
A project for conversion between Traditional and Simplified Chinese
Common.hpp
1 /*
2  * Open Chinese Convert
3  *
4  * Copyright 2010-2014 BYVoid <byvoid@byvoid.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 // Microsoft Visual C++ specific
22 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
23 #pragma warning(disable : 4251 4266 4350 4503 4512 4514 4710 4820)
24 #endif
25 
26 #include <algorithm>
27 #include <fstream>
28 #include <functional>
29 #include <iostream>
30 #include <list>
31 #include <map>
32 #include <memory>
33 #include <sstream>
34 #include <string>
35 #include <vector>
36 
37 #include <cassert>
38 #include <cstddef>
39 #include <cstdio>
40 #include <cstring>
41 #include <ctime>
42 
43 #include "Exception.hpp"
44 #include "Export.hpp"
45 #include "Optional.hpp"
46 
47 using std::list;
48 using std::string;
49 using std::vector;
50 
51 // Forward decalarations and alias
52 namespace opencc {
53 class Config;
54 class Conversion;
55 class ConversionChain;
56 class Converter;
57 class Dict;
58 class DictEntry;
59 class DictGroup;
60 class Lexicon;
61 class MarisaDict;
62 class MultiValueDictEntry;
63 class NoValueDictEntry;
64 class Segmentation;
65 class Segments;
66 class SerializableDict;
67 class SingleValueDictEntry;
68 class TextDict;
69 typedef std::shared_ptr<Conversion> ConversionPtr;
70 typedef std::shared_ptr<ConversionChain> ConversionChainPtr;
71 typedef std::shared_ptr<Converter> ConverterPtr;
72 typedef std::shared_ptr<Dict> DictPtr;
73 typedef std::shared_ptr<DictGroup> DictGroupPtr;
74 typedef std::shared_ptr<Lexicon> LexiconPtr;
75 typedef std::shared_ptr<MarisaDict> MarisaDictPtr;
76 typedef std::shared_ptr<Segmentation> SegmentationPtr;
77 typedef std::shared_ptr<Segments> SegmentsPtr;
78 typedef std::shared_ptr<SerializableDict> SerializableDictPtr;
79 typedef std::shared_ptr<TextDict> TextDictPtr;
80 
81 #ifdef ENABLE_DARTS
82 class BinaryDict;
83 class DartsDict;
84 typedef std::shared_ptr<BinaryDict> BinaryDictPtr;
85 typedef std::shared_ptr<DartsDict> DartsDictPtr;
86 #endif
87 
88 } // namespace opencc
89 
90 #ifndef PKGDATADIR
91 const string PACKAGE_DATA_DIRECTORY = "";
92 #else // ifndef PKGDATADIR
93 const string PACKAGE_DATA_DIRECTORY = PKGDATADIR "/";
94 #endif // ifndef PKGDATADIR
95 
96 #ifndef VERSION
97 #define VERSION "1.0.*"
98 #endif // ifndef VERSION
99 
100 // The following definitions are provided by CMake
101 // #define ENABLE_DARTS