-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathUtil.cpp
93 lines (88 loc) · 2.15 KB
/
Util.cpp
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
/*
This file is part of the Util library.
Copyright (C) 2007-2012 Benjamin Eikel <[email protected]>
Copyright (C) 2007-2012 Claudius Jähn <[email protected]>
Copyright (C) 2007-2012 Ralf Petring <[email protected]>
This library is subject to the terms of the Mozilla Public License, v. 2.0.
You should have received a copy of the MPL along with this library; see the
file LICENSE. If not, you can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "Util.h"
#include "IO/ArchiveProvider.h"
#include "IO/FSProvider.h"
#include "IO/DBFSProvider.h"
#include "IO/NetProvider.h"
#include "IO/SerialProvider.h"
#include "IO/ZIPProvider.h"
#include "Serialization/StreamerPNG.h"
#include "Serialization/StreamerSDL.h"
#include "Serialization/StreamerSDLImage.h"
#include "Serialization/StreamerTGA.h"
#include "Serialization/StreamerSTB.h"
#include "GenericAttributeSerialization.h"
#include <iostream>
namespace Util {
using namespace Serialization;
bool init() {
static int initializationCount = 0;
if(initializationCount++ == 0) {
bool result = true;
{
// Initialize file system providers
if(!FSProvider::init()) {
result = false;
}
#ifdef UTIL_HAVE_LIB_ARCHIVE
if(!ArchiveProvider::init()) {
result = false;
}
#endif /* UTIL_HAVE_LIB_ARCHIVE */
#ifdef UTIL_HAVE_LIB_SQLITE
if(!DBFSProvider::init()) {
result = false;
}
#endif /* UTIL_HAVE_LIB_SQLITE */
#ifdef UTIL_HAVE_LIB_CURL
if(!NetProvider::init()) {
result = false;
}
#endif /* UTIL_HAVE_LIB_CURL */
#ifdef UTIL_HAVE_LIB_SERIAL
if(!SerialProvider::init()) {
result = false;
}
#endif /* UTIL_HAVE_LIB_SERIAL */
#ifdef UTIL_HAVE_LIB_ZIP
if(!ZIPProvider::init()) {
result = false;
}
#endif /* UTIL_HAVE_LIB_ZIP */
}
{
// Initialize bitmap streamers
if(!StreamerPNG::init()) {
result = false;
}
if(!StreamerSDL::init()) {
result = false;
}
if(!StreamerSDLImage::init()) {
result = false;
}
if(!StreamerTGA::init()) {
result = false;
}
if(!StreamerSTB::init()) {
result = false;
}
}
{
if(!GenericAttributeSerialization::init()) {
result = false;
}
}
return result;
}
return true;
}
}