DCL 4.0
Loading...
Searching...
No Matches
main.cpp File Reference
#include <dcl/Config.h>
#include <locale.h>
#include <dcl/FileWriter.h>
#include <dcl/Arguments.h>
#include <dcl/DateTime.h>
#include "main.h"
#include "EntityCopy.h"

Go to the source code of this file.

Functions

void __main (const MainArguments &_args)
__DCL_END_NAMESPACE __DCL_USING_NAMESPACE int main (int _argc, char *_argv[])

Function Documentation

◆ __main()

void __main ( const MainArguments & _args)

Definition at line 120 of file entitycopy/main.cpp.

121{
122 String srcDriver;
123 String dstDriver;
124 {
125 String s = _args.source().substring(L"DRIVER *= *[^ ;]+", true);
126 if (!s.isEmpty()) {
127 srcDriver = s.substring(s.indexOf(L'=') + 1).trim();
128 }
129 s = _args.destination().substring(L"DRIVER *= *[^ ;]+", true);
130 if (!s.isEmpty()) {
131 dstDriver = s.substring(s.indexOf(L'=') + 1).trim();
132 }
133 }
134
135 if (srcDriver.isEmpty() || dstDriver.isEmpty()) {
136 _args.errout() << _args.value0() << L": option '--source' or '--destination' is invalid"
137 << endl << _args.tryUsage() << endl;
138 return;
139 }
140
141 EntityCopy copy(_args, srcDriver, dstDriver);
142 if (copy.initialize()) {
143 copy.doIt();
144 }
145}
#define endl
String tryUsage() const
const String & destination() const
const String & source() const

◆ main()

__DCL_END_NAMESPACE __DCL_USING_NAMESPACE int main ( int _argc,
char * _argv[] )

Definition at line 151 of file entitycopy/main.cpp.

152{
153 // std::locale::global(std::locale(""));
154 setlocale(LC_ALL, "");
155
157 {
160#if __DCL_DEBUG
161 DCLDebugSetGlobalReport(&errout);
162#endif
163 MainArguments args(output, errout);
164 if (args.parse(_argc, _argv, false)) {
165 String sep(L'=', 80);
167 output << L"Start [" << start.toString()
168 << L"]" << endl;
169 if (args.verbose()) {
170 output << L" [" << args.toString() << L"]" << endl;
171 }
172 output << sep << endl;
173
174 try {
175 __main(args);
176 }
177 catch (Exception* e) {
178 errout << e->toStringAll() << endl;
179 e->destroy();
180 }
181
183 output << sep << endl
184 << L"Finish [" << finish.toString()
185 << L" " << (finish - start).toString()
186 << L"]" << endl;
187 }
188#if __DCL_DEBUG
189#if __DCL_HAVE_ALLOC_DEBUG
190 DCLDebugDumpGlobalMemoryLeak(DCL_ALLOC_DUMP_ALL, &errout);
191#endif
192 DCLDebugSetGlobalReport(NULL);
193#endif // __DCL_DEBUG
194 }
196
197 return 0;
198}
#define NULL
Definition Config.h:340
#define STDOUT_HANDLE
Definition File.h:55
#define STDERR_HANDLE
Definition File.h:56
#define __DCL_CLEANUP
Definition Object.h:269
#define __DCL_INITIALIZE
Definition Object.h:268
String toString() const
Definition DateTime.cpp:826
static DateTime getCurrentLocalTime()
Definition DateTime.cpp:937
virtual void destroy()
Definition Exception.cpp:74
String toStringAll() const
Definition Exception.cpp:45
void __main(const MainArguments &_args)