00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "SimpleType.h"
00023 #include <Sockets/XmlNode.h>
00024 #include "WsdlException.h"
00025 #include <Sockets/Debug.h>
00026 #include "Split.h"
00027 #include "Wsdl.h"
00028
00029
00030 SimpleType::SimpleType(const Wsdl& wsdl, const Xml::XmlNode& node, const std::string& name, const std::string& ns_prefix)
00031 : TypeBase(wsdl, node, ns_prefix, Split(name).Type)
00032 , m_name(!name.empty() ? name : node.PropertyExists("name") ? node.GetProperty("name") : "")
00033 {
00034 Xml::XmlNode n(node, "restriction");
00035 if (n)
00036 {
00037 if (n.PropertyExists("base"))
00038 {
00039 std::string type = n.GetProperty("base");
00040 SetType(type);
00041 }
00042 Xml::XmlNode n2(n, "enumeration");
00043 while (n2)
00044 {
00045 std::string value = n2.GetProperty("value");
00046 std::string doc = TypeBase::Documentation(n2);
00047 m_enum.push_back(std::pair<std::string, std::string>(value, doc));
00048 ++n2;
00049 }
00050 }
00051 }
00052
00053
00054 SimpleType::~SimpleType()
00055 {
00056 }
00057
00058
00059 const std::string SimpleType::Documentation() const
00060 {
00061 return TypeBase::Documentation(m_node);
00062 }
00063
00064
00065 void SimpleType::CreateInterface(FILE *fil, int lvl) const
00066 {
00067 for (int i = 0; i < lvl; i++)
00068 fprintf(fil, "\t");
00069 fprintf(fil, "typedef %s %s;\n\n", CType().c_str(), Split(m_name).CName.c_str());
00070 }
00071
00072
00073 const std::string SimpleType::CType() const
00074 {
00075 return TypeBase::CType();
00076 }
00077
00078