2015-02-02 08:11:03 +05:30
|
|
|
//
|
|
|
|
// Author: Michael Cameron
|
|
|
|
// Email: chronokun@hotmail.com
|
|
|
|
//
|
|
|
|
|
2017-04-12 12:48:29 +05:30
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <sstream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <iostream>
|
2017-05-06 08:03:26 +05:30
|
|
|
|
|
|
|
#include "oopless-parser.hpp"
|
2017-04-11 20:57:10 +05:30
|
|
|
#include "brushdef.hpp"
|
2015-02-02 08:11:03 +05:30
|
|
|
|
2017-04-11 02:59:47 +05:30
|
|
|
using namespace std;
|
|
|
|
|
2015-02-02 08:11:03 +05:30
|
|
|
int main(const int _kiArgC, const char** _kppcArgv)
|
|
|
|
{
|
2017-06-17 01:38:46 +05:30
|
|
|
#define ARG_POS_BRUSHDEF 5
|
|
|
|
#define ARG_POS_ENTITYCONV 4
|
|
|
|
// Minimum: program, input file, output file
|
2015-02-02 08:11:03 +05:30
|
|
|
if(_kiArgC < 3)
|
|
|
|
{
|
|
|
|
return(3);
|
|
|
|
}
|
2017-06-17 16:04:19 +05:30
|
|
|
// placeholder argument parsing until something more robust is decided upon
|
|
|
|
/* // optional arg #1: brush definition - gtkradiant or netradiant style
|
2017-06-17 01:38:46 +05:30
|
|
|
void (*brushdef) (std::stringstream &, const std::vector<TPlanePoints> &);
|
|
|
|
brushdef = ((string(_kppcArgv[ARG_POS_BRUSHDEF - 1])).compare("-gtk") == 0) ?
|
|
|
|
&brushdef_gtk: &brushdef_net;
|
2017-06-17 16:04:19 +05:30
|
|
|
*/
|
2017-06-17 01:38:46 +05:30
|
|
|
// optional arg #2: entity mapping file - enables entity conversion
|
2017-06-17 16:04:19 +05:30
|
|
|
const char * const entitymap = (_kiArgC >= ARG_POS_ENTITYCONV) ?
|
|
|
|
_kppcArgv[ARG_POS_ENTITYCONV - 1]: NULL;
|
2017-06-17 01:38:46 +05:30
|
|
|
|
2017-06-17 16:04:19 +05:30
|
|
|
bool status;
|
|
|
|
try {
|
|
|
|
status = convertmap(_kppcArgv[1], _kppcArgv[2], &brushdef_net, entitymap);
|
|
|
|
} catch (exception &e) {
|
|
|
|
cout << e.what() << endl;
|
|
|
|
}
|
2017-06-17 01:38:46 +05:30
|
|
|
if (status) {
|
|
|
|
cout << "Successfully converted map "
|
|
|
|
<< _kppcArgv[1]
|
|
|
|
<< " to "
|
|
|
|
<< _kppcArgv[2]
|
|
|
|
<< endl;
|
|
|
|
} else {
|
|
|
|
cout << "Failed to convert map." << endl;
|
|
|
|
}
|
2015-02-02 08:11:03 +05:30
|
|
|
return(0);
|
2017-06-17 01:38:46 +05:30
|
|
|
}
|