#include <Application.h>
Public Member Functions | |
Application (int argc, char *argv[]) | |
~Application () | |
const std::string & | Filename () const |
const std::string & | Portname () const |
const std::string & | Namespace () const |
const std::string & | Classname () const |
const std::string & | ListType () const |
bool | Overwrite () const |
FILE * | myfopen (const std::string &filename, const std::string &mode) |
Private Attributes | |
std::string | m_filename |
std::string | m_portname |
std::string | m_global_ns |
std::string | m_classname |
std::string | m_lt |
bool | m_overwrite |
Definition at line 28 of file Application.h.
Application::Application | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 26 of file Application.cpp.
References m_classname, m_filename, m_global_ns, m_lt, m_overwrite, and m_portname.
00026 : m_lt("std::vector") 00027 , m_overwrite(false) 00028 { 00029 if (argc < 2) 00030 { 00031 printf("Usage: %s [options] <.wsdl filename>\n", *argv); 00032 printf(" -port <portname> Select portType\n"); 00033 printf(" -namespace <ns> Define a global namespace\n"); 00034 printf(" -classname <name> Soap Client classname\n"); 00035 printf(" -lt <type> Vector type (default: std::vector)\n"); 00036 printf(" -overwrite Replace existing files\n"); 00037 00038 exit(-1); 00039 } 00040 for (int i = 1; i < argc; i++) 00041 if (!strcmp(argv[i], "-port") && i < argc - 1) 00042 m_portname = argv[++i]; 00043 else 00044 if (!strcmp(argv[i], "-overwrite")) 00045 m_overwrite = true; 00046 else 00047 if (!strcmp(argv[i], "-namespace") && i < argc - 1) 00048 m_global_ns = argv[++i]; 00049 else 00050 if (!strcmp(argv[i], "-classname") && i < argc - 1) 00051 m_classname = argv[++i]; 00052 else 00053 if (!strcmp(argv[i], "-lt") && i < argc - 1) 00054 m_lt = argv[++i]; 00055 else 00056 m_filename = argv[i]; 00057 00058 if (m_classname.empty() && !m_filename.empty()) 00059 { 00060 size_t pos = m_filename.find("."); 00061 if (pos != std::string::npos) 00062 { 00063 m_classname = m_filename.substr(0, pos); 00064 } 00065 } 00066 }
Application::~Application | ( | ) |
const std::string& Application::Filename | ( | ) | const [inline] |
Definition at line 34 of file Application.h.
References m_filename.
Referenced by main().
00034 { return m_filename; }
const std::string& Application::Portname | ( | ) | const [inline] |
Definition at line 35 of file Application.h.
References m_portname.
Referenced by Types::generate(), main(), and view_wsdl().
00035 { return m_portname; }
const std::string& Application::Namespace | ( | ) | const [inline] |
Definition at line 36 of file Application.h.
References m_global_ns.
Referenced by Wsdl::CreateImplementation(), and Wsdl::CreateInterface().
00036 { return m_global_ns; }
const std::string& Application::Classname | ( | ) | const [inline] |
Definition at line 37 of file Application.h.
References m_classname.
Referenced by Wsdl::CreateImplementation(), and Wsdl::CreateInterface().
00037 { return m_classname; }
const std::string& Application::ListType | ( | ) | const [inline] |
Definition at line 38 of file Application.h.
References m_lt.
Referenced by ComplexType::CreateInterface(), Element::CType_decl(), Element::CType_in(), Element::CType_out(), and ComplexType::to_string().
00038 { return m_lt; }
bool Application::Overwrite | ( | ) | const [inline] |
FILE * Application::myfopen | ( | const std::string & | filename, | |
const std::string & | mode | |||
) |
Definition at line 74 of file Application.cpp.
References m_overwrite.
Referenced by Wsdl::CreateImplementation(), and Wsdl::CreateInterface().
00075 { 00076 if (!mode.empty() && mode[0] == 'w') 00077 { 00078 FILE *fil = fopen(filename.c_str(), "r"); 00079 if (fil) 00080 { 00081 fclose(fil); 00082 if (!m_overwrite) 00083 { 00084 throw Exception("File already exists: " + filename); 00085 } 00086 } 00087 fil = fopen(filename.c_str(), mode.c_str()); 00088 if (!fil) 00089 { 00090 throw Exception("Couldn't create file: " + filename); 00091 } 00092 return fil; 00093 } 00094 FILE *fil = fopen(filename.c_str(), mode.c_str()); 00095 if (!fil) 00096 { 00097 throw Exception("Couldn't open file: " + filename); 00098 } 00099 return fil; 00100 }
std::string Application::m_filename [private] |
std::string Application::m_portname [private] |
std::string Application::m_global_ns [private] |
std::string Application::m_classname [private] |
std::string Application::m_lt [private] |
bool Application::m_overwrite [private] |
Definition at line 50 of file Application.h.
Referenced by Application(), myfopen(), and Overwrite().