Added some more docs to String
[libs.git] / src / Sylph.h
blob9045744dc29a16121991af7cedadeb931abf11b7
1 /*
2 * LibSylph Class Library
3 * Copyright (C) 2009 Frank "SeySayux" Erens <seysayux@gmail.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the LibSylph Pulbic License as published
7 * by the LibSylph Developers; either version 1.0 of the License, or
8 * (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LibSylph
13 * Public License for more details.
15 * You should have received a copy of the LibSylph Public License
16 * along with this Library, if not, contact the LibSylph Developers.
18 * Created on 17 januari 2009, 15:14
21 #ifndef SYLPH_H_
22 #define SYLPH_H_
24 #include "Sylph/OS/OS.h"
25 #include "Sylph/Core/Application.h"
26 #include "Sylph/Core/Array.h"
27 #include "Sylph/Core/String.h"
28 #include "Sylph/Core/Common.h"
29 #include "Sylph/Core/AppType.h"
30 #include "Sylph/Core/UncaughtExceptionHandler.h"
32 #ifndef SYLPH_NO_SYLPHMAIN
33 #ifndef SYLPH_APP_NAME
34 #define SYLPH_APP_NAME "Application"
35 #endif
37 #ifdef SYLPH_OS_MACOSX
38 int main(int argc, char * argv[], char * envp[], char * apple[]);
39 #else
40 int main(int argc, char * argv[]);
41 #endif
42 static inline void SylphInit(int argc, char * argv[], char * apple[]) {
43 Sylph::Application::init(argc, argv, apple, Sylph::SYLPH_APP_TYPE,
44 SYLPH_APP_NAME);
46 #ifdef SYLPH_MAIN_CLASSIC_PARAMS
47 extern int SylphMain(int argc, char** argv);
48 #else
49 extern int SylphMain(Sylph::Array<Sylph::String> argv);
50 #endif
52 #ifdef SYLPH_OS_MACOSX
54 int main(int argc, char * argv[], char * envp[], char * apple[]) {
55 try {
56 SylphInit(argc, argv, apple);
57 #ifdef SYLPH_MAIN_CLASSIC_PARAMS
58 return SylphMain(argc, argv);
59 #else
60 Array<String> args(argc);
61 for(int i = 0; i < argc; ++i) {
62 args[i] = argv[i];
64 return SylphMain(args);
65 #endif
66 } catch(const Sylph::Assertion& as) {
67 Sylph::UncaughtExceptionHandler::handler->handleAssertion(as);
68 throw;
69 } catch (const Sylph::Exception & ex) {
70 Sylph::UncaughtExceptionHandler::handler->handle(ex);
71 throw;
74 #else
76 int main(int argc, char * argv[]) {
77 try {
78 SylphInit(argc, argv, Sylph::null);
79 #ifdef SYLPH_MAIN_CLASSIC_PARAMS
80 return SylphMain(argc, argv);
81 #else
82 Array<String> args(argc);
83 for(int i = 0; i < argc; ++i) {
84 args[i] = argv[i];
86 return SylphMain(args);
87 #endif
88 } catch(const Sylph::Assertion& as) {
89 Sylph::UncaughtExceptionHandler::handler->handleAssertion(as);
90 throw;
91 } catch (const Sylph::Exception & ex) {
92 Sylph::UncaughtExceptionHandler::handler->handle(ex);
93 throw;
96 #endif
98 #endif
99 #endif /* SYLPH_H_ */