Primjena biblioteke VTK u vizualizaciji znanstvenih podataka - Pmf

Primjena biblioteke VTK u vizualizaciji znanstvenih podataka - Pmf Primjena biblioteke VTK u vizualizaciji znanstvenih podataka - Pmf

web.math.pmf.unizg.hr
from web.math.pmf.unizg.hr More from this publisher
02.05.2013 Views

} return 0; Message.h #ifndef MESSAGE_H #define MESSAGE_H #include #include class Message { public: static void help(); static void error(std::string err); static void exitError(std::string err); static void simple(std::string msg); }; #endif Message.cxx #include "Message.h" void Message::error(std::string err) { std::cout

CommandInterpretation.h #ifndef COMMANDINTERPRETATON_H #define COMMANDINTERPRETATON_H #include class CommandInterpretation { private: int argc; const char** argv; bool unknown, help, filetxt, filevtk; std::string filename; void interpret(); bool extension(std::string str, const char* cstr); public: CommandInterpretation(int argc, const char* argv[]); bool isUnknown() const {return unknown;} bool isHelp() const {return help;} bool isFileTxt() const {return filetxt;} bool isFileVtk() const {return filevtk;} const char* getFileName() const {return filename.c_str();} }; #endif CommandInterpretation.cxx #include "CommandInterpretation.h" CommandInterpretation::CommandInterpretation(int argc, const char* argv[]) { this->argc=argc; this->argv=argv; unknown=false; help=false; filetxt=false; filevtk=false; filename=""; interpret(); } void CommandInterpretation::interpret() { std::string tmp; if(argc==2) { tmp=argv[1]; if(tmp.compare("-h")==0 || tmp.compare("-help")==0) { help=true; return; } if(extension(tmp, ".txt")) { 32

CommandInterpretation.h<br />

#ifndef COMMANDINTERPRETATON_H<br />

#define COMMANDINTERPRETATON_H<br />

#include <br />

class CommandInterpretation<br />

{<br />

private:<br />

int argc;<br />

const char** argv;<br />

bool unknown, help, filetxt, filevtk;<br />

std::string filename;<br />

void interpret();<br />

bool extension(std::string str, const char* cstr);<br />

public:<br />

CommandInterpretation(int argc, const char* argv[]);<br />

bool isUnknown() const {return unknown;}<br />

bool isHelp() const {return help;}<br />

bool isFileTxt() const {return filetxt;}<br />

bool isFileVtk() const {return filevtk;}<br />

const char* getFileName() const {return filename.c_str();}<br />

};<br />

#endif<br />

CommandInterpretation.cxx<br />

#include "CommandInterpretation.h"<br />

CommandInterpretation::CommandInterpretation(int argc, const char* argv[])<br />

{<br />

this->argc=argc;<br />

this->argv=argv;<br />

unknown=false;<br />

help=false;<br />

filetxt=false;<br />

filevtk=false;<br />

filename="";<br />

interpret();<br />

}<br />

void CommandInterpretation::interpret()<br />

{<br />

std::string tmp;<br />

if(argc==2)<br />

{<br />

tmp=argv[1];<br />

if(tmp.compare("-h")==0 || tmp.compare("-help")==0)<br />

{<br />

help=true;<br />

return;<br />

}<br />

if(extension(tmp, ".txt"))<br />

{<br />

32

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!