reflex2q3/ReflexToQ3/main.cpp

54 lines
1.4 KiB
C++

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